Skip to content

Commit

Permalink
Move out common steps CI to a composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
yfyf committed Nov 29, 2024
1 parent 39ea03b commit 2988af3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 51 deletions.
13 changes: 13 additions & 0 deletions .github/actions/prep-build-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: "Prepare nix build environment"
runs:
using: "composite"
steps:
- name: Ensure KVM is usable by nix-build
run: sudo chmod a+rwx /dev/kvm
shell: bash
- uses: cachix/install-nix-action@v18
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
system-features = nixos-test benchmark big-parallel kvm
- uses: DeterminateSystems/magic-nix-cache-action@v8
59 changes: 8 additions & 51 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,8 @@ jobs:
matrix:
file: ${{fromJson(needs.prepare-matrix.outputs.integration_tests)}}
steps:
- name: Ensure KVM is usable by nix-build
run: sudo chmod a+rwx /dev/kvm
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v18
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
system-features = nixos-test benchmark big-parallel kvm
- uses: DeterminateSystems/magic-nix-cache-action@v8
- uses: ./.github/actions/prep-build-env
- run: NIXPKGS_ALLOW_UNFREE=1 nix-build ${{ matrix.file }}


Expand All @@ -49,62 +42,36 @@ jobs:
matrix:
file: ${{fromJson(needs.prepare-matrix.outputs.manual_tests)}}
steps:
- name: Ensure KVM is usable by nix-build
run: sudo chmod a+rwx /dev/kvm
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v18
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
system-features = nixos-test benchmark big-parallel kvm
- uses: DeterminateSystems/magic-nix-cache-action@v8
- uses: ./.github/actions/prep-build-env
- run: NIXPKGS_ALLOW_UNFREE=1 nix-build -A driverInteractive ${{ matrix.file }}


kiosk-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v18
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
system-features = nixos-test benchmark big-parallel kvm
- uses: DeterminateSystems/magic-nix-cache-action@v8
- uses: ./.github/actions/prep-build-env
- run: cd kiosk && nix-shell --run bin/test

build-vm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v18
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
system-features = nixos-test benchmark big-parallel kvm
- uses: DeterminateSystems/magic-nix-cache-action@v8
- uses: ./.github/actions/prep-build-env
- run: NIXPKGS_ALLOW_UNFREE=1 ./build vm

e2e-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prep-build-env
- name: Make more space available on the runner
run: |
sudo rm -rf /usr/share/dotnet \
/usr/local/lib/android \
/opt/ghc \
/opt/hostedtoolcache/CodeQL
- name: Ensure KVM is usable by nix-build
run: sudo chmod a+rwx /dev/kvm

- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v18
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
system-features = nixos-test benchmark big-parallel kvm
- uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Make magic-nix-cache read-only by removing post-build-hook
run: sed -i '/post-build-hook = magic-nix-cache-build-hook/d' $HOME/.config/nix/nix.conf
- run: ./build test-e2e
Expand All @@ -116,22 +83,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v18
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
system-features = nixos-test benchmark big-parallel kvm
- uses: DeterminateSystems/magic-nix-cache-action@v8
- uses: ./.github/actions/prep-build-env
- run: cd controller && nix-shell --run 'bin/test --force --no-buffer'

ocaml-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v18
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
system-features = nixos-test benchmark big-parallel kvm
- uses: DeterminateSystems/magic-nix-cache-action@v8
- uses: ./.github/actions/prep-build-env
- run: cd controller && nix-shell --run 'dune build @fmt'

0 comments on commit 2988af3

Please sign in to comment.