nix-ci.yml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. name: Nix CI
  2. on:
  3. workflow_dispatch: # allows manual triggering
  4. push:
  5. branches:
  6. - master
  7. paths: ['.github/workflows/**', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.swift', '**/*.m', '**/*.sh', '**/*.py', '**/*.nix']
  8. pull_request:
  9. types: [opened, synchronize, reopened]
  10. paths: ['**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.swift', '**/*.m', '**/*.sh', '**/*.py', '**/*.nix']
  11. jobs:
  12. nix-eval:
  13. strategy:
  14. fail-fast: false
  15. matrix:
  16. os: [ ubuntu-latest, macos-latest ]
  17. runs-on: ${{ matrix.os }}
  18. steps:
  19. - name: Checkout repository
  20. uses: actions/checkout@v4
  21. - name: Install Nix
  22. uses: DeterminateSystems/nix-installer-action@v9
  23. with:
  24. github-token: ${{ secrets.GITHUB_TOKEN }}
  25. extra-conf: |
  26. extra-substituters = https://${{ vars.CACHIX_NAME }}.cachix.org https://cuda-maintainers.cachix.org
  27. extra-trusted-public-keys = ${{ vars.CACHIX_PUBLIC_KEY }} cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=
  28. - uses: DeterminateSystems/magic-nix-cache-action@v2
  29. with:
  30. upstream-cache: https://${{ matrix.cachixName }}.cachix.org
  31. - name: List all flake outputs
  32. run: nix flake show --all-systems
  33. - name: Show all output paths
  34. run: >
  35. nix run github:nix-community/nix-eval-jobs
  36. -- --gc-roots-dir gcroot
  37. --flake
  38. ".#packages.$(nix eval --raw --impure --expr builtins.currentSystem)"
  39. nix-build:
  40. if: ${{ vars.CACHIX_NAME != '' }}
  41. strategy:
  42. fail-fast: false
  43. matrix:
  44. os: [ ubuntu-latest, macos-latest ]
  45. runs-on: ${{ matrix.os }}
  46. steps:
  47. - name: Checkout repository
  48. uses: actions/checkout@v4
  49. - name: Install Nix
  50. uses: DeterminateSystems/nix-installer-action@v9
  51. with:
  52. github-token: ${{ secrets.GITHUB_TOKEN }}
  53. extra-conf: |
  54. extra-substituters = https://${{ vars.CACHIX_NAME }}.cachix.org https://cuda-maintainers.cachix.org
  55. extra-trusted-public-keys = ${{ vars.CACHIX_PUBLIC_KEY }} cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=
  56. - uses: DeterminateSystems/magic-nix-cache-action@v2
  57. with:
  58. upstream-cache: https://${{ matrix.cachixName }}.cachix.org
  59. - name: Set-up cachix to push the results to
  60. uses: cachix/cachix-action@v13
  61. with:
  62. authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
  63. name: ${{ vars.CACHIX_NAME }}
  64. - name: Build
  65. run: >
  66. nix run github:Mic92/nix-fast-build
  67. -- --skip-cached --no-nom
  68. --flake
  69. ".#checks.$(nix eval --raw --impure --expr builtins.currentSystem)"