zip is frustrating sometimes (always) #33
Workflow file for this run
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: Prepare release | |
| on: | |
| push: | |
| branches: | |
| - "release/**" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| validate: | |
| name: Compute release version | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| prerelease: ${{ steps.version.outputs.prerelease }} | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| with: | |
| token: ${{secrets.GITHUB_TOKEN}} | |
| persist-credentials: false | |
| - name: Parse release version from branch name | |
| id: version | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| branch="${GITHUB_REF_NAME}" | |
| # Accepts: | |
| # release/vX.Y.Z | |
| # release/vX.Y.Z-rc.N | |
| regex='^release/v([0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?)$' | |
| if [[ "$branch" =~ $regex ]]; then | |
| VERSION="${BASH_REMATCH[1]}" | |
| echo "version=${VERSION}" >>"$GITHUB_OUTPUT" | |
| if [[ "$VERSION" == *-rc* ]]; then | |
| echo "prerelease=true" >>"$GITHUB_OUTPUT" | |
| else | |
| echo "prerelease=false" >>"$GITHUB_OUTPUT" | |
| fi | |
| else | |
| echo "::error::branch '$branch' is not a valid release branch (expected release/vX.Y.Z or release/vX.Y.Z-rc.N)" >&2 | |
| exit 1 | |
| fi | |
| - name: Validate crate versions | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| EXPECTED_VERSION="${{ steps.version.outputs.version }}" | |
| CRATES=( | |
| graft-proto | |
| graft-core | |
| graft-tracing | |
| graft-client | |
| graft-sqlite | |
| graft-sqlite-extension | |
| graft-server | |
| ) | |
| for crate in "${CRATES[@]}"; do | |
| CRATE_VERSION="$(cargo pkgid $crate | cut -d "#" -f2)" | |
| if [[ "$CRATE_VERSION" != "$EXPECTED_VERSION" ]]; then | |
| echo "::error::crate '$crate' version '$CRATE_VERSION' does not match expected version '$EXPECTED_VERSION'" >&2 | |
| exit 1 | |
| fi | |
| done | |
| crates: | |
| name: Verify crates | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang libclang-dev llvm mold libncurses-dev build-essential fuse3 libfuse3-dev | |
| - uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # v1 | |
| with: | |
| toolchain: 1.86 | |
| components: clippy, rustfmt | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| with: | |
| token: ${{secrets.GITHUB_TOKEN}} | |
| persist-credentials: false | |
| - name: Build | |
| run: cargo build --release | |
| docker: | |
| name: Build docker images | |
| runs-on: ubuntu-24.04 | |
| needs: [validate] | |
| permissions: | |
| contents: read | |
| packages: write | |
| outputs: | |
| metastore_tag: ${{ steps.metastore_meta.outputs.tags }} | |
| pagestore_tag: ${{ steps.pagestore_meta.outputs.tags }} | |
| env: | |
| DOCKER_BUILD_SUMMARY: false | |
| steps: | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@18ce135bb5112fa8ce4ed6c17ab05699d7f3a5e0 # v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| with: | |
| token: ${{secrets.GITHUB_TOKEN}} | |
| persist-credentials: false | |
| - name: Docker metastore meta | |
| id: metastore_meta | |
| uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5 | |
| with: | |
| images: | | |
| ghcr.io/orbitinghail/metastore | |
| tags: | | |
| type=sha,format=long | |
| - name: Docker pagestore meta | |
| id: pagestore_meta | |
| uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5 | |
| with: | |
| images: | | |
| ghcr.io/orbitinghail/pagestore | |
| tags: | | |
| type=sha,format=long | |
| - name: Build and push metastore image | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.metastore_meta.outputs.tags }} | |
| labels: ${{ steps.metastore_meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| platforms: linux/amd64,linux/arm64 | |
| target: metastore | |
| - name: Build and push pagestore image | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.pagestore_meta.outputs.tags }} | |
| labels: ${{ steps.pagestore_meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| platforms: linux/amd64,linux/arm64 | |
| target: pagestore | |
| build: | |
| strategy: | |
| matrix: | |
| platform: | |
| - runs-on: ubuntu-24.04 | |
| features: dynamic | |
| targets: | |
| - x86_64-unknown-linux-gnu | |
| - aarch64-unknown-linux-gnu | |
| artifact-name: dynamic-linux | |
| artifacts: | | |
| target/x86_64-unknown-linux-gnu/release/libgraft.so | |
| target/aarch64-unknown-linux-gnu/release/libgraft.so | |
| - runs-on: windows-2022 | |
| features: dynamic | |
| targets: | |
| - x86_64-pc-windows-msvc | |
| - aarch64-pc-windows-msvc | |
| artifact-name: dynamic-windows | |
| artifacts: | | |
| target/x86_64-pc-windows-msvc/release/graft.dll | |
| target/aarch64-pc-windows-msvc/release/graft.dll | |
| - runs-on: macos-14 | |
| features: dynamic | |
| targets: | |
| - x86_64-apple-darwin | |
| - aarch64-apple-darwin | |
| artifact-name: dynamic-macos | |
| artifacts: | | |
| target/x86_64-apple-darwin/release/libgraft.dylib | |
| target/aarch64-apple-darwin/release/libgraft.dylib | |
| - runs-on: macos-14 | |
| features: static | |
| targets: | |
| - aarch64-apple-ios | |
| - aarch64-apple-ios-sim | |
| artifact-name: static-ios | |
| artifacts: | | |
| target/aarch64-apple-ios/release/libgraft.a | |
| target/aarch64-apple-ios-sim/release/libgraft.a | |
| name: Building ${{ matrix.platform.artifact-name }} artifact | |
| runs-on: ${{ matrix.platform.runs-on }} | |
| permissions: | |
| contents: read | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: system dependencies | |
| if: startsWith(matrix.platform.runs-on, 'ubuntu') | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y mold libclang-dev clang gcc-aarch64-linux-gnu | |
| - uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # v1 | |
| with: | |
| toolchain: 1.86 | |
| targets: ${{ join(matrix.platform.targets, ',') }} | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| with: | |
| token: ${{secrets.GITHUB_TOKEN}} | |
| persist-credentials: false | |
| - name: Pre-build osx | |
| if: startsWith(matrix.platform.runs-on, 'macos') | |
| run: | | |
| set -euo pipefail | |
| echo "LIBCLANG_PATH=$(brew --prefix llvm@15)/lib" >> $GITHUB_ENV | |
| - name: Static Rustflags | |
| if: matrix.platform.features == 'static' | |
| run: | | |
| set -euo pipefail | |
| echo "RUSTFLAGS=-C link-arg=-Wl,-undefined,dynamic_lookup" >> $GITHUB_ENV | |
| - name: Build libgraft | |
| run: | | |
| for target in ${{ join(matrix.platform.targets, ' ') }}; do | |
| cargo build --release \ | |
| --no-default-features \ | |
| --features precept/disabled,${{ matrix.platform.features }} \ | |
| --package graft-sqlite-extension \ | |
| --target $target | |
| done | |
| - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: ${{ matrix.platform.artifact-name }} | |
| path: ${{ matrix.platform.artifacts }} | |
| if-no-files-found: error | |
| retention-days: 3 | |
| build-ios-universal: | |
| runs-on: macos-15 | |
| needs: [build] | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| with: | |
| token: ${{secrets.GITHUB_TOKEN}} | |
| persist-credentials: false | |
| - name: Download artifacts | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| name: static-ios | |
| path: input/ | |
| - name: build ios universal library | |
| run: | | |
| set -euo pipefail | |
| xcodebuild -create-xcframework \ | |
| -library input/aarch64-apple-ios/release/libgraft.a \ | |
| -headers crates/graft-sqlite-extension/include \ | |
| -library input/aarch64-apple-ios-sim/release/libgraft.a \ | |
| -headers crates/graft-sqlite-extension/include \ | |
| -output libgraft.xcframework | |
| - name: Upload universal library artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: libgraft.xcframework | |
| path: libgraft.xcframework | |
| package: | |
| runs-on: ubuntu-24.04 | |
| needs: [docker, build, build-ios-universal, validate, crates] | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| with: | |
| token: ${{secrets.GITHUB_TOKEN}} | |
| persist-credentials: false | |
| - name: system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y tree | |
| - name: Install just | |
| uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3 | |
| - name: Install sqlite-dist | |
| run: | | |
| # curl -L https://github.com/asg017/sqlite-dist/releases/download/v0.0.1-alpha.17/sqlite-dist-x86_64-unknown-linux-gnu.tar.xz \ | |
| # | tar xfJ - --strip-components 1 sqlite-dist-x86_64-unknown-linux-gnu/sqlite-dist | |
| curl -L https://github.com/carlsverre/sqlite-dist/releases/download/v0.1.0-prerelease.1/sqlite-dist > sqlite-dist | |
| chmod +x sqlite-dist | |
| - name: Download dynamic artifacts | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| pattern: dynamic-* | |
| path: builds/ | |
| merge-multiple: true | |
| - name: Reorganize build artifacts | |
| run: | | |
| mkdir -p dist/{linux,windows,macos}-{x86_64,aarch64} | |
| mv builds/x86_64-unknown-linux-gnu/release/libgraft.so dist/linux-x86_64/libgraft.so | |
| mv builds/aarch64-unknown-linux-gnu/release/libgraft.so dist/linux-aarch64/libgraft.so | |
| mv builds/x86_64-pc-windows-msvc/release/graft.dll dist/windows-x86_64/graft.dll | |
| mv builds/aarch64-pc-windows-msvc/release/graft.dll dist/windows-aarch64/graft.dll | |
| mv builds/x86_64-apple-darwin/release/libgraft.dylib dist/macos-x86_64/libgraft.dylib | |
| mv builds/aarch64-apple-darwin/release/libgraft.dylib dist/macos-aarch64/libgraft.dylib | |
| - name: Run SQLite dist | |
| run: | | |
| VERSION=${{ needs.validate.outputs.version }} | |
| ./sqlite-dist ./sqlite-dist.toml --input dist/ --output distx/ --version ${VERSION} | |
| - name: Download ios-universal libgraft.xcframework artifact | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| name: libgraft.xcframework | |
| path: dist/libgraft.xcframework | |
| - name: Package archives | |
| run: just run package-archives | |
| - name: Add metadata to distx | |
| run: | | |
| echo "${{ needs.docker.outputs.metastore_tag }}" > distx/metastore_tag | |
| echo "${{ needs.docker.outputs.pagestore_tag }}" > distx/pagestore_tag | |
| echo "${{ needs.validate.outputs.version }}" > distx/version | |
| - name: Print distribution tree | |
| run: tree distx/ | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2 | |
| with: | |
| name: v${{ needs.validate.outputs.version }} | |
| tag_name: v${{ needs.validate.outputs.version }} | |
| prerelease: ${{ needs.validate.outputs.prerelease }} | |
| make_latest: ${{ needs.validate.outputs.prerelease == 'false' }} | |
| draft: true | |
| generate_release_notes: true | |
| fail_on_unmatched_files: true | |
| files: distx/archives/* | |
| - name: Upload distx | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: distx | |
| path: distx/ | |
| retention-days: 3 |