Skip to content

Commit

Permalink
CI: Only run with nix remote for ubuntu
Browse files Browse the repository at this point in the history
Previously, there would be jobs for macos-12 having `withNixRemote = true`, but without having any effect.
  • Loading branch information
avdv committed Jul 10, 2024
1 parent fef7422 commit 5046b7d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
withNixRemote:
- true
- false
exclude:
- os: macos-12
withNixRemote: true
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -39,7 +42,7 @@ jobs:
with:
buildbuddy_api_key: ${{ secrets.BUILDBUDDY_API_KEY }}
- name: Start remote Nix server
if: matrix.withNixRemote && matrix.os == 'ubuntu-latest'
if: matrix.withNixRemote

This comment has been minimized.

Copy link
@avdv

avdv Jul 11, 2024

Author Member

This change revealed a problem: you can only use the shorthand syntax in if for checks of a single field, but if you have a compound expression, you have to enclose the whole expression in ${{ ... }}.

run: |
# Generate temporary SSH keys.
mkdir -p $HOME/.ssh
Expand All @@ -52,16 +55,13 @@ jobs:
cp .github/nix-server/keys/* $HOME/.ssh/
sudo cp .github/nix-server/config /etc/ssh/ssh_config
echo "Setting BAZEL_NIX_REMOTE env variable"
echo BAZEL_NIX_REMOTE=nix-server >> "$GITHUB_ENV"
- name: Build & test
env:
BZLMOD_ENABLED: ${{ matrix.bzlmodEnabled }}
NIX_REMOTE_ENABLED: matrix.withNixRemote && matrix.os == 'ubuntu-latest'
run: |
if [ "$NIX_REMOTE_ENABLED" = "true" ]; then
echo "Setting BAZEL_NIX_REMOTE env variable"
export BAZEL_NIX_REMOTE=nix-server
fi
nix-shell --pure \
--keep GITHUB_STEP_SUMMARY \
--keep GITHUB_REPOSITORY \
Expand Down

0 comments on commit 5046b7d

Please sign in to comment.