added default formatting / linting / checkstyle stuff #90
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: Build Canabalt | |
on: | |
push: | |
workflow_dispatch: | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
RELEASE_TAG: ${{startsWith(github.ref, 'refs/tags/') && github.ref_name || 'bleeding'}} | |
jobs: | |
create-latest: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Github Releases Bleeding Upload | |
uses: marvinpinto/[email protected] | |
with: | |
repo_token: "${{ github.token }}" | |
automatic_release_tag: "${{env.RELEASE_TAG}}" | |
prerelease: ${{startsWith(env.RELEASE_TAG, 'bleeding') && 'true' || 'false'}} | |
download_haxe: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: krdlab/setup-haxe@v1 | |
with: | |
haxe-version: 4.3.3 | |
- name: Retrieve Haxelib actions cache | |
uses: actions/cache@v4 | |
with: | |
path: .haxelib | |
key: haxelib-${{ hashFiles('hmm.json') }}-${{ env.BRANCH_NAME }} | |
- name: Install HMM | |
run: | | |
haxelib install hmm --quiet | |
- name: Download Haxelibs | |
run: | | |
haxelib run hmm install --quiet | |
build: | |
needs: download_haxe | |
env: | |
BUTLER_API_KEY: ${{ secrets.BUTLER_CREDENTIALS }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: html5 | |
butler: linux | |
- os: ubuntu-latest | |
target: linux | |
butler: linux | |
- os: windows-latest | |
target: windows | |
butler: windows | |
- os: macos-latest | |
target: macos # needs to be macos! not just mac ! | |
butler: darwin | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: krdlab/setup-haxe@v1 | |
with: | |
haxe-version: 4.3.3 | |
- name: Get haxelibs | |
uses: actions/cache/restore@v3 | |
with: | |
path: .haxelib | |
key: haxelib-${{ hashFiles('hmm.json') }}-${{ env.BRANCH_NAME }} | |
- name: Restore build cache | |
if: matrix.target != 'html5' | |
uses: actions/cache@v4 | |
with: | |
path: export/*/obj/ | |
key: cpp-${{matrix.target}}-${{ env.BRANCH_NAME }} | |
- run: haxelib run hmm install --quiet | |
- name: Build | |
run: | | |
haxelib run lime build ${{matrix.target}} -release -DNG_API=${{ secrets.NG_API }} -DNG_ENC=${{ secrets.NG_ENC }} | |
- name: Obfuscate the Javascript | |
if: matrix.target == 'html5' | |
uses: ninjamuffin99/[email protected] | |
with: | |
path: export/html5/bin/canabalt.js | |
- name: 7Zip Linux | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt update | |
sudo apt install p7zip-full p7zip-rar | |
- name: Install and extract butler | |
run: | | |
curl -L -o butler.zip https://broth.itch.ovh/butler/${{matrix.butler}}-amd64/LATEST/archive/default | |
7z e butler.zip | |
- run: chmod +x butler | |
if: matrix.os == 'ubuntu-latest' | |
- name: Login to itch.io | |
run: | | |
./butler login | |
./butler -V | |
- name: Push to itch.io | |
run: | | |
./butler push export/*/bin ninja-muffin24/canabalt-hf:${{ matrix.target }}-${{env.RELEASE_TAG}}-${{env.BRANCH_NAME}} | |
shell: bash | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | |
- run: tar cf - export/${{matrix.target}}/bin/ | gzip > canabalt-${{matrix.target}}-${{ steps.date.outputs.date }}-${{env.BRANCH_NAME}}.tar.gz | |
if: matrix.target == 'linux' | |
- uses: vimtor/[email protected] # too lazy to figure out 7z grrr... | |
if: matrix.target != 'linux' | |
with: | |
files: export/${{matrix.target}}/bin/ | |
dest: canabalt-${{matrix.target}}-${{ steps.date.outputs.date }}-${{env.BRANCH_NAME}}.zip | |
- name: Upload build to Github releases | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: gh release upload ${{env.RELEASE_TAG}} canabalt-${{matrix.target}}-${{ steps.date.outputs.date }}-${{env.BRANCH_NAME}}.* --clobber | |
shell: bash |