Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions .github/workflows/build-gems.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Build gems
on:
workflow_call:
inputs:
release:
description: "Pass --release to bin/test-gem-build (skip timestamp version)"
type: boolean
default: false
artifact_prefix:
description: "Prefix for artifact names (e.g., 'release-v2.9.1-')"
type: string
default: ""
ref:
description: "Git ref to check out (e.g., a version tag). Defaults to the caller's ref."
type: string
default: ""

permissions:
contents: read

jobs:
native_setup:
name: "Setup for native gem build"
runs-on: ubuntu-latest
outputs:
rcd_image_version: ${{ steps.rcd_image_version.outputs.rcd_image_version }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ inputs.ref || github.ref }}
persist-credentials: false
- uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ports/archives
key: ports-archives-tarball-${{ hashFiles('ext/sqlite3/extconf.rb','dependencies.yml') }}
- uses: ruby/setup-ruby@dffb23f65a78bba8db45d387d5ea1bbd6be3ef18 # v1.293.0
with:
ruby-version: "4.0"
bundler-cache: true
- run: bundle exec ruby ./ext/sqlite3/extconf.rb --download-dependencies
- id: rcd_image_version
run: bundle exec ruby -e 'require "rake_compiler_dock"; puts "rcd_image_version=#{RakeCompilerDock::IMAGE_VERSION}"' >> $GITHUB_OUTPUT

build_source_gem:
name: "build source"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ inputs.ref || github.ref }}
persist-credentials: false
- uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ports/archives
key: ports-archives-tarball-${{ hashFiles('ext/sqlite3/extconf.rb','dependencies.yml') }}
- uses: ruby/setup-ruby@dffb23f65a78bba8db45d387d5ea1bbd6be3ef18 # v1.293.0
with:
ruby-version: "4.0"
bundler-cache: true
- run: ./bin/test-gem-build ${RELEASE_FLAG} gems ruby
env:
RELEASE_FLAG: ${{ inputs.release && '--release' || '' }}
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: "${{ inputs.artifact_prefix }}source-gem"
path: gems
retention-days: 1

build_native_gem:
needs: native_setup
name: "build native"
strategy:
fail-fast: false
matrix:
platform:
- aarch64-linux-gnu
- aarch64-linux-musl
- arm-linux-gnu
- arm-linux-musl
- arm64-darwin
- x64-mingw-ucrt
- x86-linux-gnu
- x86-linux-musl
- x86_64-darwin
- x86_64-linux-gnu
- x86_64-linux-musl
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ inputs.ref || github.ref }}
persist-credentials: false
- uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ports/archives
key: ports-archives-tarball-${{ hashFiles('ext/sqlite3/extconf.rb', 'dependencies.yml') }}
- run: |
docker run --rm -v $PWD:/work -w /work \
ghcr.io/rake-compiler/rake-compiler-dock-image:${RCD_IMAGE_VERSION}-mri-${{ matrix.platform }} \
./bin/test-gem-build ${RELEASE_FLAG} gems ${{ matrix.platform }}
env:
RCD_IMAGE_VERSION: ${{ needs.native_setup.outputs.rcd_image_version }}
RELEASE_FLAG: ${{ inputs.release && '--release' || '' }}
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: "${{ inputs.artifact_prefix }}cruby-${{ matrix.platform }}-gem"
path: gems
retention-days: 1
97 changes: 10 additions & 87 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,55 +194,17 @@ jobs:
- run: bundle exec rake test:valgrind

