Skip to content

Commit

Permalink
[ci] Add "nightly" option to install-circt action (chipsalliance#3452)
Browse files Browse the repository at this point in the history
Add support for grabbing the latest nightly version of `firtool` to the
install-circt action.  This requires passing the "github.token" so that
the GitHub API can be used.  Note that the token is marked as "required",
however, it is only actually needed when using a nightly build.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
  • Loading branch information
seldridge authored Aug 3, 2023
1 parent 2cc2278 commit 5fc03cd
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-scala-cli-template/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ runs:
steps:
- name: Install CIRCT
uses: ./.github/workflows/install-circt
with:
github-token: ${{ github.token }}
- name: Cache Scala-CLI
uses: coursier/cache-action@v6
- name: Setup Scala-CLI
Expand Down
36 changes: 33 additions & 3 deletions .github/workflows/install-circt/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,54 @@ name: Install CIRCT

inputs:
version:
description: 'version to install'
description: 'version to install ("nightly" installs latest nightly)'
required: false
default: 'firtool-1.48.0'
github-token:
description: 'The GitHub token used to download CIRCT nightly'
required: true
default: ${{ github.token }}

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

- shell: bash
if: steps.cache-circt.outputs.cache-hit != 'true'
if: inputs.version != 'nightly' && steps.cache-circt.outputs.cache-hit != 'true'
run: |
mkdir circt
wget -q -O - https://github.com/llvm/circt/releases/download/${{ inputs.version }}/firrtl-bin-linux-x64.tar.gz | tar -zx -C circt/ --strip-components 1
- name: Download Latest Nighlty `firtool` binary
shell: bash
if: inputs.version == 'nightly'
run: |
ARTIFACT_NAME=firrtl-bin-linux-x64.tar.gz
ARTIFACT_ID=$(
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ inputs.github-token }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/llvm/circt/actions/artifacts?name=$ARTIFACT_NAME&per_page=1" | \
jq '.artifacts[0].id')
echo $ARTIFACT_ID
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ inputs.github-token }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/llvm/circt/actions/artifacts/$ARTIFACT_ID/zip" \
--output download.zip
mkdir circt/
unzip -p download.zip | tar -zx -C circt/ --strip-components 1
rm download.zip
- shell: bash
run: echo "$(pwd)/circt/bin" >> $GITHUB_PATH
run: |
echo "$(pwd)/circt/bin" >> $GITHUB_PATH
./circt/bin/firtool -version
11 changes: 11 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
uses: ./.github/workflows/install-circt
with:
version: ${{ matrix.circt }}
github-token: ${{ github.token }}
- name: Test
run: sbt ++${{ matrix.scala }} test
- name: Binary compatibility
Expand All @@ -60,6 +61,8 @@ jobs:
mill-version: 0.11.0
- name: Install CIRCT
uses: ./.github/workflows/install-circt
with:
github-token: ${{ github.token }}
- name: Compile Mill
run: mill __.compile

Expand All @@ -77,6 +80,8 @@ jobs:
cache: 'sbt'
- name: Install CIRCT
uses: ./.github/workflows/install-circt
with:
github-token: ${{ github.token }}
- name: Check Formatting
run: sbt fmtCheck

Expand All @@ -98,6 +103,8 @@ jobs:
cache: 'sbt'
- name: Install CIRCT
uses: ./.github/workflows/install-circt
with:
github-token: ${{ github.token }}
- name: Integration Tests
run: sbt integrationTests/test

Expand Down Expand Up @@ -146,6 +153,8 @@ jobs:
gem install jekyll-redirect-from
- name: Install CIRCT
uses: ./.github/workflows/install-circt
with:
github-token: ${{ github.token }}
#TODO: make the microsite building include building ScalaDoc
- name: Build the docs
run: sbt doc
Expand Down Expand Up @@ -225,6 +234,8 @@ jobs:
fetch-depth: 0
- name: Install CIRCT
uses: ./.github/workflows/install-circt
with:
github-token: ${{ github.token }}
- name: Setup Scala
uses: actions/setup-java@v3
with:
Expand Down

0 comments on commit 5fc03cd

Please sign in to comment.