ci #36
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: CI | |
on: | |
push: | |
branches: | |
- master | |
- android | |
tags: | |
- '*' | |
jobs: | |
build-linux-clang: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: install 3rd party build tools | |
run: | | |
sudo apt-get update | |
sudo apt-get install make clang libsdl2-dev libsdl2-ttf-dev | |
- name: build all and examples | |
run: | | |
make dist | |
tar -C out -cvzf linux_x86_64.tar.gz . | |
env: | |
CC: clang | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: build-linux | |
path: linux_x86_64.tar.gz | |
build-android: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: install 3rd party build tools | |
run: | | |
mkdir external | |
cd external | |
curl -fsSL -o SDL2-2.30.0.zip https://github.com/libsdl-org/SDL/releases/download/release-2.30.0/SDL2-2.30.0.zip | |
7z x SDL2-2.30.0.zip | |
curl -fsSL -o SDL2_ttf-2.22.0.zip https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.22.0/SDL2_ttf-2.22.0.zip | |
7z x SDL2_ttf-2.22.0.zip | |
echo 'NDK_MODULE_PATH=${{github.workspace}}/external' >> $GITHUB_ENV | |
cd .. | |
- name: Set Up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
cache: 'gradle' | |
- uses: nttld/setup-ndk@v1 | |
with: | |
ndk-version: r25c | |
- name: build apk | |
run: | | |
cd android-project | |
chmod +x ./gradlew ./build.sh | |
./build.sh | |
./gradlew assembleDebug | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: build-android-debug | |
path: app/build/outputs/apk/debug/app-debug.apk | |
build-windows-msvc: | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v1 | |
# this runs vcvarsall for us, so we get the MSVC toolchain in PATH. | |
- uses: seanmiddleditch/gha-setup-vsdevenv@master | |
- name: download sdl2 | |
run: | | |
curl -fsSL -o SDL2-devel-VC.zip https://www.libsdl.org/release/SDL2-devel-2.0.14-VC.zip | |
7z x SDL2-devel-VC.zip | |
mv SDL2-2.0.14 SDL2 | |
curl -fsSL -o SDL2_ttf-VC.zip https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.0.15-VC.zip | |
7z x SDL2_ttf-VC.zip | |
mv SDL2_ttf-2.0.15 SDL2_ttf | |
- name: build all and examples | |
run: | | |
./build_msvc.bat | |
7z a win_x86_64.zip out | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: build-windows | |
path: win_x86_64.zip | |
makerelease: | |
runs-on: ubuntu-latest | |
needs: [build-linux-clang, build-windows-msvc] | |
steps: | |
- uses: olegtarasov/get-tag@v2.1 | |
id: tagName | |
- name: Download artifact windows | |
if: startsWith( steps.tagName.outputs.tag, 'v') | |
uses: actions/download-artifact@v2 | |
with: | |
name: build-windows | |
- name: Download artifact linux | |
if: startsWith( steps.tagName.outputs.tag, 'v') | |
uses: actions/download-artifact@v2 | |
with: | |
name: build-linux | |
- name: Create Release | |
if: startsWith( steps.tagName.outputs.tag, 'v') | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.tagName.outputs.tag }} | |
release_name: Release ${{ steps.tagName.outputs.tag }} | |
draft: false | |
prerelease: true | |
- name: Upload Release Asset windows | |
if: startsWith( steps.tagName.outputs.tag, 'v') | |
id: upload-release-asset-windows | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: win_x86_64.zip | |
asset_name: win_x86_64-${{ github.run_id }}.zip | |
asset_content_type: application/zip | |
- name: Upload Release Asset linux | |
if: startsWith( steps.tagName.outputs.tag, 'v') | |
id: upload-release-asset-linux | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: linux_x86_64.tar.gz | |
asset_name: linux_x86_64-${{ github.run_id }}.tar.gz | |
asset_content_type: application/gzip |