-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (90 loc) · 3.69 KB
/
cmake-emscripten.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
name: CMake emsdk
on:
push:
branches: [ "master", "emscripten" ]
pull_request:
branches: [ "master" ]
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Setup Environment
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev
- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v13
with:
# Make sure to set a version number!
# latest as of when this file is added
version: 3.1.51
# This is the name of the cache folder.
# The cache folder will be placed in the build directory,
# so make sure it doesn't conflict with anything!
actions-cache-folder: 'emsdk-cache'
- name: build
run: |
emcmake cmake -B ${{ github.workspace }}/build -DPLATFORM=Web
cmake --build ${{ github.workspace }}/build
- uses: actions/upload-artifact@v4
with:
# Name of the artifact to upload.
# Optional. Default is 'artifact'
name: emscripten_build
# A file, directory or wildcard pattern that describes what to upload
# Required.
path: |
${{ github.workspace }}/build/sokoban.*
# The desired behavior if no files are found using the provided path.
# Available Options:
# warn: Output a warning but do not fail the action
# error: Fail the action with an error message
# ignore: Do not output any warnings or errors, the action does not fail
# Optional. Default is 'warn'
if-no-files-found: error
# Duration after which artifact will expire in days. 0 means using default retention.
# Minimum 1 day.
# Maximum 90 days unless changed from the repository settings page.
# Optional. Defaults to repository settings.
retention-days: 30
# The level of compression for Zlib to be applied to the artifact archive.
# The value can range from 0 to 9.
# For large files that are not easily compressed, a value of 0 is recommended for significantly faster uploads.
# Optional. Default is '6'
compression-level: 6
- name: create github artifact
run: |
cp ${{ github.workspace }}/src/github_page.html /tmp/index.html
cp ${{ github.workspace }}/build/sokoban.html /tmp
cp ${{ github.workspace }}/build/sokoban.js /tmp
cp ${{ github.workspace }}/build/sokoban.data /tmp
cp ${{ github.workspace }}/build/sokoban.wasm /tmp
# https://github.com/actions/deploy-pages/issues/203
cd /tmp; tar cf artifact.tar ./index.html ./sokoban.html ./sokoban.js ./sokoban.data ./sokoban.wasm
- name: Upload github-page artifact
uses: actions/upload-artifact@v4
with:
# Name of the artifact to upload.
# Optional. Default is 'artifact'
name: github-pages
path: /tmp/artifact.tar
if-no-files-found: error
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4