Skip to content

Link to newer projects #5967

Link to newer projects

Link to newer projects #5967

Workflow file for this run

# TODO
# https://github.com/Uriopass/Egregoria/blob/master/.github/workflows/release.yml
# has stuff for automating releases
name: Build
on: [push]
defaults:
run:
shell: bash
jobs:
build:
name: Build everything for ${{ matrix.os }}
if: "contains(github.event.head_commit.message, '[rebuild]')"
environment: release
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux, macos, windows]
include:
- build: linux
os: ubuntu-20.04
- build: macos
os: macos-latest
- build: windows
os: windows-latest
steps:
- uses: actions/checkout@master
- uses: hecrj/setup-rust-action@v1
with:
rust-version: 1.75.0
- name: Cache build
uses: actions/cache@v2
with:
path: target
# The key could include hashFiles('Cargo.lock'), but cargo will figure out what can be reused.
key: build-${{ matrix.os }}
- name: Detect release
run: if [[ `git log -1 --pretty=format:"%s"` == *"[release]"* ]]; then echo 'features=--features=map_gui/release_s3' >> $GITHUB_ENV; else echo 'features=' >> $GITHUB_ENV; fi
- name: Install dependencies
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install libasound2-dev libxcb-shape0-dev libxcb-xfixes0-dev libpango1.0-dev libgtk-3-dev
- name: Build game
working-directory: apps/game
run: cargo build --release ${{ env.features }}
- name: Build santa
working-directory: apps/santa
run: cargo build --release ${{ env.features }}
- name: Build fifteen_min
working-directory: apps/fifteen_min
run: cargo build --release ${{ env.features }}
- name: Build osm_viewer
working-directory: apps/osm_viewer
run: cargo build --release ${{ env.features }}
- name: Build parking_mapper
working-directory: apps/parking_mapper
run: cargo build --release ${{ env.features }}
- name: Build ltn
working-directory: apps/ltn
run: cargo build --release ${{ env.features }}
- name: Build the CLI tool
run: cargo build --release --bin cli
- name: Download system data
run: cargo run --release --bin updater -- download --minimal
- name: import and unlock macos codesigning keychain
if: matrix.build == 'macos'
run: |
echo "${{ secrets.MACOS_DEVELOPER_ID_APPLICATION_P12 }}" | base64 --decode > developerID_application.p12
# The keychain api requires a password, but we're building a one-off keychain
# and immediately unlocking it, so we just use a random throw away password.
KEYCHAIN_PASSWORD=$(openssl rand -hex 64)
security create-keychain -p "${KEYCHAIN_PASSWORD}" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "${KEYCHAIN_PASSWORD}" build.keychain
security import developerID_application.p12 -k build.keychain -P "${{ secrets.MACOS_DEVELOPER_ID_APPLICATION_P12_PASSWORD }}" -T /usr/bin/codesign
# avoid being "prompted" for password when using codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${KEYCHAIN_PASSWORD}" build.keychain > /dev/null
rm developerID_application.p12
- name: Package release
env:
MACOS_DEVELOPER_APPLE_ID: ${{ secrets.MACOS_DEVELOPER_APPLE_ID }}
MACOS_DEVELOPER_APP_SPECIFIC_PASSWORD: ${{ secrets.MACOS_DEVELOPER_APP_SPECIFIC_PASSWORD }}
MACOS_DEVELOPER_TEAM_ID: ${{ secrets.MACOS_DEVELOPER_TEAM_ID }}
run: ./release/build.sh ${{ matrix.os }}
- name: Upload release for Linux
if: matrix.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v2
with:
name: abst_linux
path: abst_linux.zip
- name: Upload release for Mac
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v2
with:
name: abst_mac
path: abst_mac.zip
- name: Upload release for Windows
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v2
with:
name: abst_windows
path: abst_windows
- name: Upload just the binary for Windows
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v2
with:
name: abst_windows_binary
path: target/release/game.exe
- name: Upload just the binary for Mac
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v2
with:
name: abst_mac_binary
path: target/release/game