Update Rust crate image to 0.25.0 #788
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 | |
on: | |
push: | |
jobs: | |
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.64.0 | |
components: clippy, rustfmt | |
default: true | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libxcb-composite0-dev | |
- name: Build binary | |
run: | | |
cargo build --verbose --release | |
- name: Check workflow permissions | |
id: check_permissions | |
uses: scherermichael-oss/action-has-permission@1.0.6 | |
with: | |
required-permission: write | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run clippy action to produce annotations | |
uses: actions-rs/clippy-check@v1.0.7 | |
if: steps.check_permissions.outputs.has-permission | |
with: | |
args: --all-targets -- -D warnings | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run clippy manually without annotations | |
if: ${{ !steps.check_permissions.outputs.has-permission }} | |
run: cargo clippy --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.64.0 | |
components: clippy, rustfmt | |
default: true | |
- name: Build binary | |
run: | | |
cargo build --verbose --release | |
- name: Check workflow permissions | |
id: check_permissions | |
uses: scherermichael-oss/action-has-permission@1.0.6 | |
with: | |
required-permission: write | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run clippy action to produce annotations | |
uses: actions-rs/clippy-check@v1.0.7 | |
if: steps.check_permissions.outputs.has-permission | |
with: | |
args: --all-targets -- -D warnings | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run clippy manually without annotations | |
if: ${{ !steps.check_permissions.outputs.has-permission }} | |
run: cargo clippy --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.64.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: Check workflow permissions | |
id: check_permissions | |
uses: scherermichael-oss/action-has-permission@1.0.6 | |
with: | |
required-permission: write | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run clippy action to produce annotations | |
uses: actions-rs/clippy-check@v1.0.7 | |
if: steps.check_permissions.outputs.has-permission | |
with: | |
args: --all-targets -- -D warnings | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run clippy manually without annotations | |
if: ${{ !steps.check_permissions.outputs.has-permission }} | |
run: cargo clippy --all-targets -- -D warnings | |
- name: Check formatting | |
run: cargo fmt --all -- --check | |
- name: Package binary | |
run: | | |
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.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: | | |
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.64.0 | |
components: clippy, rustfmt | |
default: true | |
- name: Install wasm-pack | |
uses: jetli/wasm-pack-action@v0.3.0 | |
with: | |
version: 'v0.10.0' | |
- 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 }} | |