|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +env: |
| 10 | + CACHE_VERSION: v0 |
| 11 | + TERM: dumb |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: build-${{ github.ref }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + ghc-version: ['ghc910', 'ghc984', 'ghc966'] |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Checkout |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Install nix |
| 29 | + uses: DeterminateSystems/nix-installer-action@main |
| 30 | + with: |
| 31 | + extra-conf: | |
| 32 | + accept-flake-config = true |
| 33 | + download-buffer-size = 512000000 |
| 34 | +
|
| 35 | + - name: Cache nix |
| 36 | + uses: cachix/cachix-action@v14 |
| 37 | + with: |
| 38 | + name: gogol |
| 39 | + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' |
| 40 | + |
| 41 | + # There isn't any apparent sensible way to cache stack, so this more or less |
| 42 | + # follows the imperfect ideas in https://github.com/commercialhaskell/stack/issues/5754 |
| 43 | + |
| 44 | + - name: Cache ~/.stack |
| 45 | + uses: actions/cache@v4 |
| 46 | + with: |
| 47 | + key: stack-${{ runner.os }}-${{ matrix.ghc-version }}-${{ env.CACHE_VERSION }}-${{ hashFiles('stack-${{ matrix.ghc-version }}.yaml', '**/*.cabal') }} |
| 48 | + restore-keys: | |
| 49 | + stack-${{ runner.os }}-${{ matrix.ghc-version }}-${{ env.CACHE_VERSION }}- |
| 50 | + path: | |
| 51 | + ~/.stack |
| 52 | +
|
| 53 | + - name: Cache .stack-work |
| 54 | + uses: actions/cache@v4 |
| 55 | + with: |
| 56 | + key: stack-work-${{ runner.os }}-${{ matrix.ghc-version }}-${{ env.CACHE_VERSION }}-${{ hashFiles('stack-${{ matrix.ghc-version }}.yaml', '**/*.cabal') }}-${{ hashFiles('lib/**/*.hs') }} |
| 57 | + restore-keys: | |
| 58 | + stack-work-${{ runner.os }}-${{ matrix.ghc-version }}-${{ env.CACHE_VERSION }}-${{ hashFiles('stack-${{ matrix.ghc-version }}.yaml', '**/*.cabal') }}- |
| 59 | + stack-work-${{ runner.os }}-${{ matrix.ghc-version }}-${{ env.CACHE_VERSION }}- |
| 60 | + path: | |
| 61 | + .stack-work |
| 62 | + **/.stack-work |
| 63 | +
|
| 64 | + - name: Free disk space |
| 65 | + run: | |
| 66 | + sudo rm -rf /opt/hostedtoolcache /opt/ghc /usr/share/dotnet /usr/local/lib/android |
| 67 | + sudo df --human-readable |
| 68 | + sudo free --human |
| 69 | + sudo swapon --show |
| 70 | +
|
| 71 | + - name: Build dependencies |
| 72 | + run: | |
| 73 | + nix develop .#${{ matrix.ghc-version }} --print-build-logs --command stack build --only-dependencies |
| 74 | +
|
| 75 | + - name: Build libraries |
| 76 | + run: | |
| 77 | + nix develop .#${{ matrix.ghc-version }} --print-build-logs --command stack build gogol gogol-core |
| 78 | +
|
| 79 | + - name: Build generator |
| 80 | + if: matrix.ghc-version == 'ghc910' |
| 81 | + run: | |
| 82 | + nix develop .#${{ matrix.ghc-version }} --print-build-logs --command stack build ./gen |
| 83 | +
|
| 84 | + - name: Build services |
| 85 | + run: | |
| 86 | + nix develop .#${{ matrix.ghc-version }} --print-build-logs --command stack build ./lib/services |
0 commit comments