Skip to content

Commit b51bf02

Browse files
committed
feat!: modernize repository structure and tools; introduce ci/cd
1 parent 3fdd967 commit b51bf02

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4816
-4373
lines changed

.github/workflows/ci.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
quality:
9+
name: Quality checks (Node ${{ matrix.node }})
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
node: ["20.x", "24.x"]
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup pnpm
20+
uses: pnpm/action-setup@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ matrix.node }}
26+
cache: pnpm
27+
28+
- name: Install dependencies
29+
run: pnpm install --frozen-lockfile
30+
31+
- name: Lint
32+
run: pnpm run lint
33+
34+
- name: Typecheck
35+
run: pnpm run typecheck
36+
37+
- name: Unit tests
38+
run: pnpm run test:unit
39+
40+
- name: Integration tests
41+
run: pnpm run test:integration
42+
43+
- name: Build package
44+
run: pnpm run build
45+
46+
postinstall:
47+
name: LAME install on ${{ matrix.os }}
48+
runs-on: ${{ matrix.os }}
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
os: [ubuntu-latest, macos-latest, windows-latest]
53+
steps:
54+
- name: Checkout
55+
uses: actions/checkout@v4
56+
57+
- name: Setup pnpm
58+
uses: pnpm/action-setup@v4
59+
60+
- name: Setup Node.js
61+
uses: actions/setup-node@v4
62+
with:
63+
node-version: 20.x
64+
cache: pnpm
65+
66+
- name: Install dependencies (runs postinstall)
67+
env:
68+
LAME_FORCE_DOWNLOAD: "1"
69+
run: pnpm install --frozen-lockfile

.github/workflows/release.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Release
2+
3+
on:
4+
workflow_run:
5+
workflows: ["CI"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
build-binaries:
11+
if: >
12+
github.event.workflow_run.conclusion == 'success' &&
13+
github.event.workflow_run.head_branch == 'master'
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- platform: linux
20+
arch: x64
21+
binary: vendor/lame/linux-x64/lame
22+
- platform: darwin
23+
arch: arm64
24+
binary: vendor/lame/darwin-arm64/lame
25+
- platform: win32
26+
arch: x64
27+
binary: vendor/lame/win32-x64/lame.exe
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
with:
32+
repository: ${{ github.event.workflow_run.head_repository.full_name }}
33+
ref: ${{ github.event.workflow_run.head_commit.id }}
34+
35+
- name: Setup pnpm
36+
uses: pnpm/action-setup@v4
37+
38+
- name: Setup Node.js
39+
uses: actions/setup-node@v4
40+
with:
41+
node-version: 20.x
42+
cache: pnpm
43+
44+
- name: Install dependencies
45+
env:
46+
LAME_SKIP_DOWNLOAD: "1"
47+
run: pnpm install --frozen-lockfile
48+
49+
- name: Download LAME binary for ${{ matrix.platform }}-${{ matrix.arch }}
50+
env:
51+
NODE_LAME_PLATFORM: ${{ matrix.platform }}
52+
NODE_LAME_ARCH: ${{ matrix.arch }}
53+
LAME_FORCE_DOWNLOAD: "1"
54+
run: node scripts/install-lame.mjs
55+
56+
- name: Package binary
57+
run: node scripts/package-lame.mjs --binary "${{ matrix.binary }}" --platform "${{ matrix.platform }}" --arch "${{ matrix.arch }}" --out-dir artifacts
58+
59+
- name: Upload artifacts
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: lame-${{ matrix.platform }}-${{ matrix.arch }}
63+
path: artifacts
64+
65+
publish:
66+
needs: build-binaries
67+
if: >
68+
github.event.workflow_run.conclusion == 'success' &&
69+
github.event.workflow_run.head_branch == 'master'
70+
runs-on: ubuntu-latest
71+
permissions:
72+
contents: write
73+
id-token: write
74+
steps:
75+
- name: Checkout
76+
uses: actions/checkout@v4
77+
with:
78+
repository: ${{ github.event.workflow_run.head_repository.full_name }}
79+
ref: ${{ github.event.workflow_run.head_commit.id }}
80+
81+
- name: Setup pnpm
82+
uses: pnpm/action-setup@v4
83+
84+
- name: Setup Node.js
85+
uses: actions/setup-node@v4
86+
with:
87+
node-version: 24.x
88+
cache: pnpm
89+
registry-url: https://registry.npmjs.org
90+
91+
- name: Install dependencies
92+
run: pnpm install --frozen-lockfile
93+
94+
- name: Download artifacts
95+
uses: actions/download-artifact@v4
96+
with:
97+
path: artifacts
98+
99+
- name: Unpack binaries into vendor directory
100+
run: node scripts/unpack-lame-artifacts.mjs artifacts vendor/lame
101+
102+
- name: Build package
103+
run: pnpm run build
104+
105+
- name: Publish to npm
106+
env:
107+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
108+
run: pnpm publish --access public

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ pids
1111
.lock-wscript
1212

1313
# Dependency directories
14-
node_modules
14+
node_modules/
15+
vendor/
1516

1617
# Lib dependencies
1718
bin/*
@@ -28,9 +29,14 @@ ehthumbs.db
2829
Icon?
2930
Thumbs.db
3031

32+
# Builds
33+
dist/
34+
3135
# IDE
3236
.vscode/*
3337
.idea/*
3438

3539
# Test
40+
coverage/
41+
coverage-unit.json
3642
test/encoded.mp3

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules/
2+
dist/
3+
coverage/
4+
vendor/
5+
pnpm-lock.yaml

.prettierrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"tabWidth": 4
2+
"tabWidth": 4
33
}

0 commit comments

Comments
 (0)