-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (56 loc) · 1.95 KB
/
build-test.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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Build
on:
push:
branches: [ "workspace" ]
pull_request:
branches: [ "workspace" ]
jobs:
prepare:
name: Find paths
runs-on: ubuntu-latest
outputs:
paths: ${{ steps.paths.outputs.paths }}
steps:
- name: Clone repo
uses: actions/checkout@v4
- uses: actions/github-script@v7
name: List paths
id: paths
with:
script: |
const fs = require('fs')
const path = require('path')
const process = require('process')
const paths = []
paths.push(...getProjects('plugins'))
paths.push(...getProjects('packages'))
paths.push('core')
console.log(paths)
core.setOutput('paths', paths)
function getProjects(dirname) {
const pathName = path.join(process.cwd(), dirname)
const files = fs.readdirSync(pathName)
const directories = files.filter((file) => fs.statSync(path.join(pathName, file)).isDirectory()).map((dir) => `${dirname}/${dir}`)
return directories
}
build:
name: Build ${{ matrix.path }}
runs-on: ubuntu-latest
needs: prepare
strategy:
matrix:
node-version: [20.11.1]
path: ${{ fromJson(needs.prepare.outputs.paths) }}
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: |
cd ${{ matrix.path }} &&
bun i &&
bun run build || true &&
bun build ./src/app.ts --target=bun --minify --outfile=build.js