mirror of
https://github.com/haskell-nix/hnix-store.git
synced 2025-01-05 19:00:24 +03:00
CI: Cabal: upd (#113)
- update the Cabal repo before build - chache the results - the hack for GitHub expressions was invented - name the steps - add SDist check - Cabal build checks now required Added the info to the: https://markkarpov.com/post/github-actions-for-haskell-ci.html I'd maybe wished to switch to `haskell-ci`, but currently it lacks caching for example, idk if it has any monorepo support.
This commit is contained in:
parent
012713dae9
commit
851bb2e390
75
.github/workflows/Cabal-Linux.yml
vendored
75
.github/workflows/Cabal-Linux.yml
vendored
@ -8,13 +8,14 @@ on:
|
||||
schedule:
|
||||
- cron: "45 02 * * *"
|
||||
|
||||
env:
|
||||
cabalConfig: --enable-tests --disable-optimization --enable-deterministic
|
||||
|
||||
jobs:
|
||||
|
||||
build10:
|
||||
name: "GHC"
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
strategy:
|
||||
matrix:
|
||||
packageRoot: [ hnix-store-core, hnix-store-remote ]
|
||||
@ -23,30 +24,56 @@ jobs:
|
||||
run:
|
||||
working-directory: "./${{ matrix.packageRoot }}"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: "Cache of ~/.cabal/packages, ~/.cabal/store and dist-newstyle"
|
||||
|
||||
- name: "Git checkout"
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: "Haskell env setup"
|
||||
id: HaskEnvSetup
|
||||
uses: haskell/actions/setup@v1
|
||||
with:
|
||||
ghc-version: ${{ matrix.ghc }}
|
||||
|
||||
- name: "Repository update"
|
||||
run: cabal v2-update
|
||||
|
||||
- name: "Install additional system packages"
|
||||
run: sudo apt install libsodium-dev && cabal v2-install tasty-discover
|
||||
|
||||
# Still required for Remote
|
||||
- name: "Install Nix"
|
||||
uses: cachix/install-nix-action@v12
|
||||
if: matrix.packageRoot == 'hnix-store-remote'
|
||||
|
||||
# Remote: Enabling testsuite, because it requires networking in the default Nix environment.
|
||||
- name: "Project-specific Cabal configuration"
|
||||
if: matrix.packageRoot == 'hnix-store-remote'
|
||||
run: echo "cabalConfig=$cabalConfig -f io-testsuite" >> $GITHUB_ENV
|
||||
|
||||
# NOTE: Freeze is for the caching
|
||||
- name: "Configuration freeze"
|
||||
run: cabal v2-freeze $cabalConfig
|
||||
|
||||
- name: "Copy freeze file to the root dir"
|
||||
run: cp -a cabal.project.freeze ../cabal.project.freeze
|
||||
|
||||
- name: "Configuring GitHub cache"
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cabal/packages
|
||||
~/.cabal/store
|
||||
${{ steps.HaskEnvSetup.outputs.cabal-store }}
|
||||
dist-newstyle
|
||||
key: "${{ runner.os }}-Cabal-${{ matrix.ghc }}"
|
||||
- uses: haskell/actions/setup@v1
|
||||
with:
|
||||
ghc-version: ${{ matrix.ghc }}
|
||||
- name: "Install additional system packages"
|
||||
run: sudo apt install libsodium-dev
|
||||
- run: cabal v2-install tasty-discover
|
||||
- name: "Install Nix"
|
||||
# Still required for Store-remote test suite run
|
||||
uses: cachix/install-nix-action@v12
|
||||
if: matrix.packageRoot == 'hnix-store-remote'
|
||||
- run: cabal v2-configure --disable-optimization --enable-tests --enable-deterministic
|
||||
if: matrix.packageRoot == 'hnix-store-core'
|
||||
- run: |
|
||||
cabal v2-configure --disable-optimization --enable-tests --enable-deterministic \
|
||||
-f io-testsuite # Enable the Store-remote test suite
|
||||
if: matrix.packageRoot == 'hnix-store-remote'
|
||||
- run: cabal v2-build
|
||||
- run: cabal v2-test
|
||||
key: ${{ matrix.packageRoot }}-${{ runner.os }}-Cabal-${{ matrix.ghc }}-${{ hashFiles( 'cabal.project.freeze' ) }}
|
||||
restore-keys: ${{ matrix.packageRoot }}-${{ runner.os }}-Cabal-${{ matrix.ghc }}-
|
||||
|
||||
- name: "Build"
|
||||
run: cabal v2-build $cabalConfig
|
||||
|
||||
- name: "Tests"
|
||||
run: cabal v2-test $cabalConfig
|
||||
|
||||
- name: "Source distribution file"
|
||||
if: ${{ matrix.ghc == '8.10' }}
|
||||
run: cabal v2-sdist
|
||||
|
69
.github/workflows/On-Release-Cabal-Linux.yml
vendored
69
.github/workflows/On-Release-Cabal-Linux.yml
vendored
@ -5,6 +5,9 @@ on:
|
||||
# created: a draft is saved, or a release or pre-release is published without previously being saved as a draft
|
||||
types: [ created ]
|
||||
|
||||
env:
|
||||
cabalConfig: --enable-tests --disable-optimization --enable-deterministic
|
||||
|
||||
jobs:
|
||||
|
||||
build10:
|
||||
@ -20,32 +23,52 @@ jobs:
|
||||
run:
|
||||
working-directory: "./${{ matrix.packageRoot }}"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: "Git checkout"
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Cache of ~/.cabal/packages, ~/.cabal/store and dist-newstyle
|
||||
|
||||
- name: "Haskell env setup"
|
||||
id: HaskEnvSetup
|
||||
uses: haskell/actions/setup@v1
|
||||
with:
|
||||
ghc-version: ${{ matrix.ghc }}
|
||||
|
||||
- name: "Repository update"
|
||||
run: cabal v2-update
|
||||
|
||||
- name: "Install additional system packages"
|
||||
run: sudo apt install libsodium-dev && cabal v2-install tasty-discover
|
||||
|
||||
# Still required for Remote
|
||||
- name: "Install Nix"
|
||||
uses: cachix/install-nix-action@v12
|
||||
if: matrix.packageRoot == 'hnix-store-remote'
|
||||
|
||||
# Remote: Enabling testsuite, because it requires networking in the default Nix environment.
|
||||
- name: "Project-specific Cabal configuration"
|
||||
if: matrix.packageRoot == 'hnix-store-remote'
|
||||
run: echo "cabalConfig=$cabalConfig -f io-testsuite" >> $GITHUB_ENV
|
||||
|
||||
# NOTE: Freeze is for the caching
|
||||
- name: "Configuration freeze"
|
||||
run: cabal v2-freeze $cabalConfig
|
||||
|
||||
- name: "Copy freeze file to the root dir"
|
||||
run: cp -a cabal.project.freeze ../cabal.project.freeze
|
||||
|
||||
- name: "Configuring GitHub cache"
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cabal/packages
|
||||
~/.cabal/store
|
||||
${{ steps.HaskEnvSetup.outputs.cabal-store }}
|
||||
dist-newstyle
|
||||
key: ${{ runner.os }}-Cabal-${{ matrix.ghc }}
|
||||
- uses: haskell/actions/setup@v1
|
||||
with:
|
||||
ghc-version: ${{ matrix.ghc }}
|
||||
- name: "Install additional system packages"
|
||||
run: sudo apt install libsodium-dev
|
||||
- run: cabal v2-install tasty-discover
|
||||
- name: "Install Nix"
|
||||
# Still required for Store-remote test suite run
|
||||
uses: cachix/install-nix-action@v12
|
||||
if: matrix.packageRoot == 'hnix-store-remote'
|
||||
- run: cabal v2-configure --disable-optimization --enable-tests --enable-deterministic
|
||||
if: matrix.packageRoot == 'hnix-store-core'
|
||||
- run: |
|
||||
cabal v2-configure --disable-optimization --enable-tests --enable-deterministic \
|
||||
-f io-testsuite # Enable the Store-remote test suite
|
||||
if: matrix.packageRoot == 'hnix-store-remote'
|
||||
- run: cabal v2-build
|
||||
- run: cabal v2-test
|
||||
key: ${{ matrix.packageRoot }}-${{ runner.os }}-Cabal-${{ matrix.ghc }}-${{ hashFiles( 'cabal.project.freeze' ) }}
|
||||
restore-keys: ${{ matrix.packageRoot }}-${{ runner.os }}-Cabal-${{ matrix.ghc }}-
|
||||
|
||||
- name: "Build"
|
||||
run: cabal v2-build $cabalConfig
|
||||
|
||||
- name: "Tests"
|
||||
run: cabal v2-test $cabalConfig
|
||||
|
Loading…
Reference in New Issue
Block a user