-
Notifications
You must be signed in to change notification settings - Fork 3
137 lines (108 loc) · 4.12 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
130
131
132
133
134
135
136
137
# SPDX-FileCopyrightText: 2020 Kowainik
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io/>
#
# SPDX-License-Identifier: MPL-2.0
# Sources:
# • https://github.com/kowainik/validation-selective/blob/5b46cd4810bbaa09b704062ebbfa2bb47137425d/.github/workflows/ci.yml
# • https://kodimensional.dev/github-actions
# • https://github.com/serokell/tztime/blob/336f585c2c7125a8ba58ffbf3dbea4f36a7c40e7/.github/workflows/ci.yml
name: CI
on: [pull_request]
jobs:
validate:
runs-on: [self-hosted, nix]
steps:
- uses: actions/checkout@v3
- name: reuse
run: nix build -L .#checks.x86_64-linux.reuse-lint
# Run step even if the previous one has failed
if: success() || failure()
- name: hlint
run: nix build -L .#checks.x86_64-linux.hlint
if: success() || failure()
- name: shellcheck
run: nix build -L .#checks.x86_64-linux.shellcheck
if: success() || failure()
- name: stylish-haskell
run: nix build -L .#checks.x86_64-linux.stylish-haskell
if: success() || failure()
- name: check-trailing-whitespace
run: nix build -L .#checks.x86_64-linux.trailing-whitespace
if: success() || failure()
xrefcheck-build-and-test-windows:
runs-on: windows-latest
strategy:
matrix:
stack: ["2.7.5"]
ghc: ["9.0.2"]
include:
- ghc: "9.0.2"
stackyaml: stack.yaml
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- uses: haskell/actions/[email protected]
id: setup-haskell-stack
name: Setup Haskell Stack
with:
ghc-version: ${{ matrix.ghc }}
stack-version: ${{ matrix.stack }}
- uses: actions/cache@v3
name: Cache stack root
with:
path: ~/AppData/Roaming/stack
key: ${{ runner.os }}-${{ matrix.ghc }}-stack
- uses: actions/cache@v3
name: Cache AppData/Local/Programs/stack
with:
path: ~/AppData/Local/Programs/stack
key: ${{ runner.os }}-${{ matrix.ghc }}-appdata-stack
# When editing this action, make sure it can run without using cached folders.
# Yes, it tries to install mingw-w64-x86_64-pcre twice
- name: install pacman dependencies
run: |
stack --system-ghc exec -- pacman -S --needed --noconfirm pkgconf;
stack --system-ghc exec -- pacman -S --needed --noconfirm msys2-keyring;
stack --system-ghc exec -- pacman --noconfirm -Syuu;
stack --system-ghc exec -- pacman -S --needed --noconfirm mingw-w64-x86_64-pcre;
stack --system-ghc exec -- pacman --noconfirm -Syuu;
stack --system-ghc exec -- pacman -S --needed --noconfirm mingw-w64-x86_64-pcre;
stack --system-ghc exec -- pacman -S --needed --noconfirm pcre-devel;
- name: Build
run: |
stack build --system-ghc --stack-yaml ${{ matrix.stackyaml }} --test --bench --no-run-tests --no-run-benchmarks --ghc-options '-Werror'
- name: stack test xrefcheck:xrefcheck-tests
run: |
stack test --system-ghc --stack-yaml ${{ matrix.stackyaml }} xrefcheck:xrefcheck-tests
- name: install xrefcheck to use with golden tests
run: |
stack --system-ghc --stack-yaml ${{ matrix.stackyaml }} install;
- uses: mig4/setup-bats@v1
name: Setup bats
- name: Golden tests
run: |
export PATH=$PATH:/c/Users/runneradmin/AppData/Roaming/local/bin;
bats ./tests/golden/**
shell: bash
xrefcheck-build-and-test-nix:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: build
run: nix build -L .#xrefcheck
- wait
- name: test
run: nix build -L .#checks.x86_64-linux.test
- name: Golden tests (bats)
run: nix shell .#bats .#diffutils .#xrefcheck -c bash -c "cd tests/golden/ && bats ./**"
- name: windows cross-compilation
run: nix build -L .#xrefcheck-windows
- name: docker-image
run: nix build -L .#docker-image
- name: static binary
run: nix build -L .#xrefcheck-static
- name: Xrefcheck itself
run: nix run . -L