-
Notifications
You must be signed in to change notification settings - Fork 21
118 lines (118 loc) · 4.28 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
jobs:
build:
name: GHC ${{ matrix.ghc }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: mkdir artifact
- id: haskell
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
- run: ghc-pkg list
- run: cabal sdist --output-dir artifact
- run: cabal configure --enable-optimization=2 --enable-tests --flags=pedantic --jobs
- run: cat cabal.project.local
- run: cp cabal.project.local artifact
- run: cabal freeze
- run: cat cabal.project.freeze
- run: cp cabal.project.freeze artifact
- run: cabal outdated --v2-freeze-file
- uses: actions/cache@v4
with:
key: ${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
path: ${{ steps.haskell.outputs.cabal-store }}
restore-keys: ${{ matrix.os }}-${{ matrix.ghc }}-
- run: cabal build --only-download
- run: cabal build --only-dependencies
- run: cabal build
- run: cp $( cabal list-bin rattletrap ) artifact
- run: cabal run -- rattletrap --schema --output=artifact/schema.json
- run: tar --create --file artifact.tar --verbose artifact
- uses: actions/upload-artifact@v4
with:
name: rattletrap-${{ github.sha }}-ghc-${{ matrix.ghc }}-${{ matrix.os }}
path: artifact.tar
- run: cabal run -- rattletrap-test-suite
- run: npm install ajv-cli
- run: runghc src/util/check-schema.hs
strategy:
matrix:
include:
- ghc: '9.10'
os: macos-13
- ghc: '9.10'
os: macos-14
- ghc: 9.6
os: ubuntu-22.04
- ghc: 9.8
os: ubuntu-22.04
- ghc: '9.10'
os: ubuntu-22.04
- ghc: '9.10'
os: windows-2022
cabal:
name: Cabal
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cabal check
gild:
name: Gild
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: tfausak/cabal-gild-setup-action@v2
- run: cabal-gild --input rattletrap.cabal --mode check
hlint:
name: HLint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/hlint-setup@v2
- uses: haskell-actions/hlint-run@v2
with:
fail-on: status
ormolu:
name: Ormolu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/run-ormolu@v16
release:
env:
PREFIX: rattletrap-${{ github.event.release.tag_name }}
if: ${{ github.event_name == 'release' }}
name: Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
- run: sh -exc 'for d in *; do cd $d; tar --extract --file artifact.tar --verbose; cd ..; done'
- run: cp rattletrap-${{ github.sha }}-ghc-9.10-ubuntu-22.04/artifact/${{ env.PREFIX }}.tar.gz .
- run: cp rattletrap-${{ github.sha }}-ghc-9.10-ubuntu-22.04/artifact/schema.json ${{ env.PREFIX }}-schema.json
- run: tar --auto-compress --create --file ../../${{ env.PREFIX }}-darwin-x64.tar.gz --verbose rattletrap
working-directory: rattletrap-${{ github.sha }}-ghc-9.10-macos-13/artifact
- run: tar --auto-compress --create --file ../../${{ env.PREFIX }}-darwin-arm64.tar.gz --verbose rattletrap
working-directory: rattletrap-${{ github.sha }}-ghc-9.10-macos-14/artifact
- run: tar --auto-compress --create --file ../../${{ env.PREFIX }}-linux-x64.tar.gz --verbose rattletrap
working-directory: rattletrap-${{ github.sha }}-ghc-9.10-ubuntu-22.04/artifact
- run: tar --auto-compress --create --file ../../${{ env.PREFIX }}-win32-x64.tar.gz --verbose rattletrap.exe
working-directory: rattletrap-${{ github.sha }}-ghc-9.10-windows-2022/artifact
- uses: softprops/action-gh-release@v2
with:
files: |
${{ env.PREFIX }}*.tar.gz
${{ env.PREFIX }}-schema.json
- run: cabal upload --publish --username '${{ secrets.HACKAGE_USERNAME }}' --password '${{ secrets.HACKAGE_PASSWORD }}' ${{ env.PREFIX }}.tar.gz
name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
release:
types:
- created