ci(actions): update actions/checkout action to v4.3.1
#375
This file contains hidden or 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: โ๏ธ๐ | |
| 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@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - name: ๐ฆ Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy, rustfmt | |
| - name: โป๏ธ Manage Cache | |
| uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.2.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@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - 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@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.2.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@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 | |
| 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@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
| - name: ๐๏ธCreate Release | |
| uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| generate_release_notes: true | |
| files: chara-*/*.zip |