-
Notifications
You must be signed in to change notification settings - Fork 142
Description
In the GitHub Actions workflow for this repo, the last step after creating an sdist is to cd into the directory containing the unpacked sdist:
vector/.github/workflows/ci.yml
Lines 87 to 95 in 04194a0
| - name: Make sdist | |
| run: | | |
| mkdir sdist | |
| cabal sdist vector -o sdist | |
| - name: Unpack | |
| run: | | |
| mkdir unpacked | |
| tar -C unpacked -xzf sdist/vector*tar.gz | |
| cd unpacked |
I'm guessing that the intent is that later steps in the build will run inside the unpacked/ directory, ensuring that the build and test suite can be completed with only the contents of the sdist (as opposed to the contents of the whole Git repo). However, this line doesn't have any effect; later steps run in the repo root (AKA $GITHUB_WORKSPACE) and not in the unpacked/ directory. This can be seen from the output of cabal test:
Test suite logged to:
/home/runner/work/vector/vector/dist-newstyle/build/x86_64-linux/ghc-9.12.1/vector-0.13.2.0/t/vector-doctest/test/vector-0.13.2.0-vector-doctest.log
(Note the absence of unpacked/ in the path to the log.)
The GHA docs say:
Each
runkeyword represents a new process and shell in the runner environment.
In particular, I believe that the working directory is not preserved across steps in the same job.
There are three workarounds that I can think of:
(1) Explicitly set the working-directory of later steps, e.g.:
- name: Make sdist
run: |
cabal sdist -o sdist
mkdir unpacked
tar -C unpacked -xzf sdist/*.tar.gz
- name: cabal check
run: |
(cd vector-stream && cabal -vnormal check)
(cd vector && cabal -vnormal check)
working-directory: unpacked/(2) Output the sdist to a temporary directory, delete $GITHUB_WORKSPACE, and unpack the sdist to $GITHUB_WORKSPACE.
(3) Do what haskell-ci does, and create a new cabal.project file that points into the unpacked sources.