From 981aee3e52b105f0a43126205e4b51b14691a683 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 17 Apr 2024 14:52:58 -1000 Subject: [PATCH] ci: binaries-linux-x64: work around unwritable $HOME issue This is for https://github.com/actions/runner/issues/863 which is causing "Preventing creation of Stack root '/github/home/.stack/'. Parent directory '/github/home/' is owned by someone else." --- .github/workflows/binaries-linux-x64.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/binaries-linux-x64.yml b/.github/workflows/binaries-linux-x64.yml index abe677a5f..a70069538 100644 --- a/.github/workflows/binaries-linux-x64.yml +++ b/.github/workflows/binaries-linux-x64.yml @@ -122,6 +122,13 @@ jobs: run: | apk --no-cache add binutils-gold curl gcc g++ git gmp-dev ncurses-dev ncurses-static libffi-dev make xz tar perl zlib-dev zlib-static + - name: Fix $HOME for following steps (workaround from https://github.com/actions/runner/issues/863) + run: | + apk --no-cache add sudo + echo "setting HOME=/root" + echo HOME=/root | sudo tee -a $GITHUB_ENV + # stack will also need --allow-different-user for some reason + - name: Add .ghcup/bin to PATH for following steps run: | echo "$HOME/.ghcup/bin/" >> $GITHUB_PATH @@ -161,16 +168,17 @@ jobs: # build with stack + # --allow-different-user is needed because of #863 above, or because we're in a docker container and stack didn't notice - name: Install GHC with stack run: | - stack setup --install-ghc + stack --allow-different-user setup --install-ghc - name: Build with stack run: | - stack build --ghc-options='-optl-static -optl-pthread' hledger # || (echo "ERROR: building hledger failed"; false) - stack build --ghc-options='-optl-static -optl-pthread' hledger-ui # || (echo "ERROR: building hledger-ui failed"; false) - stack build --ghc-options='-optl-static -optl-pthread' hledger-web # || (echo "ERROR: building hledger-web failed"; false) + stack --allow-different-user build --ghc-options='-optl-static -optl-pthread' hledger # || (echo "ERROR: building hledger failed"; false) + stack --allow-different-user build --ghc-options='-optl-static -optl-pthread' hledger-ui # || (echo "ERROR: building hledger-ui failed"; false) + stack --allow-different-user build --ghc-options='-optl-static -optl-pthread' hledger-web # || (echo "ERROR: building hledger-web failed"; false) - name: Run built-in unit tests run: |