Skip to content

ci(actions): update actions/checkout to v4 #171

ci(actions): update actions/checkout to v4

ci(actions): update actions/checkout to v4 #171

Workflow file for this run

name: โš™๏ธ๐Ÿš€
on:
pull_request:
workflow_dispatch:
push:
branches: [main]
tags: ["*"]
concurrency:
group: ci-cd-${{ github.ref }}
cancel-in-progress: true
jobs:
code-quality:
name: ๐Ÿฆ€ Code Quality
runs-on: ubuntu-latest
steps:
- name: ๐Ÿ›Ž๏ธ Checkout
uses: actions/checkout@v4.1.0
- name: ๐Ÿฆ€ Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: โ™ป๏ธ Manage Cache
uses: actions/cache@v3.3.1
with:
path: |
~/.cargo/
target/
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
cargo-${{ runner.os }}-
- name: ๐ŸŽจ Check Formatting
run: cargo fmt --check --all
- name: ๐Ÿ“Ž Check Linting
run: cargo clippy --locked --all-targets --all-features -- -D warnings
- name: ๐Ÿงช Run Tests
run: cargo test --locked --all-targets --all-features
build-artifacts:
name: โš™๏ธ Build (${{ matrix.artifact-name }})
needs: [code-quality]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
artifact-name: chara-x86_64-unknown-linux-gnu
cargo-target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
artifact-name: chara-aarch64-unknown-linux-gnu
cargo-target: aarch64-unknown-linux-gnu
linker: gcc-aarch64-linux-gnu
- os: ubuntu-latest
artifact-name: chara-aarch64-linux-android
cargo-target: aarch64-linux-android
- os: macos-latest
artifact-name: chara-x86_64-apple-darwin
cargo-target: x86_64-apple-darwin
- os: windows-latest
artifact-name: chara-x86_64-pc-windows-gnu
cargo-target: x86_64-pc-windows-gnu
steps:
- name: ๐Ÿ›Ž๏ธ Checkout
uses: actions/checkout@v4.1.0
- name: ๐Ÿฆ€ Install Rust
uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.cargo-target }}
- name: ๐Ÿ”— Install Linker packages
if: matrix.linker != ''
run: |
sudo apt-get -y update
sudo apt-get -y install ${{ matrix.linker }}
- name: ๐Ÿ›ฃ๏ธ Set Linker Path
if: matrix.cargo-target == 'aarch64-linux-android'
run: echo "$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin" >> $GITHUB_PATH
- name: โ™ป๏ธ Manage Build Cache
uses: actions/cache@v3.3.1
with:
path: |
~/.cargo/
target/
key: cargo-${{ matrix.artifact-name }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-${{ matrix.artifact-name }}-${{ hashFiles('**/Cargo.lock') }}
cargo-${{ matrix.artifact-name }}-
- name: ๐Ÿ› ๏ธ Build Binary
run: cargo build --locked --release --target ${{ matrix.cargo-target }}
- name: ๐Ÿ“ Setup Archive + Extension
shell: bash
run: |
mkdir -p staging
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cp "target/${{ matrix.cargo-target }}/release/chara.exe" staging/
cd staging
7z a ../${{ matrix.artifact-name }}.zip *
else
cp "target/${{ matrix.cargo-target }}/release/chara" staging/
cd staging
zip ../${{ matrix.artifact-name }}.zip *
fi
- name: โฌ†๏ธ Upload Binary Artifact
uses: actions/upload-artifact@v3.1.2
with:
name: ${{ matrix.artifact-name }}
path: ${{ matrix.artifact-name }}.zip
retention-days: 5
release:
name: ๐Ÿš€ Create Release
if: github.ref_type == 'tag'
needs: [build-artifacts]
runs-on: ubuntu-latest
steps:
- name: โฌ‡๏ธ Download All Binary Artifacts
uses: actions/download-artifact@v3.0.2
- name: ๐Ÿ—ƒ๏ธCreate Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
generate_release_notes: true
files: chara-*/*.zip