Skip to content

Commit

Permalink
Enable CI for macOS runners
Browse files Browse the repository at this point in the history
Enabling CI for macOS runners required finding a proper way to cache the
nix store on macOS, as redirection is not supported.
  • Loading branch information
iamrecursion committed Sep 4, 2024
1 parent 8281b3f commit 659500f
Showing 1 changed file with 92 additions and 79 deletions.
171 changes: 92 additions & 79 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ on:

# Environment variables that will be set on all runners
env:
CI_DEV_SHELL: "nix --store ~/nix_store develop '.#ci'"
DEV_SHELL_LINUX: "nix --store ~/nix_store develop '.#ci'"
DEV_SHELL_MACOS: "nix develop '.#ci'"
CARGO_TERM_COLOR: always # Always colour Cargo's output.
CARGO_INCREMENTAL: 0 # Always run without incremental builds on CI.
CARGO_PROFILE_DEV_DEBUG: 0 # Don't embed debug info even though the build is a dev build.

# Configuration for individual jobs
jobs:

# This job is responsible for running the unit and integration tests.
# This job is responsible for running the unit and integration tests
test:
name: "Test"
strategy:
fail-fast: false
matrix:
# os: [ "ubuntu-latest", "macos-latest" ]
os: [ "ubuntu-latest" ]
os: [ "ubuntu-latest", "macos-latest" ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Code
Expand All @@ -32,8 +32,20 @@ jobs:
shell: "bash"
run: |
curl -sSf -L https://install.lix.systems/lix | sh -s -- install --no-confirm
ls -la
- name: Setup Devshell Command
shell: "bash"
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
echo "DEV_SHELL=${{ env.DEV_SHELL_LINUX }}" >> $GITHUB_ENV
elif [ "$RUNNER_OS" == "macOS" ]; then
echo "DEV_SHELL=${{ env.DEV_SHELL_MACOS }}" >> $GITHUB_ENV
else
exit 1
fi
- name: Restore Nix Cache
uses: actions/cache@v3
if: runner.os != 'macOS'
continue-on-error: true
with:
path: |
Expand All @@ -49,80 +61,81 @@ jobs:
- name: Build Lix Dependencies
shell: "bash"
run: |
${{ env.CI_DEV_SHELL }}
- name: Build Tests
shell: "bash"
run: |
${{ env.CI_DEV_SHELL }} --command cargo test --all-targets --no-run
- name: Run Tests
shell: "bash"
run: |
${{ env.CI_DEV_SHELL }} --command cargo test --all-targets -- --nocapture
ls -la
eval "$DEV_SHELL"
# - name: Build Tests
# shell: "bash"
# run: |
# $(DEV_SHELL) --command cargo test --all-targets --no-run
# - name: Run Tests
# shell: "bash"
# run: |
# $(DEV_SHELL) --command cargo test --all-targets -- --nocapture

# This job runs the linter.
lint:
name: "Lint"
runs-on: "ubuntu-latest"
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install Lix
shell: "bash"
run: |
curl -sSf -L https://install.lix.systems/lix | sh -s -- install --no-confirm
- name: Restore Nix Cache
uses: actions/cache@v3
continue-on-error: true
with:
path: |
~/nix_store
key: nix-${{ hashFiles('**/flake.lock') }}-ubuntu-latest
- name: Restore Rust Cache
uses: actions/cache@v3
continue-on-error: true
with:
path: |
target/
key: rust-${{ hashFiles('**/Cargo.lock') }}-ubuntu-latest
- name: Build Lix Dependencies
shell: "bash"
run: |
${{ env.CI_DEV_SHELL }}
- name: Lint Code
shell: "bash"
run: |
${{ env.CI_DEV_SHELL }} --command cargo clippy --all-targets
# This job checks the code formatting.
formatting:
name: "Check Formatting"
runs-on: "ubuntu-latest"
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install Lix
shell: "bash"
run: |
curl -sSf -L https://install.lix.systems/lix | sh -s -- install --no-confirm
- name: Restore Nix Cache
uses: actions/cache@v3
continue-on-error: true
with:
path: |
~/nix_store
key: nix-${{ hashFiles('**/flake.lock') }}-ubuntu-latest
- name: Restore Rust Cache
uses: actions/cache@v3
continue-on-error: true
with:
path: |
target/
key: rust-${{ hashFiles('**/Cargo.lock') }}-ubuntu-latest
- name: Build Lix Dependencies
shell: "bash"
run: |
${{ env.CI_DEV_SHELL }}
- name: Check Formatting
shell: "bash"
run: |
${{ env.CI_DEV_SHELL }} --command cargo fmt --all -- --check
# lint:
# name: "Lint"
# runs-on: "ubuntu-latest"
# steps:
# - name: Checkout Code
# uses: actions/checkout@v3
# - name: Install Lix
# shell: bash
# run: |
# curl -sSf -L https://install.lix.systems/lix | sh -s -- install --no-confirm
# - name: Restore Nix Cache
# uses: actions/cache@v3
# continue-on-error: true
# with:
# path: |
# ~/nix_store
# key: nix-${{ hashFiles('**/flake.lock') }}-ubuntu-latest
# - name: Restore Rust Cache
# uses: actions/cache@v3
# continue-on-error: true
# with:
# path: |
# target/
# key: rust-${{ hashFiles('**/Cargo.lock') }}-ubuntu-latest
# - name: Build Lix Dependencies
# shell: bash
# run: |
# ${{ env.DEV_SHELL_LINUX }}
# - name: Lint Code
# shell: bash
# run: |
# ${{ env.DEV_SHELL_LINUX }} --command cargo clippy --all-targets
#
# # This job checks the code formatting.
# formatting:
# name: "Check Formatting"
# runs-on: "ubuntu-latest"
# steps:
# - name: Checkout Code
# uses: actions/checkout@v3
# - name: Install Lix
# shell: bash
# run: |
# curl -sSf -L https://install.lix.systems/lix | sh -s -- install --no-confirm
# - name: Restore Nix Cache
# uses: actions/cache@v3
# continue-on-error: true
# with:
# path: |
# ~/nix_store
# key: nix-${{ hashFiles('**/flake.lock') }}-ubuntu-latest
# - name: Restore Rust Cache
# uses: actions/cache@v3
# continue-on-error: true
# with:
# path: |
# target/
# key: rust-${{ hashFiles('**/Cargo.lock') }}-ubuntu-latest
# - name: Build Lix Dependencies
# shell: bash
# run: |
# ${{ env.DEV_SHELL_LINUX }}
# - name: Check Formatting
# shell: bash
# run: |
# ${{ env.DEV_SHELL_LINUX }} --command cargo fmt --all -- --check

0 comments on commit 659500f

Please sign in to comment.