|
| 1 | +--- |
| 2 | +name: "Nix Build" |
| 3 | +"on": [push, pull_request] |
| 4 | +jobs: |
| 5 | + build: |
| 6 | + strategy: |
| 7 | + matrix: |
| 8 | + os: |
| 9 | + - ubuntu-latest |
| 10 | + - macos-latest |
| 11 | + nixpkgs: |
| 12 | + - pinned |
| 13 | + - release-21.11 |
| 14 | + - release-21.05 |
| 15 | + - nixpkgs-unstable |
| 16 | + fail-fast: false |
| 17 | + runs-on: ${{ matrix.os }} |
| 18 | + steps: |
| 19 | + |
| 20 | + |
| 21 | + - name: Install nix |
| 22 | + uses: cachix/install-nix-action@v16 |
| 23 | + with: |
| 24 | + extra_nix_config: | |
| 25 | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} |
| 26 | +
|
| 27 | + - name: Link to bifrost binary cache on cachix.org |
| 28 | + uses: cachix/cachix-action@v10 |
| 29 | + with: |
| 30 | + name: bifrost |
| 31 | + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' |
| 32 | + |
| 33 | + - name: Lock the version of nixpkgs specified by the matrix |
| 34 | + run: | |
| 35 | + if "${{ matrix.nixpkgs }}" != "pinned"; then |
| 36 | + nix flake lock --override-input nixpkgs \ |
| 37 | + "nixpkgs/${{ matrix.nixpkgs }}" |
| 38 | + fi |
| 39 | + nix flake metadata |
| 40 | +
|
| 41 | + - name: Check for well-formed flake |
| 42 | + run: | |
| 43 | + nix flake check |
| 44 | +
|
| 45 | + - name: Build for default python3 |
| 46 | + run: | |
| 47 | + nix build --print-build-logs .#bifrost-py3 |
| 48 | +
|
| 49 | + - name: Build with enable-debug for python3, if pinned nixpkgs |
| 50 | + if: matrix.nixpkgs == 'pinned' |
| 51 | + run: | |
| 52 | + nix build --print-build-logs .#bifrost-py3-debug |
| 53 | +
|
| 54 | + - name: Build for python38, unless nixpkgs-unstable |
| 55 | + # For unstable, 3.8 packages are no longer in the build cache |
| 56 | + if: matrix.nixpkgs != 'nixpkgs-unstable' |
| 57 | + run: | |
| 58 | + nix build --print-build-logs .#bifrost-py38 |
| 59 | +
|
| 60 | + - name: Run Python test suite |
| 61 | + # Skipped during nix build because it needs network data. |
| 62 | + run: | |
| 63 | + cd test |
| 64 | + bash download_test_data.sh |
| 65 | + nix run ..#python3-bifrost -- -m bifrost.telemetry --disable |
| 66 | + nix run ..#python3-bifrost -- -m unittest discover |
| 67 | +
|
| 68 | + - name: Build documentation |
| 69 | + run: | |
| 70 | + nix build --print-build-logs --out-link result-doc .#bifrost-doc |
| 71 | +
|
| 72 | + - name: Deploy documentation to gh-pages |
| 73 | + |
| 74 | + # Maybe only deploy if changes in doc/ folder? (But some doc |
| 75 | + # pages generated from code, so should reflect code changes?) |
| 76 | + if: | |
| 77 | + matrix.os == 'ubuntu-latest' |
| 78 | + && matrix.nixpkgs == 'pinned' |
| 79 | + && github.event_name == 'push' |
| 80 | + && github.ref == 'refs/heads/master' |
| 81 | + with: |
| 82 | + branch: gh-pages |
| 83 | + folder: result-doc/share/doc/bifrost/html |
0 commit comments