I give up

This commit is contained in:
Alexander Medvedev
2025-08-12 18:05:04 +02:00
parent b6e55cfbd2
commit 308ca77440
2 changed files with 8 additions and 89 deletions

View File

@@ -21,7 +21,6 @@ jobs:
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --check
clippy:
name: Run lints
runs-on: ubuntu-latest
@@ -34,13 +33,12 @@ jobs:
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-targets --all-features
build_and_test:
name: Build project and test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest]
toolchain:
- stable
steps:
@@ -48,106 +46,26 @@ jobs:
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
- run: cargo test --verbose
# Job to create the release draft. This runs first.
github-release-draft:
name: 'Create GitHub Release Draft'
runs-on: ubuntu-latest
# This job only runs on a successful push to the master branch
if: success() && github.ref == 'refs/heads/master'
outputs:
release-id: ${{ steps.create-release.outputs.release-id }}
steps:
- name: Checkout sources
uses: actions/checkout@v5
- name: Create Release Draft
id: create-release
env:
NIGHTLY_REPO: ${{ github.repository_owner }}/pumpkin-commit-builds
GITHUB_TOKEN: ${{ secrets.COMMIT_REPO_TOKEN }}
run: |
RELEASE_TAG="per-commit-${{ github.sha }}"
RELEASE_TITLE="Build ${{ github.sha }}"
REPO_NAME="${{ env.NIGHTLY_REPO }}"
echo "Creating draft release with tag: ${RELEASE_TAG} in repo: ${REPO_NAME}"
# Create the release and get the ID in a single, reliable command
RELEASE_ID=$(gh release create "${RELEASE_TAG}" \
--draft \
--title "${RELEASE_TITLE}" \
--notes "Per-commit build based on ${{ github.repository }}@${{ github.sha }}" \
--repo "${REPO_NAME}")
if [ -z "$RELEASE_ID" ]; then
echo "Failed to create release or retrieve release ID."
exit 1
fi
echo "Release-ID:${RELEASE_ID}"
echo "release-id=${RELEASE_ID}" >> ${GITHUB_OUTPUT}
# Job to build the project in release mode and upload the artifacts
build_release:
name: Build project in release (${{ matrix.os }})
name: Build project in release
runs-on: ${{ matrix.os }}
needs: github-release-draft
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest]
toolchain:
- stable
steps:
- uses: actions/checkout@v5
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
- run: cargo build --verbose --release
- name: Export executable as artifact
- name: Export executable
uses: actions/upload-artifact@v4
with:
name: pumpkin-${{ matrix.os }}
compression-level: 9
path: target/release/pumpkin*
# New job to download and upload the artifacts to the release
upload_release_assets:
name: 'Upload Release Assets'
runs-on: ubuntu-latest
needs: [build_release, github-release-draft]
if: success()
env:
NIGHTLY_REPO: ${{ github.repository_owner }}/pumpkin-commit-builds
steps:
- name: Download all executables
uses: actions/download-artifact@v5
with:
path: ./downloads
- name: Upload Linux executable
env:
GITHUB_TOKEN: ${{ secrets.COMMIT_REPO_TOKEN }}
run: |
gh release upload ${{ needs.github-release-draft.outputs.release-id }} ./downloads/pumpkin-ubuntu-latest/pumpkin --repo ${{ env.NIGHTLY_REPO }}
- name: Upload Windows executable
env:
GITHUB_TOKEN: ${{ secrets.COMMIT_REPO_TOKEN }}
run: |
gh release upload ${{ needs.github-release-draft.outputs.release-id }} ./downloads/pumpkin-windows-latest/pumpkin.exe --repo ${{ env.NIGHTLY_REPO }}
- name: Upload macOS executable
env:
GITHUB_TOKEN: ${{ secrets.COMMIT_REPO_TOKEN }}
run: |
gh release upload ${{ needs.github-release-draft.outputs.release-id }} ./downloads/pumpkin-macos-latest/pumpkin --repo ${{ env.NIGHTLY_REPO }}
- name: Publish as latest
env:
GITHUB_TOKEN: ${{ secrets.COMMIT_REPO_TOKEN }}
RELEASE_ID: ${{ needs.github-release-draft.outputs.release-id }}
run: |
gh api \
--method PATCH \
-H "Accept: application/vnd.github+json" \
"/repos/${NIGHTLY_REPO}/releases/${RELEASE_ID}" \
-F draft=false -F prerelease=true
# Job to run Clippy in release mode
path: target/${{ matrix.target }}/release/pumpkin*
clippy_release:
name: Run lints in release mode
runs-on: ubuntu-latest
@@ -159,4 +77,4 @@ jobs:
- uses: actions/checkout@v5
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --release --all-targets --all-features
- run: cargo clippy --release --all-targets --all-features

View File

@@ -8,6 +8,7 @@ WORKDIR /pumpkin
COPY . /pumpkin
RUN rustup show active-toolchain || rustup toolchain install
RUN rustup component add rustfmt
# build release
RUN --mount=type=cache,sharing=private,target=/pumpkin/target \