-
Notifications
You must be signed in to change notification settings - Fork 81
107 lines (106 loc) · 3.06 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
name: CI
on:
push:
branches:
- master
pull_request:
types:
- opened
- synchronize
jobs:
ci:
strategy:
fail-fast: false
matrix:
ghc: [ghc965, ghc982, ghc9101]
name: Build and test on ${{ matrix.ghc }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
accept-flake-config = true
- uses: cachix/cachix-action@v15
with:
name: tweag-ormolu
authToken: '${{ secrets.CACHIX_TWEAG_ORMOLU_AUTH_TOKEN }}'
- name: Build and run tests
run: |
nix build -L --keep-going .#${{ matrix.ghc }}.ci
lint:
needs: ci
name: Formatting and linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
accept-flake-config = true
- name: Format via Ormolu
run: |
nix run .#format
git diff --exit-code --color=always
- name: pre-commit-check
run: |
nix build -L .#pre-commit-check
live:
needs: lint
name: Build and deploy Ormolu Live
runs-on: ubuntu-latest
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
accept-flake-config = true
- uses: actions/cache@v4
with:
path: |
~/.ghc-wasm/.cabal/store
ormolu-live/dist-newstyle
key: wasm-${{ github.run_id }}
restore-keys: |
wasm-${{ github.run_id }}
wasm-
- name: Build Ormolu Live
run: |
cd ormolu-live
nix develop .#ormoluLive -c sh -c \
'npm ci && wasm32-wasi-cabal update && ./build.sh prod'
- name: Deploy to Netlify, preview
if: env.NETLIFY_AUTH_TOKEN != ''
uses: nwtgck/actions-netlify@v3
with:
publish-dir: ./ormolu-live/dist
github-token: ${{ secrets.GITHUB_TOKEN }}
alias: ${{ github.event.pull_request.head.sha || github.sha }}
enable-pull-request-comment: true
enable-commit-comment: false
enable-commit-status: true
- name: Deploy to Netlify, production
if: env.NETLIFY_AUTH_TOKEN != '' && github.ref == 'refs/heads/master'
run: |
netlify deploy --prod -d ./ormolu-live/dist
# prevent stack.yaml from becoming outdated
stack:
name: Build and test via Stack
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/setup@v2
with:
enable-stack: true
stack-no-global: true
- uses: actions/cache@v4
with:
path: ~/.stack
key: stack-${{ hashFiles('stack.yaml', 'ormolu.cabal') }}
- name: Build
run: stack build
- name: Test
run: stack test