-
-
Notifications
You must be signed in to change notification settings - Fork 115
122 lines (105 loc) · 3.43 KB
/
build-native.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
# This workflow exists to provide a way to dispatch a CI run for any
# given ref on any of our OS targets. It can also be consumed in our
# various other builds.
name: (native) Build and test
on:
workflow_dispatch:
inputs:
os:
description: Operating system to run CI on
type: choice
required: true
default: "ubuntu-latest"
options:
- ubuntu-latest
- macos-latest
- windows-latest
ref:
description: Git reference to checkout
type: string
required: false
workflow_call:
inputs:
os:
description: Operating system to run CI on
type: string
required: true
ref:
description: Git reference to checkout
type: string
required: false
jobs:
build:
name: (native) Build and test
runs-on: ${{ inputs.os }}
steps:
- name: Checkout project
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Setup node.js
uses: actions/[email protected]
with:
node-version: ">=18.15 <19"
check-latest: true
cache: "npm"
- name: Install npm dependencies
run: |
npm ci
- name: Esy cache
id: esy-cache
uses: actions/cache/restore@v3
with:
path: compiler/_export
key: ${{ runner.os }}-esy-${{ hashFiles('compiler/esy.lock/index.json') }}
- name: Esy setup
# Don't crash the run if esy cache import fails - mostly happens on Windows
continue-on-error: true
run: |
npm run compiler prepare
npm run compiler import-dependencies
- name: Build compiler
run: |
npm run compiler build
# Upload the artifacts before we run the tests so we
# can download to debug if tests fail in a weird way
- name: Upload native compiler artifacts
uses: actions/upload-artifact@v4
with:
name: native-build-artifacts-${{ runner.os }}-${{ runner.arch }}
path: cli/bin/*.exe
- name: Run tests
run: |
npm run compiler test
- name: (compiler) Check parser error messages exhaustiveness
run: |
npm run compiler parser:check-errors
- name: (graindoc) Check parser error messages exhaustiveness
run: |
npm run compiler graindoc-parser:check-errors
# Check formatting last because building is more important
- name: (compiler) Check formatting
if: inputs.os != 'windows-latest'
run: |
npm run compiler check-format
- name: (cli) Check formatting
if: inputs.os != 'windows-latest'
run: |
npm run cli check-format
# This is to test the CLI is working
- name: Log Grain version
run: |
grain -v
# If we have a working grain CLI, we can run graindoc on stdlib
- name: (stdlib) Check documentation
if: inputs.os != 'windows-latest'
run: |
grain doc stdlib -o stdlib --current-version=$(grain -v)
git diff --exit-code --name-only
# If we have a working grain CLI, we can run grainfmt on stdlib & tests
- name: (stdlib) Check formatting
if: inputs.os != 'windows-latest'
run: |
grain format stdlib -o stdlib
grain format compiler/test/stdlib -o compiler/test/stdlib
git diff --exit-code --name-only