|
| 1 | +name: "Hackage, Cabal, macOS" |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + schedule: |
| 9 | + - cron: "45 03 * * *" |
| 10 | + |
| 11 | +env: |
| 12 | + cabalConfig: --enable-tests --disable-optimization --enable-deterministic |
| 13 | + |
| 14 | +jobs: |
| 15 | + |
| 16 | + # 2021-03-12: NOTE: Please, enable uncommented working code when `remote` builds on macOS. |
| 17 | + build10: |
| 18 | + name: "GHC" |
| 19 | + runs-on: macos-latest |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + packageRoot: [ hnix-store-core ] |
| 23 | + # packageRoot: [ hnix-store-core, hnix-store-remote ] |
| 24 | + defaults: |
| 25 | + run: |
| 26 | + working-directory: "./${{ matrix.packageRoot }}" |
| 27 | + steps: |
| 28 | + |
| 29 | + - name: "Git checkout" |
| 30 | + uses: actions/checkout@v2 |
| 31 | + with: |
| 32 | + submodules: recursive |
| 33 | + |
| 34 | + - name: "Haskell env setup" |
| 35 | + id: HaskEnvSetup |
| 36 | + uses: haskell/actions/setup@v1 |
| 37 | + with: |
| 38 | + ghc-version: '8.10' |
| 39 | + |
| 40 | + - name: "Repository update" |
| 41 | + run: cabal v2-update |
| 42 | + |
| 43 | + - name: "Install additional system packages" |
| 44 | + run: cabal v2-install tasty-discover |
| 45 | + |
| 46 | + # # Still required for Remote |
| 47 | + # - name: "Install Nix" |
| 48 | + # uses: cachix/install-nix-action@v12 |
| 49 | + # if: matrix.packageRoot == 'hnix-store-remote' |
| 50 | + |
| 51 | + # # Remote: Enabling testsuite, because it requires networking in the default Nix environment. |
| 52 | + # - name: "Project-specific Cabal configuration" |
| 53 | + # if: matrix.packageRoot == 'hnix-store-remote' |
| 54 | + # run: echo "cabalConfig=$cabalConfig -f io-testsuite" >> $GITHUB_ENV |
| 55 | + |
| 56 | + # NOTE: Freeze is for the caching |
| 57 | + - name: "Configuration freeze" |
| 58 | + run: cabal v2-freeze $cabalConfig |
| 59 | + |
| 60 | + - name: "Copy freeze file to the root dir" |
| 61 | + run: cp -a cabal.project.freeze ../cabal.project.freeze |
| 62 | + |
| 63 | + - name: "Configuring GitHub cache" |
| 64 | + uses: actions/cache@v2 |
| 65 | + with: |
| 66 | + path: | |
| 67 | + ${{ steps.HaskEnvSetup.outputs.cabal-store }} |
| 68 | + dist-newstyle |
| 69 | + key: ${{ matrix.packageRoot }}-${{ runner.os }}-Cabal-${{ hashFiles( 'cabal.project.freeze' ) }} |
| 70 | + restore-keys: ${{ matrix.packageRoot }}-${{ runner.os }}-Cabal- |
| 71 | + |
| 72 | + - name: "Build" |
| 73 | + run: cabal v2-build $cabalConfig |
| 74 | + |
| 75 | + - name: "Tests" |
| 76 | + run: cabal v2-test $cabalConfig |
0 commit comments