-
Notifications
You must be signed in to change notification settings - Fork 3
78 lines (67 loc) · 2.29 KB
/
ci.yaml
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
name: CI
on:
pull_request:
branches:
- master
push:
branches:
- master
release:
types:
- created
jobs:
ci:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} / ghc ${{ matrix.ghc }}
strategy:
matrix:
ghc: ['9.6', '9.4', '9.2']
cabal: ['latest']
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- run: mkdir artifact
- run: mkdir artifact/${{ matrix.os }}
- id: setup-haskell
uses: haskell/actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- run: cabal configure --enable-tests --flags strict --jobs
- run: cabal freeze
- run: cat cabal.project.freeze
- run: cp cabal.project.freeze artifact/${{ matrix.os }}
- uses: actions/cache@v3
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: ${{ matrix.os }}-${{ matrix.ghc }}-
- run: cabal build
- run: cabal test --enable-tests --test-show-details=direct
- run: cabal check
- run: cabal sdist --output-dir artifact/${{ matrix.os }}
- uses: actions/upload-artifact@v3
with:
name: hermes-json-${{ github.sha }}
path: artifact
release:
needs: ci
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: hermes-json-${{ github.sha }}
path: artifact
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_content_type: application/gzip
asset_name: hermes-json-${{ github.event.release.tag_name }}.tar.gz
asset_path: artifact/ubuntu-latest/hermes-json-${{ github.event.release.tag_name }}.tar.gz
upload_url: ${{ github.event.release.upload_url }}
- run: cabal upload --publish --username '${{ secrets.HACKAGE_USERNAME }}' --password '${{ secrets.HACKAGE_PASSWORD }}' artifact/ubuntu-latest/hermes-json-${{ github.event.release.tag_name }}.tar.gz