Merge pull request #854 from Daft-Freak/pico-sdk-2.0 #1263
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake / Emscripten | |
on: | |
push: | |
branches: | |
- '**' # only run on branches | |
pull_request: | |
release: | |
types: [published] | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
EM_VERSION: 2.0.18 | |
EM_CACHE_FOLDER: 'emsdk-cache' | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install deps | |
run: | | |
sudo apt update && sudo apt install doxygen graphviz python3-setuptools | |
pip3 install 32blit | |
- name: Setup cache | |
id: cache-system-libraries | |
uses: actions/cache@v3 | |
with: | |
path: ${{env.EM_CACHE_FOLDER}} | |
key: ${{env.EM_VERSION}}-${{runner.os}} | |
- name: Setup Emscripten | |
uses: mymindstorm/setup-emsdk@v12 | |
with: | |
version: ${{env.EM_VERSION}} | |
actions-cache-folder: ${{env.EM_CACHE_FOLDER}} | |
- name: Create Build Environment | |
run: cmake -E make_directory ${{runner.workspace}}/build | |
- name: Set Tag Variable | |
if: github.event_name == 'release' | |
shell: bash | |
run: echo "TRAVIS_TAG=${{github.event.release.tag_name}}" >> $GITHUB_ENV | |
- name: Configure CMake | |
shell: bash | |
working-directory: ${{runner.workspace}}/build | |
run: emcmake cmake $GITHUB_WORKSPACE -D32BLIT_DIR=$GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_FLAGS_RELEASE="-O2 -DNDEBUG" | |
# Problem matching | |
- uses: ammaraskar/gcc-problem-matcher@master | |
- name: Build | |
working-directory: ${{runner.workspace}}/build | |
shell: bash | |
run: | | |
embuilder.py build sdl2 sdl2-image-jpg sdl2-net | |
cmake --build . --config $BUILD_TYPE -j 2 | |
- name: Prepare Site | |
run: | | |
mkdir -p site/examples | |
cp ../build/examples/*/*.{js,wasm} site/examples | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{github.event.repository.name}}-${{github.sha}}-web | |
path: site | |
# build the docs | |
- name: Build Docs | |
if: github.ref == 'refs/heads/master' # github.event_name == 'release' | |
run: | | |
cd 32blit && doxygen doxygen.conf && cd .. | |
cp -r 32blit/documentation/html/* site | |
- name: Deploy to GitHub Pages | |
if: github.ref == 'refs/heads/master' # github.event_name == 'release' | |
uses: crazy-max/ghaction-github-pages@v3 | |
with: | |
target_branch: gh-pages | |
build_dir: site | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |