Skip to content

Commit

Permalink
Add CIRCT to CI and update CI versions (#393)
Browse files Browse the repository at this point in the history
* Add CIRCT to CI and update CI versions
* Fix CI sentinel to work properly
  • Loading branch information
jackkoenig authored Feb 17, 2023
1 parent 0b374c1 commit f770ea7
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 18 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/install-circt/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Install CIRCT

inputs:
version:
description: 'version to install'
required: false
default: 'firtool-1.30.0'

runs:
using: composite
steps:
- id: cache-circt
uses: actions/cache@v3
with:
path: circt
key: circt-${{ runner.os }}-${{ inputs.version }}

- shell: bash
if: steps.cache-circt.outputs.cache-hit != 'true'
run: |
mkdir circt
wget -q -O - https://github.com/llvm/circt/releases/download/${{ inputs.version }}/circt-bin-ubuntu-20.04.tar.gz | tar -zx -C circt/
- shell: bash
run: echo "$(pwd)/circt/bin" >> $GITHUB_PATH
64 changes: 46 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Scala
uses: olafurpg/setup-scala@v10
uses: actions/setup-java@v3
with:
java-version: adopt@1.8
- name: Cache Scala
uses: coursier/cache-action@v5
distribution: 'adopt'
java-version: '8'
cache: 'sbt'
- name: Calculate API Docs Cache Key
id: calc-key
run: |
KEY=$(make --always-make --dry-run apis-${{ matrix.project }} | sha256sum | awk '{print $1}')
echo "::set-output name=cache_key::${KEY}"
- name: Cache API Docs
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: build/api/${{ matrix.project }}
key: ${{ runner.os }}-${{ matrix.project }}-${{ steps.calc-key.outputs.cache_key }}
Expand All @@ -41,7 +41,7 @@ jobs:
- name: Tar build artifacts
run: tar zcf build/api/${{ matrix.project }}.tar.gz build/api/${{ matrix.project }}
- name: Share API Docs
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.project }}-api-docs
path: build/api/${{ matrix.project }}.tar.gz
Expand All @@ -53,21 +53,23 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Scala
uses: olafurpg/setup-scala@v10
uses: actions/setup-java@v3
with:
java-version: [email protected]
- name: Cache Scala
uses: coursier/cache-action@v5
distribution: 'adopt'
java-version: '8'
cache: 'sbt'
- name: Install CIRCT
uses: ./.github/workflows/install-circt
- name: Setup Ruby
uses: actions/setup-ruby@v1
- name: Setup Jekyll
run: |
gem install jekyll -v 4.2.0
gem install jekyll-redirect-from
- name: Download all built API docs
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Untar build artifacts
Expand All @@ -85,13 +87,39 @@ jobs:
FOLDER: docs/target/site

# Sentinel job to simplify how we specify which checks need to pass in branch
# protection and in Mergify
# protection. This job checks that all jobs were successful.
#
# When adding new jobs, please add them to `needs` below
all_tests_passed:
name: "all tests passed"
check-tests:
name: "check tests"
needs: [api-docs, website]
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
if: success() # only run if all tests have passed
outputs:
success: ${{ steps.setoutput.outputs.success }}
steps:
- run: echo Success!
- id: setoutput
run: echo "success=true" >> $GITHUB_OUTPUT

# Related to check-tests above, this job _always_ runs (even if tests fail
# and thus check-steps is skipped). This two sentinel job approach avoids an
# issue where failing tests causes a single sentinel job to be skipped which
# counts as passing for purposes of branch protection.
#
# See: https://brunoscheufler.com/blog/2022-04-09-the-required-github-status-check-that-wasnt
all_tests_passed:
name: "all tests passed"
runs-on: ubuntu-20.04
if: always() # Always run so that we never skip this check
needs: check-tests
# Pass only if check-tests set its output value
steps:
- run: |
PASSED="${{ needs.check-tests.outputs.success }}"
if [[ $PASSED == "true" ]]; then
echo "### All tests passed! :rocket:" >> $GITHUB_STEP_SUMMARY
exit 0
else
echo "### One or more tests FAILED! :bangbang:" >> $GITHUB_STEP_SUMMARY
exit 1
fi

0 comments on commit f770ea7

Please sign in to comment.