nix-ci.yml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. name: Nix CI
  2. on:
  3. workflow_dispatch: # allows manual triggering
  4. push:
  5. branches:
  6. - master
  7. pull_request:
  8. types: [opened, synchronize, reopened]
  9. concurrency:
  10. group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
  11. cancel-in-progress: true
  12. # Fine-grant permission
  13. # https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
  14. permissions:
  15. # https://github.com/DeterminateSystems/nix-installer-action?tab=readme-ov-file#with-flakehub
  16. id-token: write
  17. contents: read
  18. jobs:
  19. nix-eval:
  20. strategy:
  21. fail-fast: false
  22. matrix:
  23. os: [ ubuntu-latest, macos-latest ]
  24. runs-on: ${{ matrix.os }}
  25. steps:
  26. - name: Checkout repository
  27. uses: actions/checkout@v4
  28. - name: Install Nix
  29. uses: DeterminateSystems/nix-installer-action@v9
  30. with:
  31. github-token: ${{ secrets.GITHUB_TOKEN }}
  32. extra-conf: |
  33. extra-substituters = https://llama-cpp.cachix.org https://cuda-maintainers.cachix.org
  34. extra-trusted-public-keys = llama-cpp.cachix.org-1:H75X+w83wUKTIPSO1KWy9ADUrzThyGs8P5tmAbkWhQc= cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=
  35. - uses: DeterminateSystems/magic-nix-cache-action@v2
  36. with:
  37. upstream-cache: https://${{ matrix.cachixName }}.cachix.org
  38. - name: List all flake outputs
  39. run: nix flake show --all-systems
  40. - name: Show all output paths
  41. run: >
  42. nix run github:nix-community/nix-eval-jobs
  43. -- --gc-roots-dir gcroot
  44. --flake
  45. ".#packages.$(nix eval --raw --impure --expr builtins.currentSystem)"
  46. nix-build:
  47. strategy:
  48. fail-fast: false
  49. matrix:
  50. os: [ ubuntu-latest, macos-latest ]
  51. runs-on: ${{ matrix.os }}
  52. steps:
  53. - name: Checkout repository
  54. uses: actions/checkout@v4
  55. - name: Install Nix
  56. uses: DeterminateSystems/nix-installer-action@v9
  57. with:
  58. github-token: ${{ secrets.GITHUB_TOKEN }}
  59. extra-conf: |
  60. extra-substituters = https://llama-cpp.cachix.org https://cuda-maintainers.cachix.org
  61. extra-trusted-public-keys = llama-cpp.cachix.org-1:H75X+w83wUKTIPSO1KWy9ADUrzThyGs8P5tmAbkWhQc= cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=
  62. - uses: DeterminateSystems/magic-nix-cache-action@v2
  63. with:
  64. upstream-cache: https://${{ matrix.cachixName }}.cachix.org
  65. - name: Set-up cachix to push the results to
  66. uses: cachix/cachix-action@v13
  67. with:
  68. authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
  69. name: llama-cpp
  70. - name: Build
  71. run: >
  72. nix run github:Mic92/nix-fast-build
  73. -- --skip-cached --no-nom
  74. --flake
  75. ".#checks.$(nix eval --raw --impure --expr builtins.currentSystem)"