-
Notifications
You must be signed in to change notification settings - Fork 5
85 lines (70 loc) · 2.13 KB
/
esy.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
name: Esy
on:
- push
- pull_request
# This will cancel previous runs when a branch or PR is updated
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
name: Build and test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Setup node.js
uses: actions/[email protected]
with:
node-version: "16"
check-latest: true
# Install `esy` to build the project
# It also adds `shx` globally for cross-platform shell commands
- name: Setup environment
run: |
npm i -g esy
npm i -g shx
- name: Checkout project
uses: actions/[email protected]
with:
submodules: "recursive"
- name: Install local dependencies
run: |
esy install
- name: Esy cache
id: esy-cache
uses: actions/[email protected]
with:
path: _export
key: ${{ runner.os }}-esy-${{ hashFiles('esy.lock/index.json') }}
- name: Import esy cache
if: steps.esy-cache.outputs.cache-hit == 'true'
run: |
esy import-dependencies _export
shx rm -rf _export
# Build the project in release to make sure deps are specified correctly
- name: Build release dependencies
if: steps.esy-cache.outputs.cache-hit != 'true'
run: |
esy build-dependencies --release
- name: Build project in release
run: |
esy build --release
# Then build in non-release so we can test
- name: Build dependencies
if: steps.esy-cache.outputs.cache-hit != 'true'
run: |
esy build-dependencies
- name: Build project
run: |
esy build
# Re-export dependencies if anything has changed or if it is the first time
- name: Build esy cache
if: steps.esy-cache.outputs.cache-hit != 'true'
run: |
esy export-dependencies
- name: Run tests
run: |
esy test