| name: ci |
| |
| on: |
| push: |
| branches: |
| - master |
| - main |
| pull_request: |
| branches: |
| - master |
| - main |
| workflow_dispatch: |
| |
| env: |
| BOT_USER: "Deployment Bot" |
| BOT_EMAIL: "verible-dev@googlegroups.com" |
| GHA_MACHINE_TYPE: "n2-standard-8" |
| DEBIAN_FRONTEND: "noninteractive" |
| VERIBLE_BINDIR: "/tmp/verible-bin" |
| |
| jobs: |
| |
| |
| VerifyFormatting: |
| container: ubuntu:20.04 |
| runs-on: [self-hosted, Linux, X64] |
| |
| 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: | |
| apt -qqy update |
| apt -qq -y install clang-format git |
| clang-format --version |
| |
| - name: Run formatting style check |
| run: ./.github/bin/run-clang-format.sh |
| |
| - name: ๐ค Upload performance graphs |
| uses: actions/upload-artifact@v2 |
| if: success() || failure() |
| with: |
| name: "diag" |
| path: "**/plot_*.svg" |
| |
| ClangTidy: |
| container: ubuntu:20.04 |
| runs-on: [self-hosted, Linux, X64] |
| |
| env: |
| GHA_MACHINE_TYPE: "n2-standard-4" |
| |
| 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: | |
| apt -qqy update |
| apt -qq -y install clang-tidy-11 build-essential git wget |
| source ./.github/settings.sh |
| ./.github/bin/install-bazel.sh |
| 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@v3 |
| with: |
| path: | |
| /tmp/clang-tidy-hashes.cache |
| /root/.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 |
| |
| - name: ๐ค Upload performance graphs |
| uses: actions/upload-artifact@v2 |
| if: success() || failure() |
| with: |
| name: "diag" |
| path: "**/plot_*.svg" |
| |
| |
| Check: |
| container: ubuntu:20.04 |
| runs-on: [self-hosted, Linux, X64] |
| 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@v3 |
| if: matrix.mode != 'clean' && matrix.mode != 'coverage' |
| with: |
| path: "/root/.cache/bazel" |
| key: bazelcache_${{ matrix.mode }}_${{ steps.cache_timestamp.outputs.time }} |
| restore-keys: bazelcache_${{ matrix.mode }}_ |
| |
| - name: Install Dependencies |
| run: | |
| set -x |
| apt -qqy update |
| apt -qq -y install clang-10 build-essential wget git python3 python-is-python3 gcc-10 g++-10 default-jdk |
| source ./.github/settings.sh |
| ./.github/bin/set-compiler.sh 10 |
| ./.github/bin/install-bazel.sh |
| |
| - name: ${{ matrix.mode }} Verible |
| run: ./.github/bin/build-and-test.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 |
| verbose: true |
| continue-on-error: true |
| |
| - name: Gather and pack binaries |
| if: matrix.mode == 'compile' |
| run: bazel run :install -c fastbuild -- $VERIBLE_BINDIR && tar cfv verible-bin.tar -C $VERIBLE_BINDIR . |
| |
| - name: Upload bazel-bin |
| if: matrix.mode == 'compile' |
| uses: actions/upload-artifact@v2 |
| with: |
| name: verible-bin |
| path: verible-bin.tar |
| |
| |
| - name: ๐ค Upload performance graphs |
| uses: actions/upload-artifact@v2 |
| if: success() || failure() |
| with: |
| name: "diag" |
| path: "**/plot_*.svg" |
| |
| |
| 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 |
| container: debian:bullseye |
| runs-on: [self-hosted, Linux, X64] |
| # 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 }}' |
| DOCKER_DATA_ROOT: "/root/.docker" |
| GHA_MACHINE_TYPE: "n2-highcpu-8" |
| name: 'Build ยท ${{ matrix.os }}:${{ matrix.ver }}' |
| |
| steps: |
| |
| - uses: actions/checkout@v2 |
| with: |
| # Download complete repository + tags |
| fetch-depth: 0 |
| |
| - name: Install and setup Docker |
| run: "apt -qqy update && apt -qqy --no-install-recommends install docker.io cgroupfs-mount crun fuse-overlayfs pigz ca-certificates git && cgroupfs-mount" |
| |
| - name: Main script |
| run: | |
| set -x |
| |
| mkdir -p "$DOCKER_DATA_ROOT" |
| dockerd \ |
| -s fuse-overlayfs \ |
| --add-runtime=crun=/usr/bin/crun \ |
| --default-runtime=crun \ |
| --config-file="" \ |
| --data-root=$DOCKER_DATA_ROOT > /dev/null 2>&1 & |
| while ! test -S /var/run/docker.sock; do echo "Waiting for Docker..." && sleep 1; done; docker info |
| trap "kill $(cat /var/run/docker.pid)" EXIT |
| |
| docker pull $MATRIX_OS |
| 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 |
| |
| - name: ๐ค Upload performance graphs |
| uses: actions/upload-artifact@v2 |
| if: success() || failure() |
| with: |
| name: "diag" |
| path: "**/plot_*.svg" |
| |
| 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@v3 |
| 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@v3 |
| 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 |
| |
| GhPages: |
| name: Build and deploy GitHub pages |
| needs: [Check] |
| runs-on: ubuntu-22.04 |
| steps: |
| - uses: actions/checkout@v3 |
| |
| - uses: actions/download-artifact@v3 |
| with: |
| name: verible-bin |
| |
| - name: Extract Verible binaries |
| run: mkdir -p $VERIBLE_BINDIR && tar xvf verible-bin.tar -C $VERIBLE_BINDIR |
| |
| - name: Set up things for GitHub Pages deployment |
| run: ./.github/bin/github-pages-setup.sh $VERIBLE_BINDIR |
| |
| - 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 |