-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI enhancements: .app bundling, build .wasm (#486)
Updates to enhance GitHub Actions continuous integration: * ci: add macOS app bundle packaging using cargo-bundle, closes #352 based on https://github.com/EndlessSkyCommunity/ESLauncher2/blob/master/Cargo.toml * ci: add web target, building using wasm-pack (for #446) * ci: refactor and cleanup targets, split out instead of using matrix * main: save config in consistent OS-specific dirs::config_dir() Instead of storing and loading in the current working directory, change to a consistent dedicated configuration directory. This is necessary for .app launching since cwd is set to /. To preserve compatibility with existing installations, if conf.cfg exists in cwd then it will be used instead, but otherwise we will use the operating system specific config dirs: // Lin: Some(/home/alice/.config) // Win: Some(C:\Users\Alice\AppData\Roaming) // Mac: Some(/Users/Alice/Library/Application Support) * macos: add icons based on screenshotted logo * macos: add Cmd-Q to quit
- Loading branch information
Showing
6 changed files
with
220 additions
and
29 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,31 +3,93 @@ on: | |
push: | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: | ||
- windows-latest | ||
- ubuntu-latest | ||
- macos-latest | ||
fail-fast: true | ||
linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
# TODO: refactor toolchain version | ||
toolchain: 1.49.0 | ||
components: clippy, rustfmt | ||
default: true | ||
- name: Install dependencies | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libxcb-composite0-dev | ||
- name: Build binary | ||
run: | | ||
cargo build --verbose --release | ||
- name: Run clippy | ||
uses: actions-rs/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
args: --all-targets -- -D warnings | ||
- name: Check formatting | ||
run: cargo fmt --all -- --check | ||
- name: Upload binary | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: stevenarella-linux | ||
path: target/release/stevenarella | ||
- name: Release binary | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
stevenarella* | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: 1.49.0 | ||
components: clippy, rustfmt | ||
default: true | ||
- name: Build binary | ||
run: | | ||
cargo build --verbose --release | ||
- name: Run clippy | ||
uses: actions-rs/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
args: --all-targets -- -D warnings | ||
- name: Check formatting | ||
run: cargo fmt --all -- --check | ||
- name: Upload binary | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: stevenarella.exe | ||
path: target/release/stevenarella.exe | ||
- name: Release binary | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
target/release/stevenarella.exe | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
macos: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: 1.49.0 | ||
components: clippy, rustfmt | ||
default: true | ||
- name: Build binary | ||
run: | | ||
cargo build --verbose --release | ||
chmod a+x target/release/stevenarella | ||
env: | ||
MACOSX_DEPLOYMENT_TARGET: 10.14 | ||
- name: Run clippy | ||
|
@@ -37,24 +99,59 @@ jobs: | |
args: --all-targets -- -D warnings | ||
- name: Check formatting | ||
run: cargo fmt --all -- --check | ||
- name: Move binary | ||
- name: Package binary | ||
run: | | ||
if [[ ${{ matrix.os }} == windows ]]; then | ||
mv target/release/stevenarella.exe stevenarella-${{ matrix.os }}.exe | ||
else | ||
mv target/release/stevenarella stevenarella-${{ matrix.os }} | ||
fi | ||
shell: bash | ||
cargo install cargo-bundle | ||
cargo bundle --release | ||
chmod a+x target/release/bundle/osx/Stevenarella.app/Contents/MacOS/stevenarella | ||
cd target/release/bundle/osx | ||
zip -r Stevenarella.app.zip Stevenarella.app | ||
- name: Upload binary | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: stevenarella-${{ matrix.os }} | ||
path: stevenarella* | ||
name: Stevenarella.app.zip | ||
path: target/release/bundle/osx/Stevenarella.app.zip | ||
- name: Release binary | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
stevenarella* | ||
target/release/bundle/osx/Stevenarella.app.zip | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
web: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
# TODO: refactor toolchain version | ||
toolchain: 1.49.0 | ||
components: clippy, rustfmt | ||
default: true | ||
- name: Install wasm-pack | ||
uses: jetli/[email protected] | ||
with: | ||
version: 'latest' | ||
- name: Build binary | ||
run: | | ||
rustup target add wasm32-unknown-unknown | ||
cargo install wasm-bindgen-cli | ||
wasm-pack build --dev | ||
- name: Upload binary | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: stevenarella.wasm | ||
path: target/wasm32-unknown-unknown/debug/stevenarella.wasm | ||
# TODO: npm bundle? or only the .wasm | ||
- name: Release binary | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
target/wasm32-unknown-unknown/debug/stevenarella.wasm | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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