Skip to content

Commit

Permalink
Add github actions.
Browse files Browse the repository at this point in the history
Remove tmp version.
  • Loading branch information
mooflu committed Oct 25, 2023
1 parent 173241c commit d17073d
Show file tree
Hide file tree
Showing 3 changed files with 211 additions and 2 deletions.
153 changes: 153 additions & 0 deletions .github/workflows/native.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: Critter build

# scripts/build.sh needs
# bash, wget, zip, tar, coreutils

on:
push:
tags:
- "[1-9].[0-9]+.[0-9]+"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
BUILD_SCRIPT: ./scripts/build.sh

permissions:
contents: read

jobs:
build-windows:
runs-on: windows-latest

steps:
- name: Do not convert line endings on checkout
run: git config --global core.autocrlf input

- uses: actions/checkout@v3
with:
ref: main
submodules: recursive
fetch-depth: 0

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1

- uses: cygwin/cygwin-install-action@master
with:
packages: >-
bash
wget
zip
tar
coreutils
- name: Build
working-directory: ${{github.workspace}}
run: |
C:\cygwin\bin\bash.exe ${{env.BUILD_SCRIPT}}
mkdir -p critter-${{ github.ref_name }}
cp build.oem.Release\game\Release\critter.exe critter-${{ github.ref_name }}
cp resource.dat critter-${{ github.ref_name }}
zip -9r critter-${{ github.ref_name }}-windows.zip critter-${{ github.ref_name }}
# upload artifacts so the publish job below can download and then update latest release via Linux
- uses: actions/upload-artifact@v3
with:
name: critter-win-build
path: critter-${{ github.ref_name }}-windows.zip

build-mac:
runs-on: macos-11

steps:
- uses: actions/checkout@v3
with:
ref: main
submodules: recursive
fetch-depth: 0

- name: Setup Macos dependencies
run: |
brew install bash coreutils
- name: Build
working-directory: ${{github.workspace}}
run: |
bash ${{env.BUILD_SCRIPT}}
mkdir -p critter-${{ github.ref_name }}
cp -a build.oem.Release/game/critter.app critter-${{ github.ref_name }}
zip -9r critter-${{ github.ref_name }}-mac.zip critter-${{ github.ref_name }}
# upload artifacts so the publish job below can download and then update latest release via Linux
- uses: actions/upload-artifact@v3
with:
name: critter-mac-build
path: critter-${{ github.ref_name }}-mac.zip

build-linux:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
ref: main
submodules: recursive
fetch-depth: 0

- name: Setup Linux dependencies
run: |
sudo apt-get update
sudo apt install -y --fix-missing \
wget zip libgl1-mesa-dev libglu1-mesa-dev libdrm-dev \
libxrandr-dev libxcursor-dev libxcb-xinput-dev libudev-dev libdbus-1-dev \
libasound2-dev libjack-dev libpulse-dev libsndio-dev
- name: Build
working-directory: ${{github.workspace}}
run: |
bash ${{env.BUILD_SCRIPT}}
mkdir -p critter-${{ github.ref_name }}
cp -a build.oem.Release/game/critter critter-${{ github.ref_name }}
cp resource.dat critter-${{ github.ref_name }}
zip -9r critter-${{ github.ref_name }}-linux.zip critter-${{ github.ref_name }}
# upload artifacts so the publish job below can download and then update latest release via Linux
- uses: actions/upload-artifact@v3
with:
name: critter-linux-build
path: critter-${{ github.ref_name }}-linux.zip

publish:
needs: [build-windows, build-mac, build-linux]

# one of the steps uses container action which is Linux only
runs-on: ubuntu-latest

permissions: write-all

steps:
- uses: actions/download-artifact@v3
with:
name: critter-win-build

- uses: actions/download-artifact@v3
with:
name: critter-mac-build

- uses: actions/download-artifact@v3
with:
name: critter-linux-build

- name: Publish release
# see https://github.com/pyTooling/Actions/tree/main/releaser
uses: pyTooling/Actions/releaser@main
with:
tag: ${{ github.ref_name }}
rm: true
token: ${{ secrets.GITHUB_TOKEN }}
files: |
critter-${{ github.ref_name }}-windows.zip
critter-${{ github.ref_name }}-mac.zip
critter-${{ github.ref_name }}-linux.zip
58 changes: 58 additions & 0 deletions .github/workflows/webapp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Critter webapp

on:
push:
tags:
- "[1-9].[0-9]+.[0-9]+"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# 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:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: main
submodules: recursive
fetch-depth: 0

- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v12
with:
version: 3.1.45

- name: Build
run: ./scripts/build-emscripten.sh

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./build/webapp

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ project(critter C CXX)

set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/mooflu.common/utilscmake")

set(VERSION "2.1") # TODO: add git tag and remove this line

if (NOT VERSION)
find_package (Git)
if (GIT_FOUND)
Expand Down

0 comments on commit d17073d

Please sign in to comment.