aboutsummaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/ci.yml.disabled58
-rw-r--r--.github/workflows/release.yml241
2 files changed, 0 insertions, 299 deletions
diff --git a/.github/workflows/ci.yml.disabled b/.github/workflows/ci.yml.disabled
deleted file mode 100644
index ad4403e..0000000
--- a/.github/workflows/ci.yml.disabled
+++ /dev/null
@@ -1,58 +0,0 @@
-name: CI
-
-on:
- push:
- pull_request:
- workflow_dispatch:
- workflow_call:
-
-permissions:
- contents: read
-
-jobs:
- test:
- name: Test (${{ matrix.os }}, Rust ${{ matrix.rust }})
- runs-on: ${{ matrix.os }}
- timeout-minutes: 20
- strategy:
- fail-fast: false
- matrix:
- os: [ubuntu-latest, macos-latest, windows-latest]
- rust: [stable]
- steps:
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- with:
- persist-credentials: false
- - name: Install Rust
- run: rustup toolchain install ${{ matrix.rust }} --profile minimal
- - name: Test default dependencies
- run: cargo +${{ matrix.rust }} test --locked
- - name: Test arbitrary-precision JSON compatibility
- run: cargo +${{ matrix.rust }} test --locked --features serde_json/arbitrary_precision
- - name: Test release build
- run: cargo +${{ matrix.rust }} test --release --locked
-
- quality:
- runs-on: ubuntu-latest
- timeout-minutes: 20
- steps:
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- with:
- persist-credentials: false
- - name: Install Rust tools
- run: rustup toolchain install stable --profile minimal --component rustfmt --component clippy
- - name: Test release automation
- run: python3 -B -m unittest discover -s scripts -p 'test_*.py'
- - name: Check formatting
- run: cargo +stable fmt --all -- --check
- - name: Check lints
- run: cargo +stable clippy --all-targets --locked -- -D warnings
- - name: Check feature compatibility lints
- run: cargo +stable clippy --all-targets --locked --features serde_json/arbitrary_precision -- -D warnings
- - name: Verify package
- run: cargo +stable package --locked
- - name: Test packaged crate
- shell: bash
- run: |
- package=$(cargo +stable metadata --no-deps --format-version 1 | python3 -c 'import json, sys; p = json.load(sys.stdin)["packages"][0]; print(p["name"] + "-" + p["version"])')
- cargo +stable test --locked --manifest-path "target/package/$package/Cargo.toml"
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
deleted file mode 100644
index 7f58703..0000000
--- a/.github/workflows/release.yml
+++ /dev/null
@@ -1,241 +0,0 @@
-name: release
-
-on:
- workflow_dispatch:
- inputs:
- version:
- description: Version impact (the first release is 0.1.0 or X.0.0)
- required: true
- default: patch
- type: choice
- options: [minor, patch]
- dry_run:
- description: Build and test artifacts without pushing or publishing
- required: true
- default: true
- type: boolean
-
-concurrency:
- group: release-${{ github.ref_name }}
- cancel-in-progress: false
-
-permissions:
- contents: read
-
-defaults:
- run:
- shell: bash
-
-env:
- RELEASE_RUST: stable
-
-jobs:
- prepare:
- runs-on: ubuntu-24.04
- timeout-minutes: 15
- outputs:
- version: ${{ steps.version.outputs.version }}
- tag: ${{ steps.version.outputs.tag }}
- commit: ${{ steps.version.outputs.commit }}
- base: ${{ steps.version.outputs.base }}
- steps:
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- with:
- fetch-depth: 0
- persist-credentials: false
- - name: Require a release branch
- env:
- REF_TYPE: ${{ github.ref_type }}
- RELEASE_BRANCH: ${{ github.ref_name }}
- run: |
- test "$REF_TYPE" = branch
- python3 -B -c 'import sys; sys.path.insert(0, "scripts"); from release import branch_major; branch_major(sys.argv[1])' "$RELEASE_BRANCH"
- - name: Install Rust
- run: rustup toolchain install "$RELEASE_RUST" --profile minimal
- - name: Select release toolchain
- run: rustup override set "$RELEASE_RUST"
- - name: Test release automation
- run: python3 -B -m unittest discover -s scripts -p 'test_*.py'
- - name: Prepare version and source bundle
- id: version
- env:
- RELEASE_BRANCH: ${{ github.ref_name }}
- IMPACT: ${{ inputs.version }}
- run: |
- python3 -B scripts/release.py prepare --branch "$RELEASE_BRANCH" --impact "$IMPACT" \
- --bundle target/release-source.bundle --output "$GITHUB_OUTPUT"
- - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
- with:
- name: release-source
- path: target/release-source.bundle
- if-no-files-found: error
- retention-days: 7
- overwrite: true
-
- build:
- needs: prepare
- runs-on: ${{ matrix.os }}
- timeout-minutes: 30
- strategy:
- fail-fast: false
- matrix:
- include:
- - os: ubuntu-24.04
- target: x86_64-unknown-linux-musl
- binary: ele
- - os: macos-15
- target: aarch64-apple-darwin
- binary: ele
- - os: windows-latest
- target: x86_64-pc-windows-msvc
- binary: ele.exe
- env:
- TARGET: ${{ matrix.target }}
- BINARY: ${{ matrix.binary }}
- VERSION: ${{ needs.prepare.outputs.version }}
- RELEASE_COMMIT: ${{ needs.prepare.outputs.commit }}
- steps:
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- with:
- persist-credentials: false
- - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
- with:
- name: release-source
- path: target/release-input
- - name: Check out versioned source
- run: |
- git fetch target/release-input/release-source.bundle HEAD
- test "$(git rev-parse FETCH_HEAD)" = "$RELEASE_COMMIT"
- git checkout --detach "$RELEASE_COMMIT"
- - name: Install Rust
- run: rustup toolchain install "$RELEASE_RUST" --profile minimal --target "$TARGET"
- - name: Select release toolchain
- run: rustup override set "$RELEASE_RUST"
- - name: Set macOS deployment target
- if: runner.os == 'macOS'
- run: echo 'MACOSX_DEPLOYMENT_TARGET=11.0' >> "$GITHUB_ENV"
- - name: Test release target
- run: |
- cargo test --locked --target "$TARGET"
- cargo test --locked --target "$TARGET" --features serde_json/arbitrary_precision
- cargo test --release --locked --target "$TARGET"
- - name: Build and check CLI
- run: |
- cargo build --release --locked --target "$TARGET"
- binary="target/$TARGET/release/$BINARY"
- test "$("$binary" --version)" = "ele $VERSION"
- printf '{"n":1}\n{"n":2}\n' | "$binary" 'n > 1' > target/smoke.jsonl
- printf '{"n":2}\n' > target/expected.jsonl
- cmp target/expected.jsonl target/smoke.jsonl
- - name: Verify static Linux executable
- if: runner.os == 'Linux'
- run: |
- readelf -l "target/$TARGET/release/ele" > target/elf-headers
- if grep -q INTERP target/elf-headers; then
- echo 'The Linux executable requires a dynamic loader.' >&2
- exit 1
- fi
- - name: Archive CLI
- if: runner.os != 'Windows'
- run: |
- mkdir -p target/release-dist
- COPYFILE_DISABLE=1 tar -czf "target/release-dist/ele-v$VERSION-$TARGET.tar.gz" \
- -C "target/$TARGET/release" ele -C "$GITHUB_WORKSPACE" LICENSE README.md
- - name: Archive Windows CLI
- if: runner.os == 'Windows'
- run: |
- mkdir -p target/release-dist
- python -m zipfile -c "target/release-dist/ele-v$VERSION-$TARGET.zip" \
- "target/$TARGET/release/$BINARY" LICENSE README.md
- - name: Verify library package
- if: runner.os == 'Linux'
- run: |
- cargo package --locked
- cargo test --locked --manifest-path "target/package/ele-$VERSION/Cargo.toml"
- cp "target/package/ele-$VERSION.crate" target/release-dist/
- - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
- with:
- name: release-assets-${{ matrix.target }}
- path: target/release-dist/*
- if-no-files-found: error
- retention-days: 7
- compression-level: 0
- overwrite: true
-
- publish:
- needs: [prepare, build]
- runs-on: ubuntu-24.04
- timeout-minutes: 15
- permissions:
- contents: write
- env:
- RELEASE_BRANCH: ${{ github.ref_name }}
- VERSION: ${{ needs.prepare.outputs.version }}
- TAG: ${{ needs.prepare.outputs.tag }}
- BASE: ${{ needs.prepare.outputs.base }}
- RELEASE_COMMIT: ${{ needs.prepare.outputs.commit }}
- steps:
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- with:
- fetch-depth: 0
- - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
- with:
- name: release-source
- path: target/release-input
- - name: Check out tested source
- run: |
- git fetch target/release-input/release-source.bundle HEAD
- test "$(git rev-parse FETCH_HEAD)" = "$RELEASE_COMMIT"
- git checkout --detach "$RELEASE_COMMIT"
- - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
- with:
- pattern: release-assets-*
- merge-multiple: true
- path: target/release-dist
- - name: Verify asset set and generate checksums
- run: |
- test -f "target/release-dist/ele-v$VERSION-x86_64-unknown-linux-musl.tar.gz"
- test -f "target/release-dist/ele-v$VERSION-aarch64-apple-darwin.tar.gz"
- test -f "target/release-dist/ele-v$VERSION-x86_64-pc-windows-msvc.zip"
- test -f "target/release-dist/ele-$VERSION.crate"
- test "$(find target/release-dist -maxdepth 1 -type f | wc -l)" -eq 4
- cd target/release-dist
- sha256sum *.tar.gz *.zip *.crate > SHA256SUMS
- sha256sum --check SHA256SUMS
- - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
- with:
- name: release-downloads
- path: target/release-dist/*
- if-no-files-found: error
- retention-days: 7
- compression-level: 0
- overwrite: true
- - name: Push tested release references
- if: ${{ !inputs.dry_run }}
- run: |
- python3 -B scripts/release.py push --branch "$RELEASE_BRANCH" \
- --version "$VERSION" --base "$BASE" --commit "$RELEASE_COMMIT"
- - name: Publish GitHub release
- if: ${{ !inputs.dry_run }}
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
- if draft=$(gh release view "$TAG" --json isDraft --jq '.isDraft'); then
- if test "$draft" != true; then
- echo 'The release is already public; refusing to replace its assets.' >&2
- exit 1
- fi
- else
- gh release create "$TAG" --verify-tag --draft --generate-notes --title "$TAG" --target "$RELEASE_COMMIT"
- fi
- gh release upload "$TAG" target/release-dist/* --clobber
- # REST release-by-tag lookups exclude draft releases.
- release_id=$(gh release view "$TAG" --json databaseId --jq '.databaseId')
- gh api --method PATCH "repos/$GITHUB_REPOSITORY/releases/$release_id" \
- -F draft=false -f make_latest=legacy > /dev/null
- - name: Record result
- env:
- DRY_RUN: ${{ inputs.dry_run }}
- run: |
- printf 'Version: `%s`\n\nCommit: `%s`\n\nDry run: `%s`\n\nDownload the `release-downloads` artifact for the CLI archives, Cargo source package, and SHA256SUMS.\n' \
- "$TAG" "$RELEASE_COMMIT" "$DRY_RUN" >> "$GITHUB_STEP_SUMMARY"