From f8596dcaf857ae9d23dc9a33c8b95174ad25003e Mon Sep 17 00:00:00 2001 From: Alexander Medvedev Date: Wed, 25 Mar 2026 15:38:12 +0100 Subject: [PATCH] Revert "feat: Add support for multiple CPU targets in Rust workflow (#1707)" This reverts commit 83199db6a1f0e508e09d44e095181f208ebdfac6. --- .github/workflows/rust.yml | 206 ++++++++++++++----------------------- 1 file changed, 79 insertions(+), 127 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 17ad4520f..fa5d097d4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,9 +2,7 @@ name: Cargo Build, Test, and Linting on: push: - branches: [ master ] pull_request: - branches: [ master ] workflow_dispatch: env: @@ -17,171 +15,123 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - toolchain: [stable] + 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] + 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] + 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 - + - name: Clippy (debug) + run: cargo clippy --all-targets --all-features clippy_release: name: Run lints (release) runs-on: ubuntu-latest needs: [machete] strategy: matrix: - toolchain: [stable] + 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 - + - name: Clippy (release) + run: cargo clippy --release --all-targets --all-features build_and_test: - name: Build and test (${{ matrix.os }}, ${{ matrix.arch_variant }}) + name: Build project and test 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 + os: + [ + ubuntu-latest, + ubuntu-24.04-arm, + windows-latest, + windows-11-arm, + macos-latest, + macos-15-intel, + ] + toolchain: + - stable 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 - + - name: Cargo nextest + run: cargo nextest run --verbose + - name: Cargo doctest + run: cargo test --doc --verbose build_release: - name: Build Release (${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.variant }}) + name: Build project in release 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 + os: + [ + ubuntu-latest, + ubuntu-24.04-arm, + windows-latest, + windows-11-arm, + macos-latest, + macos-15-intel, + ] + toolchain: + - stable 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 + - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} + - uses: Swatinem/rust-cache@v2 + - name: Build Release + shell: bash + run: | + if [[ "${{ runner.arch }}" == "X64" ]]; then + export RUSTFLAGS="$RUSTFLAGS -C target-cpu=x86-64-v3" + fi + cargo build --verbose --release + - name: Prepare artifacts + shell: bash + run: | + mkdir -p dist + if [ "${{ runner.os }}" == "Windows" ]; then EXT=".exe"; fi + cp "target/release/pumpkin$EXT" "dist/pumpkin-${{ runner.arch }}-${{ runner.os }}$EXT" + - name: Export executable + uses: actions/upload-artifact@v7 + with: + name: pumpkin-${{ runner.arch }}-${{ runner.os }} + compression-level: 9 + path: dist/pumpkin-* draft_release: permissions: contents: write @@ -190,28 +140,30 @@ jobs: if: github.event_name == 'push' && github.ref == 'refs/heads/master' steps: - uses: actions/checkout@v6 - - uses: actions/download-artifact@v8 + - name: Download prebuilt binary artifacts + uses: actions/download-artifact@v8 with: + pattern: "**/pumpkin-*" 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: | + - name: Generate release notes + run: | + tree dist/ + echo "From commit: $(git rev-parse --short HEAD)" > dist/RELEASE.md + echo "Generated on: $(date -u +"%Y-%m-%d %H:%M") UTC" >> dist/RELEASE.md + cat dist/RELEASE.md + + - name: Update the nightly tag + 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 + git tag --force nightly && git push --force origin tag nightly + + - name: Draft a nightly github release + uses: softprops/action-gh-release@v2 with: + prerelease: true + files: dist/pumpkin* tag_name: nightly name: Nightly Build - prerelease: true body_path: dist/RELEASE.md - files: | - dist/pumpkin-* -