|
1 | 1 | name: test |
2 | 2 | on: [push, pull_request] |
3 | 3 | jobs: |
4 | | - build: |
| 4 | + |
| 5 | + nix-matrix: |
5 | 6 | runs-on: ubuntu-latest |
| 7 | + outputs: |
| 8 | + matrix: ${{ steps.set-matrix.outputs.matrix }} |
6 | 9 | steps: |
7 | | - - uses: actions/checkout@v5 |
| 10 | + - uses: actions/checkout@v4 |
8 | 11 | - uses: cachix/install-nix-action@v31 |
9 | | - with: |
10 | | - nix_path: nixpkgs=channel:nixos-unstable |
11 | | - - uses: cachix/cachix-action@v12 |
12 | | - with: |
13 | | - name: arximboldi |
14 | | - signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' |
15 | | - - run: nix-build |
| 12 | + - id: set-matrix |
| 13 | + name: Generate Nix Matrix |
| 14 | + run: | |
| 15 | + set -Eeu |
| 16 | + matrix="$(nix eval --json '.#githubActions.matrix')" |
| 17 | + echo "matrix=$matrix" >> "$GITHUB_OUTPUT" |
16 | 18 |
|
17 | | - macos: |
18 | | - runs-on: macos-latest |
| 19 | + build-nix: |
| 20 | + name: "nix: ${{ matrix.name }} (${{ matrix.system }})" |
| 21 | + needs: nix-matrix |
| 22 | + runs-on: ${{ matrix.os }} |
| 23 | + strategy: |
| 24 | + matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}} |
19 | 25 | steps: |
20 | | - - uses: actions/checkout@v5 |
| 26 | + - uses: actions/checkout@v4 |
21 | 27 | - uses: cachix/install-nix-action@v31 |
22 | | - with: |
23 | | - nix_path: nixpkgs=channel:nixos-unstable |
24 | | - - uses: cachix/cachix-action@v12 |
| 28 | + - uses: cachix/cachix-action@v16 |
25 | 29 | with: |
26 | 30 | name: arximboldi |
27 | 31 | signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' |
28 | | - - run: nix-shell --run 'mkdir build-mac' |
29 | | - - name: configure cmake |
30 | | - run: | |
31 | | - nix-shell --run " |
32 | | - cd build-mac && cmake .. \ |
33 | | - -DCMAKE_BUILD_TYPE=Debug |
34 | | - " |
35 | | - - run: nix-shell --run "cd build-mac && make check -j`nproc`" |
| 32 | + - run: nix build -L '.#${{ matrix.attr }}' |
36 | 33 |
|
37 | 34 | docs: |
38 | 35 | runs-on: ubuntu-latest |
39 | 36 | steps: |
40 | | - - uses: actions/checkout@v5 |
| 37 | + - uses: actions/checkout@v4 |
41 | 38 | with: |
42 | 39 | submodules: true |
43 | 40 | - uses: cachix/install-nix-action@v31 |
44 | | - with: |
45 | | - nix_path: nixpkgs=channel:nixos-unstable |
46 | | - - uses: cachix/cachix-action@v12 |
| 41 | + - uses: cachix/cachix-action@v16 |
47 | 42 | with: |
48 | 43 | name: arximboldi |
49 | 44 | signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' |
50 | | - - run: nix-shell --run "mkdir build" |
51 | | - - run: nix-shell --run "cd build && cmake .." |
52 | | - - run: nix-shell --run "cd build && make docs" |
| 45 | + - run: nix develop --command cmake -B build |
| 46 | + - run: nix develop --command make -C build docs |
53 | 47 | - uses: shimataro/ssh-key-action@v2 |
54 | 48 | if: github.repository_owner == 'arximboldi' && github.ref == 'refs/heads/master' |
55 | 49 | with: |
56 | 50 | key: ${{ secrets.SINUSOIDES_SSH_KEY }} |
57 | 51 | known_hosts: ${{ secrets.SINUSOIDES_KNOWN_HOSTS }} |
58 | | - - run: nix-shell --run "cd build && make upload-docs" |
| 52 | + - run: nix develop --command make -C build upload-docs |
59 | 53 | if: github.repository_owner == 'arximboldi' && github.ref == 'refs/heads/master' |
60 | 54 |
|
61 | 55 | check: |
62 | 56 | strategy: |
63 | 57 | matrix: |
64 | 58 | type: [Debug, Release] |
65 | | - compiler: [gcc] |
| 59 | + toolchain: [gnu, llvm] |
66 | 60 | opts: [[]] |
67 | 61 | include: |
68 | 62 | - type: Debug |
69 | | - compiler: gcc |
| 63 | + toolchain: gnu |
70 | 64 | opts: ['coverage'] |
71 | | - - type: Debug |
72 | | - compiler: clang |
73 | 65 | runs-on: ubuntu-latest |
74 | 66 | steps: |
75 | | - - uses: actions/checkout@v5 |
| 67 | + - uses: actions/checkout@v4 |
76 | 68 | - uses: cachix/install-nix-action@v31 |
77 | | - with: |
78 | | - nix_path: nixpkgs=channel:nixos-unstable |
79 | | - - uses: cachix/cachix-action@v12 |
| 69 | + - uses: cachix/cachix-action@v16 |
80 | 70 | with: |
81 | 71 | name: arximboldi |
82 | 72 | signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' |
83 | | - - run: nix-shell --argstr compiler ${{ matrix.compiler }} --run "mkdir build" |
84 | 73 | - name: configure cmake |
85 | 74 | run: | |
86 | | - nix-shell --argstr compiler ${{ matrix.compiler }} --run " |
87 | | - cd build && cmake -GNinja .. \ |
| 75 | + nix develop .#${{ matrix.toolchain }} --command \ |
| 76 | + cmake -B build -G Ninja \ |
88 | 77 | -DCMAKE_BUILD_TYPE=${{ matrix.type }} \ |
89 | 78 | -DENABLE_COVERAGE=${{ contains(matrix.opts, 'coverage') }} |
90 | | - " |
91 | | - - run: nix-shell --argstr compiler ${{ matrix.compiler }} --run "cd build && ninja check" |
92 | | - - run: nix-shell --argstr compiler ${{ matrix.compiler }} --run "bash <(curl -s https://codecov.io/bash)" |
| 79 | + - run: nix develop .#${{ matrix.toolchain }} --command ninja -C build check |
| 80 | + - run: nix develop .#${{ matrix.toolchain }} --command bash -c "bash <(curl -s https://codecov.io/bash)" |
93 | 81 | if: ${{ contains(matrix.opts, 'coverage') }} |
0 commit comments