forked from vgmstream/vgmstream
-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (114 loc) · 4.64 KB
/
cmake-wasm.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
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
# github workflow to automate builds
name: WebAssembly build
on: [push, pull_request, workflow_dispatch]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
EM_VERSION: 3.1.24
EM_CACHE_FOLDER: 'emsdk-cache'
jobs:
build:
name: CMake, WebAssembly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Fetch Git tags
run: |
git fetch --prune --unshallow --tags
- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v11
with:
version: ${{env.EM_VERSION}}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
- name: Create build environment
run: cmake -E make_directory ${{runner.workspace}}/embuild
- name: Cache celt
uses: actions/cache@v4
with:
path: |
${{runner.workspace}}/dependencies/celt-0061
${{runner.workspace}}/dependencies/celt-0110
${{runner.workspace}}/embuild/dependencies/celt-0061/libcelt/.libs
${{runner.workspace}}/embuild/dependencies/celt-0110/libcelt/.libs
key: wasm-celt-${{ hashFiles('cmake/dependencies/celt.cmake') }}
- name: Cache ffmpeg
uses: actions/cache@v4
with:
path: |
${{runner.workspace}}/embuild/dependencies/ffmpeg/bin/usr/local/include
${{runner.workspace}}/embuild/dependencies/ffmpeg/bin/usr/local/lib
key: wasm-ffmpeg-${{ hashFiles('cmake/dependencies/ffmpeg.cmake') }}
- name: Cache atrac9
uses: actions/cache@v4
with:
path: |
${{runner.workspace}}/embuild/dependencies/LibAtrac9/bin
key: wasm-atrac9-${{ hashFiles('cmake/dependencies/atrac9.cmake') }}
- name: Cache g719
uses: actions/cache@v4
with:
path: |
${{runner.workspace}}/embuild/dependencies/libg719_decode/libg719_decode.a
key: wasm-g719-${{ hashFiles('cmake/dependencies/g719.cmake') }}
- name: Cache mpg123
uses: actions/cache@v4
with:
path: |
${{runner.workspace}}/dependencies/mpg123
${{runner.workspace}}/embuild/dependencies/mpg123/src/libmpg123/.libs
key: wasm-mpg123-${{ hashFiles('cmake/dependencies/mpg123.cmake') }}
- name: Cache speex
uses: actions/cache@v4
with:
path: |
${{runner.workspace}}/embuild/dependencies/speex/libspeex/.libs
key: wasm-speex-${{ hashFiles('cmake/dependencies/speex.cmake') }}
- name: Cache ogg
uses: actions/cache@v4
with:
path: |
${{runner.workspace}}/embuild/dependencies/ogg/libogg.a
${{runner.workspace}}/embuild/dependencies/ogg/include
key: wasm-ogg-${{ hashFiles('cmake/dependencies/ogg.cmake') }}
- name: Cache vorbis
uses: actions/cache@v4
with:
path: |
${{runner.workspace}}/embuild/dependencies/vorbis/lib/*.a
key: wasm-vorbis-${{ hashFiles('cmake/dependencies/vorbis.cmake') }}
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/embuild
run: emcmake cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
- name: Build
working-directory: ${{runner.workspace}}/embuild
shell: bash
run: emmake make
- name: Upload WebAssembly artifact
uses: actions/upload-artifact@v4
with:
path: |
${{runner.workspace}}/embuild/cli/vgmstream-cli.js
${{runner.workspace}}/embuild/cli/vgmstream-cli.wasm
name: vgmstream-wasm
# uploads current assets to vgmstream-releases (token only works on merges)
- name: Upload artifacts to vgmstream-releases
if: github.event_name != 'pull_request'
working-directory: ${{github.workspace}}
env:
UPLOADER_GITHUB_TOKEN: ${{ secrets.UPLOADER_GITHUB_TOKEN }}
run: |
python .github/uploader.py ${{runner.workspace}}/embuild/cli/vgmstream-cli.js ${{runner.workspace}}/embuild/cli/vgmstream-cli.wasm
#- name: Upload artifacts to S3
# if: github.event_name != 'pull_request'
# working-directory: ${{runner.workspace}}/embuild/cli
# shell: bash
# env:
# AWS_DEFAULT_REGION: us-west-1
# AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
# AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
# run: |
# echo ${{github.sha}} | tee latest_id
# aws s3 cp ${{runner.workspace}}/embuild/cli/vgmstream-cli.js s3://vgmstream-builds/js/vgmstream-cli.js --acl public-read
# aws s3 cp ${{runner.workspace}}/embuild/cli/vgmstream-cli.wasm s3://vgmstream-builds/js/vgmstream-cli.wasm --acl public-read
# aws s3 cp latest_id s3://vgmstream-builds/js/version --acl public-read