-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: "CI" | ||
|
||
# Limit concurrent runs of this workflow within a single PR | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- release | ||
pull_request: | ||
|
||
env: | ||
LD_LIBRARY_PATH: ${{ github.workspace }}/srv/lib | ||
PKG_CONFIG_PATH: ${{ github.workspace }}/srv/lib/pkgconfig | ||
|
||
jobs: | ||
build: | ||
name: "Build" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: setup dev environment | ||
uses: ./.github/workflows/actions/setup_dev_ubuntu | ||
with: | ||
clean_caches: true | ||
version_ghc: 9.2.8 | ||
|
||
- name: cabal build | ||
run: | | ||
cabal build all | ||
test: | ||
name: "Test" | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- package: cardano-lab | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: setup dev environment | ||
uses: ./.github/workflows/actions/setup_dev_ubuntu | ||
with: | ||
version_ghc: 9.2.8 | ||
|
||
- name: ❓ Test | ||
if: ${{ matrix.package != 'cardano-lab' }} | ||
run: | | ||
cabal test ${{ matrix.package }} | ||
haddock: | ||
name: "Haddock" | ||
needs: [build] | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: setup dev environment | ||
uses: ./.github/workflows/actions/setup_dev_ubuntu | ||
with: | ||
version_ghc: 9.2.8 | ||
|
||
- name: 📚 Documentation (Haddock) | ||
run: | | ||
.github/workflows/ci-haddock.sh | ||
- name: 💾 Upload build & test artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: haddocks | ||
path: ./docs/static/haddock | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: 'Setup dev environment' | ||
description: 'Setup a dev environment for gh-action Ubuntu' | ||
inputs: | ||
version_ghc: | ||
description: 'GHC version needed' | ||
required: false | ||
default: 9.2.8 | ||
version_cabal: | ||
description: 'Cabal version needed' | ||
required: false | ||
default: 3.10.1.0 | ||
clean_caches: | ||
description: 'Should we clean old caches for this branch and keep only the last one?' | ||
require: false | ||
default: false | ||
runs: | ||
using: "composite" | ||
steps: | ||
|
||
- name: "Clear old caches" | ||
if: ${{ inputs.clean_caches == 'true' }} | ||
shell: bash | ||
run: | | ||
.github/workflows/actions/setup_dev_ubuntu/clear_caches | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
|
||
- name: Cache environment setup | ||
id: cache_env | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
/usr/local/.ghcup/ghc/${{ inputs.version_ghc }} | ||
/usr/local/.ghcup/bin/cabal-${{ inputs.version_cabal }} | ||
/usr/local/.ghcup/bin/cabal | ||
/usr/local/.ghcup/bin/ghc | ||
${{ github.workspace }}/srv/ | ||
key: env-${{ runner.os }}-${{ hashFiles('.github/workflows/actions/setup_dev_ubuntu/install_libraries') }} | ||
|
||
- name: Cache cabal storage | ||
id: cache_cabal | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/cabal/packages | ||
~/.local/state/cabal | ||
key: cabal-${{ runner.os }}-${{ hashFiles('**/*.cabal', '**/cabal.project', '**/cabal.project.freeze') }} | ||
restore-keys: cabal-${{ runner.os }}- | ||
|
||
- name: Cache cabal compilation directory | ||
id: cache_dist | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
dist-newstyle | ||
key: dist-${{ runner.os }}-${{ github.run_id }} | ||
restore-keys: dist-${{ runner.os }}- | ||
|
||
- name: "Install packages" | ||
shell: bash | ||
run: | | ||
.github/workflows/actions/setup_dev_ubuntu/install_packages | ||
env: | ||
VERSION_GHC: ${{ inputs.version_ghc }} | ||
|
||
- name: "Setup build environment" | ||
if: ${{ steps.cache_env.outputs.cache-hit != 'true' }} | ||
shell: bash | ||
run: | | ||
.github/workflows/actions/setup_dev_ubuntu/install_libraries | ||
- name: "Setup Environment" | ||
shell: bash | ||
run: | | ||
echo "$(realpath $PWD/srv)/bin" >> $GITHUB_PATH | ||
- name: cabal update | ||
if: ${{ steps.cache_cabal.outputs.cache-hit != 'true' }} | ||
shell: bash | ||
run: | | ||
cabal update |