|
| 1 | +name: "Hackage, Cabal, Linux" |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + schedule: |
| 9 | + - cron: "45 02 * * *" |
| 10 | + |
| 11 | +env: |
| 12 | + cabalConfig: --enable-tests --disable-optimization --enable-deterministic |
| 13 | + |
| 14 | +jobs: |
| 15 | + |
| 16 | + build10: |
| 17 | + name: "GHC" |
| 18 | + runs-on: ubuntu-latest |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + # Separation between Core & Store workflows made deliberately, so when one fixes Core, CI does not falls because of the Hackage Core Remote builds with. |
| 22 | + # Also singleton also use is deliberate, it allows to reference the value in the further configuration & also leaves a name in the CI & preserves matrix flexibility for the future. |
| 23 | + packageRoot: [ hnix-store-core ] |
| 24 | + ghc: [ "8.10", "8.4" ] |
| 25 | + defaults: |
| 26 | + run: |
| 27 | + working-directory: "./${{ matrix.packageRoot }}" |
| 28 | + steps: |
| 29 | + |
| 30 | + - name: "Git checkout" |
| 31 | + uses: actions/checkout@v2 |
| 32 | + with: |
| 33 | + submodules: recursive |
| 34 | + |
| 35 | + - name: "Haskell env setup" |
| 36 | + id: HaskEnvSetup |
| 37 | + uses: haskell/actions/setup@v1 |
| 38 | + with: |
| 39 | + ghc-version: ${{ matrix.ghc }} |
| 40 | + |
| 41 | + - name: "Repository update" |
| 42 | + run: cabal v2-update |
| 43 | + |
| 44 | + - name: "Install additional system packages" |
| 45 | + run: sudo apt install libsodium-dev |
| 46 | + |
| 47 | + # NOTE: Freeze is for the caching |
| 48 | + - name: "Configuration freeze" |
| 49 | + run: cabal v2-freeze $cabalConfig |
| 50 | + |
| 51 | + - name: "Hack: Copy freeze file to the root dir" |
| 52 | + run: cp -a cabal.project.freeze ../cabal.project.freeze |
| 53 | + |
| 54 | + - name: "Configuring GitHub cache" |
| 55 | + uses: actions/cache@v2 |
| 56 | + with: |
| 57 | + path: | |
| 58 | + ${{ steps.HaskEnvSetup.outputs.cabal-store }} |
| 59 | + dist-newstyle |
| 60 | + key: ${{ matrix.packageRoot }}-${{ runner.os }}-Cabal-${{ matrix.ghc }}-${{ hashFiles( 'cabal.project.freeze' ) }} |
| 61 | + restore-keys: ${{ matrix.packageRoot }}-${{ runner.os }}-Cabal-${{ matrix.ghc }}- |
| 62 | + |
| 63 | + - name: "Build" |
| 64 | + run: cabal v2-build $cabalConfig |
| 65 | + |
| 66 | + - name: "Tests" |
| 67 | + run: cabal v2-test $cabalConfig |
| 68 | + |
| 69 | + - name: "Source distribution file" |
| 70 | + if: ${{ matrix.ghc == '8.10' }} |
| 71 | + run: cabal v2-sdist |
0 commit comments