forked from openai/retro
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (91 loc) · 2.81 KB
/
nodejs.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
################################################################################
#
# Copyright (C) 2023-2024 retro.ai
# This file is part of retro3 - https://github.com/retroai/retro3
#
# SPDX-License-Identifier: AGPL-3.0-or-later
# See the file LICENSE.txt for more information.
#
################################################################################
name: Node.js CI
on: [push, pull_request]
jobs:
build-and-deploy:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
defaults:
run:
# Set the working directory to frontend folder
working-directory: src/frontend
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
node-version: 20
- os: ubuntu-22.04
node-version: 21
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Cache vite build files
id: cache-vite
uses: actions/cache@v4
with:
path: |
src/frontend/dist
key: cache-vite-${{ matrix.os }}-${{ matrix.node-version }}-${{ hashFiles('src/frontend/**') }}
- name: Cache pnpm modules
id: cache-modules
uses: actions/cache@v4
with:
path: |
src/frontend/node_modules
key: cache-modules-${{ matrix.os }}-${{ matrix.node-version }}-${{ hashFiles('src/frontend/pnpm-lock.yaml') }}
- name: Cache emsdk
id: cache-emsdk
uses: actions/cache@v4
with:
path: |
tools/emsdk
key: cache-emsdk-${{ hashFiles('tools/download-emscripten.sh') }}
- name: Cache WASM libraries
id: cache-wasm
uses: actions/cache@v4
with:
path: |
src/frontend/public/wasm
src/frontend/src/wasm
key: cache-wasm-${{ matrix.os }}-${{ matrix.node-version }}-${{ hashFiles('src/engine/**', 'tools/build-wasm.sh', 'tools/download-emscripten.sh') }}
- name: Install emsdk
if: steps.cache-emsdk.outputs.cache-hit != 'true'
run: |
./download-emscripten.sh
working-directory: tools
- name: Build wasm libraries
if: steps.cache-wasm.outputs.cache-hit != 'true'
run: |
./build-wasm.sh
working-directory: tools
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install pnpm
run: |
npm install -g pnpm
- name: pnpm install
if: steps.cache-modules.outputs.cache-hit != 'true'
run: |
pnpm install
- name: pnpm audit-ci
run: |
pnpm audit-ci
- name: pnpm lint
if: steps.cache-vite.outputs.cache-hit != 'true'
run: |
pnpm lint
- name: pnpm build
if: steps.cache-vite.outputs.cache-hit != 'true'
run: |
pnpm build