Running Chisel in GitHub Action causes Firrtl permission error
Type of issue: Bug Report
Please provide the steps to reproduce the problem: I have been using the GitHub workflow below for a long time. When I bump the Chisel version to the latest 6.7.0, it fails.
name: Continuous Integration
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
jobs:
code-check:
...
test:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Verilator
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: verilator
version: 1.0
- name: Setup Coursier Cache
uses: coursier/cache-action@v6
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Setup Mill
uses: zhutmost/setup-mill@main
- name: Run tests
run:
mill __.test
The error log is:
...
[242-0] - should return the same result as MuxPriority, or the default value if no sel signal is asserted *** FAILED ***
[242-0] circt.stage.phases.Exceptions$FirtoolNotFound: Error resolving firtool
[242-0] ------------------------------------------------------------------------------
[242-0] Chisel requires firtool, the MLIR-based FIRRTL Compiler (MFC), to generate Verilog.
[242-0] Something is wrong with your firtool installation, please see the following logging
[242-0] information.
[242-0] Failed to fetch firtool:
[242-0] CHISEL_FIRTOOL_PATH not set
[242-0] firtool version not found in resources (jdk.internal.loader.ClassLoaders$AppClassLoader@639fee[48](https://github.com/zhutmost/chipmunk/actions/runs/15939285662/job/44964885713#step:8:49)/org.chipsalliance/llvm-firtool/project.version)
[242-0] Copying firtool failed with java.nio.file.FileAlreadyExistsException: /home/runner/.cache/llvm-firtool/1.62.1/bin/firtool
[242-0] ------------------------------------------------------------------------------
So I tried to manually install Firrtool in the GitHub workflow (with environment variable CHISEL_FIRTOOL_PATH ). But it still fails. Chisel ignored the env variable and still uses the built-in firtool.
All the code is open-sourced, you can find the Action log here. Link.
What is the current behavior?
What is the expected behavior?
It should run the Chisel tests in GitHub Actions successfully.
Please tell us about your environment:
GitHub Action environment with Ubuntu 24.04. Chisel version is the latest stable one (6.7.0). Mill version is 1.0.0-RC2
Other Information
What is the use case for changing the behavior? N/A
Could you refer to the method of installing CIRCT in the Chisel GitHub workflow? I think the installation method in Chisel's CI has always been working.
link: workflows/test.yml#L71C7-L83C59
- name: Install CIRCT
id: install-circt
if: ${{ inputs.circt }}
uses: circt/install-circt@3f8dda6e1c1965537b5801a43c81c287bac4eae4 # v1.1.1
with:
version: ${{ inputs.circt }}
github-token: ${{ github.token }}
# TODO have install-circt do this
- name: Set CHISEL_FIRTOOL_PATH
if: steps.install-circt.outcome == 'success'
run: |
dir=$(dirname $(which firtool))
echo "CHISEL_FIRTOOL_PATH=$dir" >> "$GITHUB_ENV"
Oh, I used my action https://github.com/zhutmost/setup-circt. It is also tested independently (see its workflow).
Why do you want to manually install CIRCT? From Chisel 6 and later, firrtool is automatically downloaded when downloading Chisel from Maven.
I have also tried use the built-in firtool. But it doesn't work with the latest chisel version.
Thats why I add a extra step to set up a firtool environment.
I think something in Chisel may have changed when upgrading from 6.6.0 to 6.7.0.
My suspicion is that this is due to a race condition in firtool-resolver that was fixed in firtool-resolver 2.0.1 (Chisel 6 is stuck on 1.3.0 for binary compatibility reasons).
If you manually update to firtool-resolver 2.0.1 does it fix the problem? You can do this by adding a dependency directly on org.chipsalliance::firtool-resolver:2.0.1
Also does upgrading to Chisel 7.0.0-RC1 fix the problem? RC2 should be coming out today, I would suggest upgrading to it even though it's still a release candidate--things have improved a lot since 6.7 🙂
If using firtool-resolver 2.0.1 fixes the issue, we can consider a 6.7.1 or 6.8.0. It's a bit annoying to do though because the release flow will have to be updated on the 6.x branch due to the End-of-Left of Sonatype publishing (https://central.sonatype.org/news/20250326_ossrh_sunset/).
Let me have a try. Some of my code need to be modified for 7.0.0 compatibility. So it need some time.
Alright I am pretty certain the issue is the race condition in firtool-resolver 1.3.0 (well any version other than 2.0.1). I'm not sure why setting CHISEL_FIRTOOL_PATH didn't work, but manually installing firtool does work, here's how I did it by running firtool-resolver myself manually before running the tests:
https://github.com/jackkoenig/chipmunk/commit/3a4307f5fdf895ff60314b873b5b07295bd385e6
and you can see the Github Action completed successfully here: https://github.com/jackkoenig/chipmunk/actions/runs/16080047071/job/45383073207
I still think you should upgrade to 7.0.0-RC2 (which we released yesterday), but this can serve as a workaround in the meantime so that you don't have to rush.
I bet setting CHISEL_FIRTOOL_PATH doesn't work due to Mill's [relatively new] sandboxing, so figuring out how to get an environment variable into the sandbox may be another avenue.
@jackkoenig Thank you! Could you also be so kind as to look into this issue (regarding svsim)? #4240 I raised it last year, but it seems to have received no attention.