Skip to content

Commit 4db9e67

Browse files
authored
Create node.js.yml (#43)
* Create node.js.yml Create workflow for nodejs * Update node.js.yml Change npm to yarn * Update node.js.yml * Update node.js.yml * Update node.js.yml * Update node.js.yml * Update node.js.yml
1 parent 991d473 commit 4db9e67

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/node.js.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# This file is copied from https://github.com/source-academy/js-slang/blob/master/.github/workflows/nodejs.yml
2+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
3+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
4+
5+
name: Node.js CI
6+
7+
on:
8+
push:
9+
branches:
10+
[ "main" ]
11+
pull_request:
12+
branches:
13+
[ "main" ]
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
19+
strategy:
20+
matrix:
21+
node-version: [18.x, 20.x, 22.x]
22+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
with:
28+
submodules: recursive
29+
- name: Check for package-lock.json
30+
run: |
31+
if [ -e package-lock.json ]; then
32+
echo "package-lock.json found; please do not use NPM! This project uses Yarn!"
33+
exit 1
34+
fi
35+
exit 0
36+
- name: Install dependencies (apt)
37+
run: |
38+
sudo apt-get update && \
39+
sudo apt-get install -y --no-install-recommends \
40+
texlive texlive-fonts-extra texlive-lang-cjk latexmk latex-cjk-all
41+
# Has to be run before actions/setup-node.
42+
# See: https://github.com/actions/setup-node/issues/480
43+
- name: Enable corepack for Yarn
44+
run: corepack enable
45+
- name: Setup Node ${{ matrix.node-version }}
46+
uses: actions/setup-node@v4
47+
with:
48+
node-version: ${{ matrix.node-version }}
49+
cache: yarn
50+
- run: yarn install --immutable
51+
- run: yarn build
52+
- run: yarn format:ci
53+
- run: yarn eslint
54+
- run: yarn test-coverage
55+
env:
56+
CI: true

0 commit comments

Comments
 (0)