mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
* Enhance CI with x86-64-v2 build and release notes Add build job for x86-64-v2 architecture and update release process. Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com> * Enhance CI workflow for x86-64 architecture support Updated CI workflow to support additional x86-64 architectures and removed deprecated build job for x86-64-v2. Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com> * Refactor Rust CI workflow with new build steps Refactor CI workflow to simplify architecture and improve clarity. Added new build steps for standard, x86-64-v2, and x86-64-v3 releases. Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com> * add macOS Intel x86-64-v3 * Add x86-64-v4 Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com> * treatment for OCD Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com> * 0 Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com> * rollback Removed x86-64-v4 architecture from the workflow and adjusted related steps for x86-64-v2 and x86-64-v3. Updated comments and artifact names accordingly. Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com> * Refactor CI workflow for Rust project Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com> * Refactor CI workflow for Rust with additional checks Updated CI workflow for Rust project to include formatting checks, unused dependency detection, and enhanced build and test steps across multiple platforms and architectures. Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com> * Update GitHub Actions workflow for Rust project Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com> * Upgrade checkout action from v4 to v6 Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com> * Update rust.yml Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com> * Update GitHub Actions workflow for Rust Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com> * Update install-action version in rust.yml Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com> * Update rust.yml Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com> --------- Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com>
218 lines
6.6 KiB
YAML
218 lines
6.6 KiB
YAML
name: Cargo Build, Test, and Linting
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
branches: [ master ]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
RUSTFLAGS: "-Dwarnings"
|
|
|
|
jobs:
|
|
format:
|
|
name: Check formatting
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
toolchain: [stable]
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
|
- run: rustup component add rustfmt
|
|
- uses: Swatinem/rust-cache@v2
|
|
- run: cargo fmt --check
|
|
|
|
machete:
|
|
name: Detect unused dependencies
|
|
runs-on: ubuntu-latest
|
|
needs: [format]
|
|
strategy:
|
|
matrix:
|
|
toolchain: [stable]
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
|
- uses: bnjbvr/cargo-machete@main
|
|
|
|
clippy_debug:
|
|
name: Run lints (debug)
|
|
runs-on: ubuntu-latest
|
|
needs: [machete]
|
|
strategy:
|
|
matrix:
|
|
toolchain: [stable]
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
|
- run: rustup component add clippy
|
|
- uses: Swatinem/rust-cache@v2
|
|
- run: cargo clippy --all-targets --all-features
|
|
|
|
clippy_release:
|
|
name: Run lints (release)
|
|
runs-on: ubuntu-latest
|
|
needs: [machete]
|
|
strategy:
|
|
matrix:
|
|
toolchain: [stable]
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
|
- run: rustup component add clippy
|
|
- uses: Swatinem/rust-cache@v2
|
|
- run: cargo clippy --release --all-targets --all-features
|
|
|
|
build_and_test:
|
|
name: Build and test (${{ matrix.os }}, ${{ matrix.arch_variant }})
|
|
runs-on: ${{ matrix.os }}
|
|
needs: [clippy_debug, clippy_release]
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-latest, macos-15-intel]
|
|
arch_variant: [standard, x86-64-v3]
|
|
toolchain: [stable]
|
|
exclude:
|
|
- os: ubuntu-24.04-arm
|
|
arch_variant: x86-64-v3
|
|
- os: windows-11-arm
|
|
arch_variant: x86-64-v3
|
|
- os: macos-latest
|
|
arch_variant: x86-64-v3
|
|
- os: macos-15-intel
|
|
arch_variant: standard
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
|
- uses: taiki-e/install-action@nextest
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Set CPU flags
|
|
if: matrix.arch_variant != 'standard'
|
|
shell: bash
|
|
run: |
|
|
echo "RUSTFLAGS=-C target-cpu=${{ matrix.arch_variant }}" >> "$GITHUB_ENV"
|
|
- run: cargo nextest run --verbose
|
|
- run: cargo test --doc --verbose
|
|
|
|
build_release:
|
|
name: Build Release (${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.variant }})
|
|
runs-on: ${{ matrix.os }}
|
|
needs: [build_and_test]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
platform: linux
|
|
arch: x86_64
|
|
variant: standard
|
|
bin: pumpkin
|
|
- os: ubuntu-latest
|
|
platform: linux
|
|
arch: x86_64
|
|
variant: x86-64-v3
|
|
bin: pumpkin
|
|
- os: ubuntu-24.04-arm
|
|
platform: linux
|
|
arch: aarch64
|
|
variant: standard
|
|
bin: pumpkin
|
|
- os: windows-latest
|
|
platform: windows
|
|
arch: x86_64
|
|
variant: standard
|
|
bin: pumpkin.exe
|
|
- os: windows-latest
|
|
platform: windows
|
|
arch: x86_64
|
|
variant: x86-64-v3
|
|
bin: pumpkin.exe
|
|
- os: windows-11-arm
|
|
platform: windows
|
|
arch: aarch64
|
|
variant: standard
|
|
bin: pumpkin.exe
|
|
- os: macos-latest
|
|
platform: macos
|
|
arch: aarch64
|
|
variant: standard
|
|
bin: pumpkin
|
|
- os: macos-15-intel
|
|
platform: macos
|
|
arch: x86_64
|
|
variant: x86-64-v3
|
|
bin: pumpkin
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: Install Rust and set flags
|
|
shell: bash
|
|
run: |
|
|
rustup update stable && rustup default stable
|
|
if [ "${{ matrix.variant }}" != "standard" ]; then
|
|
echo "RUSTFLAGS=-C target-cpu=${{ matrix.variant }}" >> "$GITHUB_ENV"
|
|
fi
|
|
- uses: Swatinem/rust-cache@v2
|
|
- run: cargo build --release --verbose
|
|
- name: Verify binary
|
|
shell: bash
|
|
run: |
|
|
if [ ! -f "target/release/${{ matrix.bin }}" ]; then
|
|
echo "Binary not found"; ls -la target/release/; exit 1
|
|
fi
|
|
- name: Prepare artifact with clean name
|
|
shell: bash
|
|
run: |
|
|
name="pumpkin-${{ matrix.platform }}-${{ matrix.arch }}"
|
|
if [ "${{ matrix.variant }}" != "standard" ]; then
|
|
suffix="${{ matrix.variant }}"
|
|
suffix="${suffix#x86-64-}"
|
|
name="$name-$suffix"
|
|
fi
|
|
if [ "${{ matrix.platform }}" = "windows" ]; then
|
|
name="$name.exe"
|
|
fi
|
|
mkdir -p dist
|
|
cp "target/release/${{ matrix.bin }}" "dist/$name"
|
|
- uses: actions/upload-artifact@v7
|
|
with:
|
|
name: release-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.variant }}
|
|
path: dist/*
|
|
if-no-files-found: error
|
|
compression-level: 9
|
|
|
|
draft_release:
|
|
permissions:
|
|
contents: write
|
|
needs: [build_release]
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
path: dist/
|
|
pattern: release-*
|
|
merge-multiple: true
|
|
- run: find dist/ -type f | sort
|
|
- run: |
|
|
echo "# Nightly Build" > dist/RELEASE.md
|
|
echo "Commit: $(git rev-parse --short HEAD)" >> dist/RELEASE.md
|
|
echo "Date: $(date -u +'%Y-%m-%d %H:%M UTC')" >> dist/RELEASE.md
|
|
- run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git tag -f nightly
|
|
git push origin :nightly 2>/dev/null || true
|
|
git push origin refs/tags/nightly
|
|
- uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: nightly
|
|
name: Nightly Build
|
|
prerelease: true
|
|
body_path: dist/RELEASE.md
|
|
files: |
|
|
dist/pumpkin-*
|
|
|