-
Notifications
You must be signed in to change notification settings - Fork 2
161 lines (136 loc) · 4.41 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
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: CI
# TODO: run some of these jobs conditionally based on what's been changed
# https://github.com/dorny/paths-filter (there's an example for conditional _job_ execution)
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches:
- main
jobs:
check:
name: cargo check 🕵️
needs: [not-draft]
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Rust 🦀
uses: ./.github/actions/setup-rust
with:
cache-key: check
- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
test:
name: cargo test 🧪
needs: [not-draft, check]
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
ninja-platform: linux
- os: macos-latest
ninja-platform: mac
- os: windows-latest
ninja-platform: win
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
# https://github.com/actions/cache/blob/5c79b3fd6c0e87c9444fe7b18edafe7d9ba61531/workarounds.md#improving-cache-restore-performance-on-windowsusing-cross-os-caching
- name: Use GNU tar
if: matrix.os == 'windows-latest'
shell: cmd
run: |
echo "Adding GNU tar to PATH"
echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
- name: Setup Rust 🦀
uses: ./.github/actions/setup-rust
with:
cache-key: test
components: llvm-tools-preview
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
# Some tests depend on Nodejs + npm dependencies
- name: Setup Nodejs
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: "npm"
# Some tests depend on a Haskell toolchain
- name: Setup Haskell λ
uses: ./.github/actions/setup-haskell
- name: Install required NPM packages
run: npm install --omit optional --ignore-scripts
- name: Install Ninja 🥷
id: install-ninja
uses: ditto-lang/actions/install-ninja@main
with:
release-version: v1.10.2
platform: ${{matrix.ninja-platform}}
# Build the Haskell lsp-test in its own step so the stdout isn't swallowed by nextest.
#
# We don't currently run this test on Windows because I've not been able to
# get GitHub actions to properly cache Haskell stuff there and it takes
# about 20 minutes on the first run...
- name: Build ditto-lsp-test λ
if: matrix.os != 'windows-latest'
run: stack build ditto-lsp-test
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: nextest
args: run --workspace
env:
DITTO_BUILD_GIT_DESCRIBE: "0.0.0-test"
DITTO_NINJA: ${{steps.install-ninja.outputs.which}}
treefmt:
name: treefmt 💅
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Rust 🦀
uses: ./.github/actions/setup-rust
with:
components: rustfmt
- name: Setup Nodejs
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: "npm"
- name: Install required NPM packages
run: npm install --omit optional --ignore-scripts
- name: Setup Nix
uses: cachix/install-nix-action@v18
- name: treefmt --fail-on-change
run: nix-shell --arg ci-treefmt true --run 'treefmt --clear-cache --fail-on-change'
clippy:
name: clippy 📎
needs: [not-draft]
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Rust 🦀
uses: ./.github/actions/setup-rust
with:
cache-key: clippy
components: clippy
- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
not-draft:
# https://knowyourmeme.com/memes/you-shall-not-pass
name: Shall pass? 🧙
runs-on: ubuntu-latest
steps:
- name: PR not ready 🙅
if: github.event_name == 'pull_request' && github.event.pull_request.draft == true
run: exit 1