| name: ci | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - main | |
| pull_request: | |
| branches: | |
| - master | |
| - main | |
| workflow_dispatch: | |
| env: | |
| DOCKER_BUILDKIT: 1 | |
| BOT_USER: "Deployment Bot" | |
| BOT_EMAIL: "verible-dev@googlegroups.com" | |
| jobs: | |
| VerifyFormatting: | |
| runs-on: ubuntu-20.04 | |
| steps: | |
| - name: Cancel previous | |
| uses: styfle/cancel-workflow-action@0.8.0 | |
| with: | |
| access_token: ${{ github.token }} | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Dependencies | |
| run: | | |
| sudo apt -qq -y install clang-format | |
| clang-format --version | |
| - name: Run formatting style check | |
| run: ./.github/bin/run-clang-format.sh | |
| ClangTidy: | |
| runs-on: ubuntu-20.04 | |
| steps: | |
| - name: Cancel previous | |
| uses: styfle/cancel-workflow-action@0.8.0 | |
| with: | |
| access_token: ${{ github.token }} | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Dependencies | |
| run: | | |
| sudo apt -qq -y install clang-tidy-11 | |
| echo "TMPDIR=/tmp" >> $GITHUB_ENV | |
| - name: Create Cache Timestamp | |
| id: cache_timestamp | |
| uses: nanzm/get-time-action@v1.1 | |
| with: | |
| format: 'YYYY-MM-DD-HH-mm-ss' | |
| - name: Retrieve cached results | |
| uses: actions/cache@v2 | |
| with: | |
| path: | | |
| /tmp/clang-tidy-hashes.cache | |
| /home/runner/.cache/bazel | |
| key: clang-tidy-${{ steps.cache_timestamp.outputs.time }} | |
| restore-keys: clang-tidy- | |
| - name: Run clang tidy | |
| run: ./.github/bin/run-clang-tidy.sh | |
| Check: | |
| runs-on: ubuntu-20.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| mode: | |
| - test | |
| - smoke-test | |
| - asan | |
| - asan-clang | |
| - compile | |
| - compile-clang | |
| - coverage | |
| - clean | |
| env: | |
| MODE: ${{ matrix.mode }} | |
| name: ${{ matrix.mode }} | |
| steps: | |
| - name: Cancel previous | |
| uses: styfle/cancel-workflow-action@0.8.0 | |
| with: | |
| access_token: ${{ github.token }} | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| with: | |
| # Download complete repository + tags | |
| fetch-depth: 0 | |
| - name: Create Cache Timestamp | |
| id: cache_timestamp | |
| uses: nanzm/get-time-action@v1.1 | |
| with: | |
| format: 'YYYY-MM-DD-HH-mm-ss' | |
| - name: Mount bazel cache | |
| uses: actions/cache@v2 | |
| if: matrix.mode != 'clean' && matrix.mode != 'coverage' | |
| with: | |
| path: "/home/runner/.cache/bazel" | |
| key: bazelcache_${{ matrix.mode }}_${{ steps.cache_timestamp.outputs.time }} | |
| restore-keys: bazelcache_${{ matrix.mode }}_ | |
| - name: Install Dependencies | |
| run: | | |
| set -x | |
| source ./.github/settings.sh | |
| sudo apt -qq -y install clang-10 | |
| ./.github/bin/set-compiler.sh 9 | |
| ./.github/bin/install-bazel.sh | |
| - name: ${{ matrix.mode }} Verible | |
| run: ./.github/bin/build-and-test.sh | |
| - name: Set up things for GitHub Pages deployment | |
| if: matrix.mode == 'compile' | |
| run: ./.github/bin/github-pages-setup.sh | |
| - name: Upload coverage | |
| # will show up under https://app.codecov.io/gh/chipsalliance/verible | |
| if: matrix.mode == 'coverage' | |
| uses: codecov/codecov-action@v2 | |
| with: | |
| files: bazel-out/_coverage/_coverage_report.dat | |
| fail_ci_if_error: true | |
| verbose: true | |
| - name: Deployment | |
| if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && matrix.mode == 'compile' | |
| uses: JamesIves/github-pages-deploy-action@3.7.1 | |
| with: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| BRANCH: gh-pages | |
| FOLDER: /tmp/pages | |
| CLEAN: true | |
| Kythe: | |
| runs-on: ubuntu-20.04 | |
| if: false # Currently disabled, need to investigate failure. | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| with: | |
| # Download complete repository + tags | |
| fetch-depth: 0 | |
| - name: Install Dependencies | |
| run: | | |
| source ./.github/settings.sh | |
| ./.github/bin/set-compiler.sh 9 | |
| ./.github/bin/install-bazel.sh | |
| ./.github/bin/install-kythe.sh | |
| - name: Run Kythe | |
| run: | | |
| source ./.github/settings.sh | |
| ./.github/bin/verify-kythe-extraction.sh | |
| ./.github/bin/run-kythe.sh | |
| - name: ๐ค Upload Kythe output | |
| uses: actions/upload-artifact@v2 | |
| with: | |
| path: kythe_output/*.kzip | |
| Matrix: | |
| runs-on: ubuntu-latest | |
| name: Generate Build matrix | |
| outputs: | |
| matrix: ${{ steps.generate.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - id: generate | |
| run: ./.github/bin/generate-matrix.py | |
| Build: | |
| needs: Matrix | |
| runs-on: ubuntu-20.04 | |
| # Github actions resources are limited; don't build artifacts for all | |
| # platforms on every pull request, only on push. | |
| if: ${{github.event_name == 'push'}} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: ${{ fromJson(needs.Matrix.outputs.matrix) }} | |
| env: | |
| MATRIX_OS: '${{ matrix.os }}:${{ matrix.ver }}' | |
| name: 'Build ยท ${{ matrix.os }}:${{ matrix.ver }}' | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| # Download complete repository + tags | |
| fetch-depth: 0 | |
| - run: docker pull $MATRIX_OS | |
| - name: Main script | |
| run: | | |
| set -x | |
| source ./.github/settings.sh | |
| ./releasing/docker-run.sh $MATRIX_OS | |
| - name: ๐ค Upload artifact | |
| uses: actions/upload-artifact@v2 | |
| with: | |
| path: releasing/out/verible-*.tar.gz | |
| MacOsBuild: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Create Cache Timestamp | |
| id: cache_timestamp | |
| uses: nanzm/get-time-action@v1.1 | |
| with: | |
| format: 'YYYY-MM-DD-HH-mm-ss' | |
| - name: Mount bazel cache | |
| uses: actions/cache@v2 | |
| with: | |
| path: "/private/var/tmp/_bazel_runner" | |
| key: bazelcache_macos_${{ steps.cache_timestamp.outputs.time }} | |
| restore-keys: bazelcache_macos_ | |
| - name: Tests | |
| run: bazel test --test_output=errors --cxxopt=-Wno-range-loop-analysis //... | |
| WindowsBuild: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Create Cache Timestamp | |
| id: cache_timestamp | |
| uses: nanzm/get-time-action@v1.1 | |
| with: | |
| format: 'YYYY-MM-DD-HH-mm-ss' | |
| - name: Mount bazel cache | |
| uses: actions/cache@v2 | |
| with: | |
| path: "c:/users/runneradmin/_bazel_runneradmin" | |
| key: bazelcache_windows2_${{ steps.cache_timestamp.outputs.time }} | |
| restore-keys: bazelcache_windows2_ | |
| - name: Install dependencies | |
| run: choco install llvm | |
| - name: Debug bazel directory settings | |
| run: bazel info | |
| - name: Run Tests | |
| run: bazel test --test_output=errors //... | |
| - name: Build Verible Binaries | |
| run: bazel build -c opt :install-binaries | |
| - name: Prepare release | |
| run: | | |
| $VERSION = git describe --match=v* | |
| bazel run -c opt :install -- "c:/verible-${VERSION}-win64" | |
| 7z a "verible-${VERSION}-win64.zip" "c:/verible-${VERSION}-win64" | |
| - name: ๐ค Upload artifact | |
| uses: actions/upload-artifact@v2 | |
| with: | |
| path: verible-*.zip | |
| # We need to shut down bazel to let go of the filedescriptors in the | |
| # cache directory. Because of strange filesystem semantics on Windows, this | |
| # prevents packaging up the cache. | |
| - name: Stop Bazel | |
| run: | | |
| bazel shutdown | |
| # The cache pack/restore has issues with these symbolic links | |
| rm c:/users/runneradmin/_bazel_runneradmin/*/install | |
| rm c:/users/runneradmin/_bazel_runneradmin/*/java.log | |
| Release: | |
| needs: [ Check, Build, WindowsBuild ] | |
| runs-on: ubuntu-20.04 | |
| name: ๐ฆ Release | |
| if: ${{github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')}} | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| # Download complete repository + tags | |
| fetch-depth: 0 | |
| - name: ๐ฅ Download artifacts | |
| uses: actions/download-artifact@v2 | |
| - name: Generate and apply TAG | |
| run: | | |
| git config --local user.name "$BOT_USER" | |
| git config --local user.email "$BOT_EMAIL" | |
| # Create a tag of form v0.0-183-gdf2b162-20191112132344 | |
| TAG="${TAG:-$(git describe --match=v*)}" | |
| git tag "$TAG" || true | |
| echo "TAG=$TAG" >> $GITHUB_ENV | |
| ls -lah artifact | |
| - name: Deploy release and assets | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: artifact/verible-*.{tar.gz,zip} | |
| tag: ${{ env.TAG }} | |
| overwrite: true | |
| file_glob: true |