Add nix develop based CI workflow #29
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| TERM: dumb | |
| concurrency: | |
| group: build-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - { ghc-version: ghc910, cache-key: v0 } | |
| - { ghc-version: ghc984, cache-key: v0 } | |
| - { ghc-version: ghc966, cache-key: v0 } | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install nix | |
| uses: DeterminateSystems/nix-installer-action@main | |
| with: | |
| extra-conf: | | |
| accept-flake-config = true | |
| download-buffer-size = 512000000 | |
| - name: Cache nix | |
| uses: cachix/cachix-action@v14 | |
| with: | |
| name: gogol | |
| authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
| # There isn't any apparent sensible way to cache stack, so this more or less | |
| # follows the imperfect ideas in https://github.com/commercialhaskell/stack/issues/5754 | |
| - name: Cache ~/.stack | |
| uses: actions/cache@v4 | |
| with: | |
| key: stack-${{ runner.os }}-${{ matrix.ghc-version }}-${{ matrix.cache-key }}-${{ hashFiles('stack-${{ matrix.ghc-version }}.yaml', '**/*.cabal') }} | |
| restore-keys: | | |
| stack-${{ runner.os }}-${{ matrix.ghc-version }}-${{ matrix.cache-key }}- | |
| path: | | |
| ~/.stack | |
| - name: Cache .stack-work | |
| uses: actions/cache@v4 | |
| with: | |
| key: stack-work-${{ runner.os }}-${{ matrix.ghc-version }}-${{ matrix.cache }}-${{ hashFiles('stack-${{ matrix.ghc-version }}.yaml', '**/*.cabal') }}-${{ hashFiles('lib/**/*.hs') }} | |
| restore-keys: | | |
| stack-work-${{ runner.os }}-${{ matrix.ghc-version }}-${{ matrix.cache-key }}-${{ hashFiles('stack-${{ matrix.ghc-version }}.yaml', '**/*.cabal') }}- | |
| stack-work-${{ runner.os }}-${{ matrix.ghc-version }}-${{ matrix.cache-key }}- | |
| path: | | |
| .stack-work | |
| **/.stack-work | |
| - name: Free disk space | |
| run: | | |
| sudo rm -rf /opt/hostedtoolcache /opt/ghc /usr/share/dotnet /usr/local/lib/android | |
| sudo df --human-readable | |
| sudo free --human | |
| sudo swapon --show | |
| - name: Build dependencies | |
| run: | | |
| nix develop .#${{ matrix.ghc-version }} --print-build-logs --command stack build --only-dependencies | |
| - name: Build libraries | |
| run: | | |
| nix develop .#${{ matrix.ghc-version }} --print-build-logs --command stack build gogol gogol-core | |
| - name: Build generator | |
| if: matrix.ghc-version == 'ghc910' | |
| run: | | |
| nix develop .#${{ matrix.ghc-version }} --print-build-logs --command stack build ./gen | |
| - name: Build services | |
| run: | | |
| nix develop .#${{ matrix.ghc-version }} --print-build-logs --command stack build ./lib/services |