-
Notifications
You must be signed in to change notification settings - Fork 25
129 lines (112 loc) · 3.81 KB
/
ci.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: aeson-pretty-ci
on:
push:
branches:
- master
pull_request:
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
ghcs:
name: GHC ${{ matrix.ghc }} / Aeson latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-22.04"]
ghc: ["9.6.2", "9.4.3", "9.2.8", "9.0.2", "8.10.7", "8.8.4", "8.6.5", "8.4.4", "8.2.2"]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Haskell
uses: haskell/actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
- name: Setup CI
run: |
sed -i 's/-Wall/-Wall -Werror/g' aeson-pretty.cabal
cabal v2-freeze
mv cabal.project.freeze frozen
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ hashFiles('frozen') }}
restore-keys: |
${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ hashFiles('frozen') }}
${{ runner.os }}-ghc-${{ matrix.ghc }}-
- name: Build
run: |
cabal v2-update
cabal v2-build all --enable-tests
aesons:
name: GHC ${{ matrix.ghc }} / Aeson ${{ matrix.aeson }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-22.04"]
ghc: ["8.2.2"]
aeson: ["1.1", "1.2", "1.3", "1.4", "1.5", "2.0", "2.1", "2.2"]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Haskell
uses: haskell/actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
- name: Setup CI
run: |
sed -i 's/-Wall/-Wall -Werror/g' aeson-pretty.cabal
cabal v2-freeze --constraint="aeson ^>= ${{ matrix.aeson }}"
mv cabal.project.freeze frozen
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-aeson-${{ matrix.aeson }}-${{ hashFiles('frozen') }}
restore-keys: |
${{ runner.os }}-aeson-${{ matrix.aeson }}-${{ hashFiles('frozen') }}
${{ runner.os }}-aeson-${{ matrix.aeson }}-
- name: Build
run: |
cabal v2-update
cabal v2-build all --enable-tests --constraint="aeson ^>= ${{ matrix.aeson }}"
# Mandatory check on GitHub
all:
name: All jobs finished
if: always()
needs: [
aesons,
ghcs
]
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Check dependencies for failures
run: |
# Test all dependencies for success/failure
set -x
success="${{ contains(needs.*.result, 'success') }}"
fail="${{ contains(needs.*.result, 'failure') }}"
set +x
# Test whether success/fail variables contain sane values
if [[ "${success}" != "true" && "${success}" != "false" ]]; then exit 1; fi
if [[ "${fail}" != "true" && "${fail}" != "false" ]]; then exit 1; fi
# We want to fail if one or more dependencies fail. For safety, we introduce
# a second check: if no dependencies succeeded something weird is going on.
if [[ "${fail}" == "true" || "${success}" == "false" ]]; then
echo "One or more dependency failed, or no dependency succeeded."
exit 1
fi
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install python3-yaml
- name: Check that the 'all' job depends on all other jobs
run: |
.github/scripts/all_check.py