-
Notifications
You must be signed in to change notification settings - Fork 3
198 lines (171 loc) · 6.81 KB
/
Copy pathci.yml
File metadata and controls
198 lines (171 loc) · 6.81 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: CI
on:
push:
paths-ignore:
- "**.md"
schedule:
# JST 11:00 (UTC 02:00), 月-金
- cron: "0 2 * * 1-5"
jobs:
ci:
name: CI
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-24.04-arm
- windows-2025
- macos-26
runs-on: ${{ matrix.os }}
timeout-minutes: 15
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Windows の場合には MSVC 系ではなく MinGW 系を使うようにする
if: contains(matrix.os, 'windows')
run: rustup set default-host x86_64-pc-windows-gnu
- run: rustup update stable
- uses: shiguredo/github-actions/.github/actions/rust-cache@main
with:
os: ${{ matrix.os }}
toolchain: stable
- run: cargo fmt --all --check
- run: cargo check --workspace --exclude dump_wasm --exclude transcode_wasm --exclude fuzz
- run: cargo build --workspace --exclude dump_wasm --exclude transcode_wasm --exclude fuzz
- run: cargo test --workspace --exclude dump_wasm --exclude transcode_wasm --exclude fuzz
- run: cargo clippy --workspace --exclude dump_wasm --exclude transcode_wasm --exclude fuzz -- -D warnings
- run: cargo doc --workspace --exclude dump_wasm --exclude transcode_wasm --exclude fuzz
env:
RUSTDOCFLAGS: "-D warnings"
- name: Windows の場合には MSVC 系でもビルドだけは試す
if: contains(matrix.os, 'windows')
run: |
rustup target add x86_64-pc-windows-msvc
cargo build --package c-api --target x86_64-pc-windows-msvc
- name: MSVC ビルド成果物の確認
if: contains(matrix.os, 'windows')
run: ls target/x86_64-pc-windows-msvc/debug/mp4.lib
test-wasm:
name: Test WebAssembly
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- run: rustup update stable
- run: rustup target add wasm32-unknown-unknown
- uses: shiguredo/github-actions/.github/actions/rust-cache@main
with:
os: ubuntu-24.04
toolchain: stable
- name: Install Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24"
- name: Build WebAssembly
run: cargo build -p wasm --target wasm32-unknown-unknown --profile release-wasm
- name: Run mux.js test
run: |
node crates/wasm/examples/mux.js /tmp/test_output.mp4
if [ ! -f /tmp/test_output.mp4 ]; then
echo "Error: mux.js did not create output file"
exit 1
fi
echo "mux.js completed successfully"
- name: Run demux.js test
run: |
node crates/wasm/examples/demux.js /tmp/test_output.mp4
echo "demux.js completed successfully"
build-c-api:
name: Build C API Library
strategy:
matrix:
include:
- os: ubuntu-24.04
artifact-name: ubuntu-24.04_x86_64
- os: ubuntu-24.04-arm
artifact-name: ubuntu-24.04_arm64
- os: windows-2025
artifact-name: windows-2025_x86_64
- os: macos-26
artifact-name: macos-26_arm64
runs-on: ${{ matrix.os }}
timeout-minutes: 15
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- run: rustup update stable
- uses: shiguredo/github-actions/.github/actions/rust-cache@main
with:
os: ${{ matrix.os }}
toolchain: stable
- name: Build C API
run: cargo build --release --package c-api
- name: Prepare artifacts (Unix)
if: runner.os != 'Windows'
run: |
mkdir -p artifacts/lib artifacts/include
cp $(ls target/release/libmp4.* | grep -E '\.(a|so|dylib)$') artifacts/lib/
cp crates/c-api/include/mp4.h artifacts/include/
- name: Prepare artifacts (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Path "artifacts/lib" -Force
New-Item -ItemType Directory -Path "artifacts/include" -Force
Copy-Item -Path "target/release/mp4.dll" -Destination "artifacts/lib/"
Copy-Item -Path "target/release/mp4.lib" -Destination "artifacts/lib/"
Copy-Item -Path "crates/c-api/include/mp4.h" -Destination "artifacts/include/"
- name: Upload artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: c-api-${{ matrix.artifact-name }}
path: artifacts/
build-wasm:
name: Build WebAssembly
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- run: rustup update stable
- run: rustup target add wasm32-unknown-unknown
- uses: shiguredo/github-actions/.github/actions/rust-cache@main
with:
os: ubuntu-24.04
toolchain: stable
- name: Install wasm-opt
run: |
curl -L -o binaryen.tar.gz https://github.com/WebAssembly/binaryen/releases/download/version_125/binaryen-version_125-x86_64-linux.tar.gz
echo "7c3bc16599c8274a04d34a504fe4be2047884f900e0e2da2f6fb9cd667183be4 binaryen.tar.gz" | sha256sum -c -
tar xzf binaryen.tar.gz
sudo mv binaryen-version_125/bin/wasm-opt /usr/local/bin/
- name: Build WebAssembly
run: cargo build --profile release-wasm --package wasm --target wasm32-unknown-unknown
- name: Optimize with wasm-opt
run: |
wasm-opt -Oz --enable-bulk-memory -o target/wasm32-unknown-unknown/release-wasm/mp4_wasm-opt.wasm target/wasm32-unknown-unknown/release-wasm/mp4_wasm.wasm
mv target/wasm32-unknown-unknown/release-wasm/mp4_wasm-opt.wasm target/wasm32-unknown-unknown/release-wasm/mp4_wasm.wasm
- name: Prepare artifacts
run: |
mkdir -p artifacts
cp target/wasm32-unknown-unknown/release-wasm/mp4_wasm.wasm artifacts/
- name: Upload artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wasm
path: artifacts/
slack_notify:
needs: [ci, test-wasm, build-c-api, build-wasm]
runs-on: ubuntu-slim
if: ${{ always() }}
permissions:
actions: read
steps:
- name: Slack Notification
uses: shiguredo/github-actions/.github/actions/slack-notify@main
with:
status: ${{ job.status }}
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
slack_channel: rust-oss
notify_mode: failure_and_fixed