mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-27 00:12:55 +03:00
bb6dbb0731
When I added web support in February, it was easier to get started with stdweb, since it has the nice cargo web tool. However, stdweb is unmaintained, winit is deprecating support for it, and the next steps for web (downloading maps dynamically) have better support for web-sys. With Alvin's guidance, I got https://github.com/dabreegster/minimal_websys_winit_glow_demo working first. This PR cuts A/B Street over too. I tested abst and the widgetry demo in both native and web. The only major regression from stdweb is the canvas placement and size. I attempted some fixes, but at this point, I'll leave it as a smaller followup instead.
117 lines
4.2 KiB
YAML
117 lines
4.2 KiB
YAML
# TODO
|
|
# https://github.com/Uriopass/Egregoria/blob/master/.github/workflows/release.yml
|
|
# has stuff for automating releases
|
|
name: Build
|
|
on: [push]
|
|
jobs:
|
|
build-windows:
|
|
runs-on: windows-latest
|
|
if: "contains(github.event.head_commit.message, '[rebuild]')"
|
|
steps:
|
|
- uses: actions/checkout@master
|
|
- uses: hecrj/setup-rust-action@v1
|
|
with:
|
|
rust-version: 1.46.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: ${{ runner.os }}-build
|
|
- name: Build game
|
|
run: cargo build --release --bin game
|
|
- name: Build importer
|
|
run: cargo build --release --bin importer
|
|
- name: Package release
|
|
run: ./release/build.sh abst_windows play_abstreet.bat target/release/game.exe target/release/importer.exe
|
|
shell: bash
|
|
- name: Upload release
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: abst_windows
|
|
path: abst_windows
|
|
- name: Upload just the binary
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: abst_windows_binary
|
|
path: target/release/game.exe
|
|
build-macos:
|
|
runs-on: macos-latest
|
|
if: "contains(github.event.head_commit.message, '[rebuild]')"
|
|
steps:
|
|
- uses: actions/checkout@master
|
|
- uses: hecrj/setup-rust-action@v1
|
|
with:
|
|
rust-version: 1.46.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: ${{ runner.os }}-build
|
|
- name: Build game
|
|
run: cargo build --release --bin game
|
|
- name: Build importer
|
|
run: cargo build --release --bin importer
|
|
- name: Package release
|
|
run: ./release/build.sh abst_mac play_abstreet.sh target/release/game target/release/importer
|
|
- name: Upload release
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: abst_mac
|
|
path: abst_mac.zip
|
|
- name: Upload just the binary
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: abst_mac_binary
|
|
path: target/release/game
|
|
build-linux:
|
|
runs-on: ubuntu-latest
|
|
if: "contains(github.event.head_commit.message, '[rebuild]')"
|
|
steps:
|
|
- uses: actions/checkout@master
|
|
- uses: hecrj/setup-rust-action@v1
|
|
with:
|
|
rust-version: 1.46.0
|
|
- name: Update apt
|
|
run: sudo apt-get update
|
|
- name: Install dependencies
|
|
run: sudo apt-get install xorg-dev libxcb-shape0-dev libxcb-xfixes0-dev
|
|
- 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: ${{ runner.os }}-build
|
|
- name: Build game
|
|
run: cargo build --release --bin game
|
|
- name: Build importer
|
|
run: cargo build --release --bin importer
|
|
- name: Package release
|
|
run: ./release/build.sh abst_linux play_abstreet.sh target/release/game target/release/importer
|
|
- name: Upload release
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: abst_linux
|
|
path: abst_linux.zip
|
|
build-wasm:
|
|
runs-on: ubuntu-latest
|
|
if: "contains(github.event.head_commit.message, '[rebuild]')"
|
|
steps:
|
|
- uses: actions/checkout@master
|
|
- uses: hecrj/setup-rust-action@v1
|
|
with:
|
|
rust-version: 1.46.0
|
|
- name: Install wasm-pack
|
|
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
- 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: wasm-build
|
|
- name: Build game
|
|
working-directory: game
|
|
run: wasm-pack build --dev --target web -- --no-default-features --features wasm
|
|
# TODO For now, just check that the build works. Later, build fully and package.
|