-
Notifications
You must be signed in to change notification settings - Fork 48
106 lines (89 loc) · 3.71 KB
/
devx.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: DevX/Haskell
on:
push:
branches: [ "master" ]
pull_request:
workflow_dispatch:
defaults:
run:
shell: devx {0}
jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [ x86_64-linux, x86_64-darwin ]
compiler-nix-name: [ ghc810, ghc96 ]
target-platform: [ "", "-windows" ]
exclude:
- platform: x86_64-darwin
target-platform: "-windows"
runs-on: ${{ matrix.platform == 'x86_64-linux' && 'ubuntu-latest' || 'macos-latest' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install GHC and Cabal
uses: input-output-hk/actions/devx@latest
with:
platform: ${{ matrix.platform }}
target-platform: ${{ matrix.target-platform }}
compiler-nix-name: ${{ matrix.compiler-nix-name }}
# for now we'll set minimal to false, as minimal-iog images don't exist.
minimal: false
iog: true
- name: Set cache version
run: echo "CACHE_VERSION=devxcache0" >> $GITHUB_ENV
- name: Cabal update
run: $HOME/bin/cabalcabal update
- name: "Setup cabal-store"
id: cabal-store
shell: bash
run: |
cabal_config_file="$($HOME/bin/cabal help user-config | tail -n 1 | xargs)"
echo "cabal-store=$(dirname "$cabal_config_file")/store" | tee -a "$GITHUB_OUTPUT"
- name: "Check cabal-store"
shell: bash
run: echo '${{ steps.cabal-store.outputs.cabal-store }}'
- name: Configure build
shell: bash
run: |
if [ "${{github.event.inputs.tests}}" == "all" ]; then
echo "Reconfigure cabal projects to run tests for all dependencies"
sed -i 's|tests: False|tests: True|g' cabal.project
fi
cp ".github/workflows/cabal.project.local.ci.$(uname -s)" cabal.project.local
echo "# cabal.project.local"
cat cabal.project.local
- name: Record dependencies
id: record-deps
run: |
$HOME/bin/cabal build all --dry-run
cat dist-newstyle/cache/plan.json | jq -r '."install-plan"[].id' | sort | uniq > dependencies.txt
- name: "OUTPUT Record weeknum"
shell: bash
run: echo "weeknum=$(/usr/bin/date -u "+%W")" >> $GITHUB_OUTPUT
- name: Cache Cabal store
uses: actions/cache@v2
with:
path: ${{ steps.cabal-store.outputs.cabal-store }}
key: cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.compiler-nix-name }}${{matrix.target-platform}}-${{ hashFiles('dependencies.txt') }}
restore-keys: |
cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.compiler-nix-name }}${{matrix.target-platform}}-${{ hashFiles('dependencies.txt') }}
cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.compiler-nix-name }}${{matrix.target-platform}}
- uses: actions/cache@v2
name: "Cache `dist-newstyle`"
with:
path: |
dist-newstyle
!dist-newstyle/**/.git
key: cache-dist-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.compiler-nix-name }}${{matrix.target-platform}}-${{ steps.record-deps.outputs.weeknum }}
restore-keys: cache-dist-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.compiler-nix-name }}${{matrix.target-platform}}
- name: Install dependencies
run: $HOME/bin/cabal build all --only-dependencies
- name: Build
run: $HOME/bin/cabal build all
- name: Run unit tests
shell: bash
run: |
$HOME/bin/cabal test cardano-addresses --test-show-details=direct
$HOME/bin/cabal test cardano-addresses-cli --test-show-details=direct