fix: many bugs #10519
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: Cargo Build, Test, and Linting | |
| on: | |
| push: | |
| pull_request: | |
| 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@v7 | |
| with: | |
| submodules: recursive | |
| - 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 | |
| strategy: | |
| matrix: | |
| toolchain: | |
| - stable | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} | |
| - uses: bnjbvr/cargo-machete@main | |
| clippy_debug: | |
| name: Run lints (debug) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| toolchain: | |
| - stable | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} | |
| - run: rustup component add clippy | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Clippy (debug) | |
| run: cargo clippy --all-targets --all-features | |
| clippy_release: | |
| name: Run lints (release) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| toolchain: | |
| - stable | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} | |
| - run: rustup component add clippy | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Clippy (release) | |
| run: cargo clippy --release --all-targets --all-features | |
| build_and_test: | |
| name: Build project and test | |
| runs-on: ${{ matrix.os }} | |
| needs: [format, machete, clippy_debug, clippy_release] | |
| strategy: | |
| matrix: | |
| os: | |
| [ | |
| ubuntu-latest, | |
| ubuntu-26.04-arm, | |
| windows-latest, | |
| windows-11-arm, | |
| macos-latest, | |
| ] | |
| toolchain: | |
| - stable | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} | |
| - uses: taiki-e/install-action@nextest | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Cargo nextest | |
| run: cargo nextest run --verbose | |
| - name: Cargo doctest | |
| run: cargo test --doc --verbose | |
| build_release: | |
| name: Build project in release | |
| runs-on: ${{ matrix.os }} | |
| needs: [build_and_test] | |
| strategy: | |
| matrix: | |
| os: | |
| [ | |
| ubuntu-latest, | |
| ubuntu-26.04-arm, | |
| windows-latest, | |
| windows-11-arm, | |
| macos-latest, | |
| ] | |
| toolchain: | |
| - stable | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install musl-tools (Linux only) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools | |
| - name: Build Release | |
| shell: bash | |
| run: | | |
| cargo build --verbose --release | |
| if [ "${{ runner.os }}" == "Linux" ]; then | |
| if [ "${{ runner.arch }}" == "X64" ]; then | |
| TARGET="x86_64-unknown-linux-musl" | |
| elif [ "${{ runner.arch }}" == "ARM64" ]; then | |
| TARGET="aarch64-unknown-linux-musl" | |
| fi | |
| rustup target add "$TARGET" | |
| cargo build --verbose --release --target "$TARGET" | |
| fi | |
| - name: Prepare artifacts | |
| shell: bash | |
| run: | | |
| mkdir -p dist | |
| EXT="" | |
| if [ "${{ runner.os }}" == "Windows" ]; then EXT=".exe"; fi | |
| cp "target/release/pumpkin$EXT" "dist/pumpkin-${{ runner.arch }}-${{ runner.os }}$EXT" | |
| if [ "${{ runner.os }}" == "Linux" ]; then | |
| if [ "${{ runner.arch }}" == "X64" ]; then | |
| TARGET="x86_64-unknown-linux-musl" | |
| elif [ "${{ runner.arch }}" == "ARM64" ]; then | |
| TARGET="aarch64-unknown-linux-musl" | |
| fi | |
| cp "target/$TARGET/release/pumpkin" "dist/pumpkin-${{ runner.arch }}-${{ runner.os }}-musl" | |
| fi | |
| - 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 | |
| needs: [build_release] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - name: Download prebuilt binary artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: "**/pumpkin-*" | |
| path: dist/ | |
| merge-multiple: true | |
| - 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 --force nightly && git push --force origin tag nightly | |
| - name: Draft a nightly github release | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| prerelease: true | |
| files: dist/pumpkin* | |
| tag_name: nightly | |
| name: Nightly Build | |
| body_path: dist/RELEASE.md |