-
-
Notifications
You must be signed in to change notification settings - Fork 116
118 lines (103 loc) · 3.24 KB
/
build-js.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
# 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: (js) 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: (js) 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
# Don't build native executables, only the JS builds
- name: Build compiler
run: |
npm run compiler build:js
- name: Run tests
run: |
npm run compiler test:js
# This will log a warning because we didn't build the native exe files
- name: Build pkg binary for Windows
if: inputs.os == 'ubuntu-latest'
run: |
npm run cli build-pkg -- --target=win-x64
tar -cvf grain.tar -C pkg grain.exe
- name: Upload pkg binary for Windows
if: inputs.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
path: ./grain.tar
name: grain-win-x64
# This will log a warning because we didn't build the native exe files
- name: Build pkg binary for Mac
if: inputs.os == 'ubuntu-latest'
run: |
npm run cli build-pkg -- --target=mac-x64
tar -cvf grain.tar -C pkg grain
- name: Upload pkg binary for Mac
if: inputs.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
path: ./grain.tar
name: grain-mac-x64
# This will log a warning because we didn't build the native exe files
- name: Build pkg binary for Linux
if: inputs.os == 'ubuntu-latest'
run: |
npm run cli build-pkg -- --target=linux-x64
tar -cvf grain.tar -C pkg grain
- name: Upload pkg binary for Linux
if: inputs.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
path: ./grain.tar
name: grain-linux-x64