#
# gem tests (source and native)
# gem build (source and native)
#
native_setup:
build_gems:
needs: basic
name: "Setup for native gem tests"
runs-on: ubuntu-latest
outputs:
rcd_image_version: ${{ steps.rcd_image_version.outputs.rcd_image_version }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 # zizmor: ignore[cache-poisoning]
with:
path: ports/archives
key: ports-archives-tarball-${{ hashFiles('ext/sqlite3/extconf.rb','dependencies.yml') }}
- uses: ruby/setup-ruby@dffb23f65a78bba8db45d387d5ea1bbd6be3ef18 # v1.293.0
with:
ruby-version: "4.0"
bundler-cache: true # zizmor: ignore[cache-poisoning]
- run: bundle exec ruby ./ext/sqlite3/extconf.rb --download-dependencies
- id: rcd_image_version
run: bundle exec ruby -e 'require "rake_compiler_dock"; puts "rcd_image_version=#{RakeCompilerDock::IMAGE_VERSION}"' >> $GITHUB_OUTPUT

build_source_gem:
needs: native_setup
name: "build source"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 # zizmor: ignore[cache-poisoning]
with:
path: ports/archives
key: ports-archives-tarball-${{ hashFiles('ext/sqlite3/extconf.rb','dependencies.yml') }}
- uses: ruby/setup-ruby@dffb23f65a78bba8db45d387d5ea1bbd6be3ef18 # v1.293.0
with:
ruby-version: "4.0"
bundler-cache: true # zizmor: ignore[cache-poisoning]
- run: ./bin/test-gem-build gems ruby
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: source-gem
path: gems
retention-days: 1
uses: ./.github/workflows/build-gems.yml

#
# gem tests (source and native)
#
install_source_linux:
needs: [build_source_gem, ruby_versions]
needs: [build_gems, ruby_versions]
name: "test source"
strategy:
fail-fast: false
Expand Down Expand Up @@ -270,48 +232,9 @@ jobs:
- run: ./bin/test-gem-install gems -- --${{ matrix.syslib }}-system-libraries ${{ matrix.compile_flags }}
shell: sh

build_native_gem:
needs: native_setup
name: "build native"
strategy:
fail-fast: false
matrix:
platform:
- aarch64-linux-gnu
- aarch64-linux-musl
- arm-linux-gnu
- arm-linux-musl
- arm64-darwin
- x64-mingw-ucrt
- x86-linux-gnu
- x86-linux-musl
- x86_64-darwin
- x86_64-linux-gnu
- x86_64-linux-musl
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 # zizmor: ignore[cache-poisoning]
with:
path: ports/archives
key: ports-archives-tarball-${{ hashFiles('ext/sqlite3/extconf.rb','dependencies.yml') }}
- run: |
docker run --rm -v $PWD:/work -w /work \
ghcr.io/rake-compiler/rake-compiler-dock-image:${NEEDS_NATIVE_SETUP_OUTPUTS_RCD_IMAGE_VERSION}-mri-${{ matrix.platform }} \
./bin/test-gem-build gems ${{ matrix.platform }}
env:
NEEDS_NATIVE_SETUP_OUTPUTS_RCD_IMAGE_VERSION: ${{ needs.native_setup.outputs.rcd_image_version }}
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: "cruby-${{ matrix.platform }}-gem"
path: gems
retention-days: 1

test_architecture_matrix:
name: "${{ matrix.platform }} ${{ matrix.ruby }}"
needs: [build_native_gem, ruby_versions]
needs: [build_gems, ruby_versions]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -359,7 +282,7 @@ jobs:

test_the_rest:
name: "${{ matrix.platform }} ${{ matrix.ruby }}"
needs: [build_native_gem, ruby_versions]
needs: [build_gems, ruby_versions]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -388,7 +311,7 @@ jobs:
shell: sh

cruby-x86_64-linux-musl-install:
needs: build_native_gem
needs: build_gems
strategy:
fail-fast: false
matrix:
Expand Down
40 changes: 38 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,46 @@
name: release
concurrency:
group: "release-${{ inputs.version_tag }}"
cancel-in-progress: false

on:
workflow_dispatch:
inputs:
version_tag:
description: "Version tag to release (e.g., v2.9.1)"
required: true
type: string

permissions:
contents: read

jobs:
hello:
build:
uses: ./.github/workflows/build-gems.yml
with:
release: true
artifact_prefix: "release-${{ inputs.version_tag }}-"
ref: ${{ inputs.version_tag }}

push:
name: "Push gems to RubyGems.org"
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- run: echo "Hello, world!"
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: gems
pattern: "release-${{ inputs.version_tag }}-*-gem"
merge-multiple: true
- name: Print checksums
run: ls gems/*.gem | sort | xargs sha256sum
- uses: rubygems/configure-rubygems-credentials@bc6dd217f8a4f919d6835fcfefd470ef821f5c44 # v1.0.0
- name: Push gems
run: |
for gem in gems/*.gem; do
echo "Pushing ${gem} ..."
gem push "${gem}" || echo "WARNING: Failed to push ${gem} (may already exist)"
done
15 changes: 12 additions & 3 deletions bin/test-gem-build
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#! /usr/bin/env bash
#
# run as part of CI
# run as part of CI, or as part of the release pipeline with --release
#
RELEASE=false
if [[ "${1:-}" == "--release" ]] ; then
RELEASE=true
shift
fi

if [[ $# -lt 2 ]] ; then
echo "usage: $(basename $0) <output_dir> <platform>"
echo "usage: $(basename $0) [--release] <output_dir> <platform>"
exit 1
fi

Expand All @@ -18,7 +24,10 @@ set -x

bundle config set without development
bundle install --local || bundle install
bundle exec rake set-version-to-timestamp

if [[ "${RELEASE}" == "false" ]] ; then
bundle exec rake set-version-to-timestamp
fi

if [[ "${BUILD_NATIVE_GEM}" == "ruby" ]] ; then
bundle exec ruby ext/sqlite3/extconf.rb --download-dependencies
Expand Down
Loading