Skip to content

Commit

Permalink
Merge pull request #14 from gjtorikian/update-rbsys
Browse files Browse the repository at this point in the history
Update rbsys
  • Loading branch information
gjtorikian committed Mar 29, 2023
2 parents ce58e86 + cbc8acb commit e857a92
Show file tree
Hide file tree
Showing 18 changed files with 61 additions and 925 deletions.
10 changes: 0 additions & 10 deletions .cross_rubies

This file was deleted.

131 changes: 17 additions & 114 deletions .github/workflows/cruby-build-and-install.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
name: Test cruby build and installation
name: Test cruby build
concurrency:
group: "${{github.workflow}}-${{github.ref}}"
cancel-in-progress: true

on:
workflow_dispatch:
pull_request:
paths:
- "lib/selma/version.rb"

env:
CACHE_KEY_PREFIX: "cruby-v1"

# "3.1,3.2" # SUPPORTED_RUBY_VERSIONS
# ["3.1", "3.2"] # SUPPORTED_RUBY_MATRIX
# "3.2" # LATEST_RUBY_VERSION

jobs:
cruby-package:
name: Compile native gem
Expand All @@ -20,129 +28,24 @@ jobs:
- aarch64-linux

- x86_64-darwin
# github actions does not support this runner, which is why it's
# missing below
- arm64-darwin

- x64-mingw-ucrt

steps:
- uses: actions/checkout@v3

- uses: oxidize-rb/actions/setup-ruby-and-rust@main
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
rubygems: latest
bundler-cache: false
cargo-cache: true
cargo-vendor: true
ruby-version: "3.2" # LATEST_RUBY_VERSION

- uses: oxidize-rb/cross-gem-action@main
- uses: oxidize-rb/actions/cross-gem@main
id: cross-gem
with:
platform: ${{ matrix.platform }}
ruby-versions: '3.1, 3.2'

- name: "Test gem build"
run: |
./script/test-gem-build gems ${{matrix.platform}}
- uses: actions/upload-artifact@v3
with:
name: "cruby-${{matrix.platform}}-gem"
path: gems
retention-days: 1

cruby-x86_64-linux-install:
needs: ["cruby-package"]
strategy:
fail-fast: false
matrix:
ruby: ["3.1", "3.2"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: ruby/setup-ruby@v1
with:
rubygems: latest
ruby-version: "${{matrix.ruby}}"

- uses: actions/download-artifact@v3
with:
name: cruby-x86_64-linux-gem
path: gems
- run: ./script/test-gem-install gems

cruby-aarch64-linux-install:
needs: ["cruby-package"]
strategy:
fail-fast: false
matrix:
ruby: ["3.1", "3.2"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: ruby/setup-ruby@v1
with:
rubygems: latest
ruby-version: "${{matrix.ruby}}"
ruby-versions: "3.1,3.2" # SUPPORTED_RUBY_VERSIONS

- uses: actions/download-artifact@v3
- uses: oxidize-rb/actions/test-gem-build@main
with:
name: cruby-aarch64-linux-gem
path: gems

- run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker run --rm -v "$(pwd):/selma" -w /selma \
--platform=linux/arm64/v8 \
ruby:${{matrix.ruby}} \
./script/test-gem-install gems
cruby-x86_64-darwin-install:
needs: ["cruby-package"]
strategy:
fail-fast: false
matrix:
ruby: ["3.1", "3.2"]
runs-on: macos-latest
steps:
- uses: actions/checkout@v3

- uses: ruby/setup-ruby@v1
with:
rubygems: latest
ruby-version: "${{matrix.ruby}}"

- uses: actions/download-artifact@v3
with:
name: cruby-x86_64-darwin-gem
path: gems

- run: ./script/test-gem-install gems

# FIXME: does not seem to work
# cruby-x64-mingw-ucrt-install:
# needs: ["cruby-package"]
# strategy:
# fail-fast: false
# matrix:
# ruby: ["3.1"]
# runs-on: windows-latest
# steps:
# - uses: ruby/setup-ruby@v1

# with:
# ruby-version: "${{matrix.ruby}}"

# - uses: actions/download-artifact@v3
# with:
# name: cruby-x64-mingw-ucrt-gem
# path: gems

# - run: |
# gem update --system 3.3.22 --no-document
# gem install --verbose --no-document gems/*.gem
# gem list -d selma
# bundle exec ruby -e 'require "selma"; puts Commonmarker.to_html("Hello, _world_")'
platform: ${{ matrix.platform }}
ruby-versions: "3.1,3.2" # SUPPORTED_RUBY_VERSIONS
95 changes: 0 additions & 95 deletions .github/workflows/generic-build-and-install.yml

This file was deleted.

47 changes: 20 additions & 27 deletions .github/workflows/tag_and_release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
name: Tag and Release

on:
workflow_dispatch:
push:
branches:
- main
paths:
- "lib/selma/version.rb"
- "lib/commonmarker/version.rb"

env:
CACHE_KEY_PREFIX: "cruby-v1-"

# "3.1,3.2" # SUPPORTED_RUBY_VERSIONS
# ["3.1", "3.2"] # SUPPORTED_RUBY_MATRIX
# "3.2" # LATEST_RUBY_VERSION

jobs:
native_gem:
Expand All @@ -25,43 +33,27 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: oxidize-rb/actions/setup-ruby-and-rust@main
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
rubygems: latest
bundler-cache: false
cargo-cache: true
cargo-vendor: true
ruby-version: "3.2" # LATEST_RUBY_VERSION

- uses: oxidize-rb/cross-gem-action@main
- uses: oxidize-rb/actions/cross-gem@v1
id: cross-gem
with:
platform: ${{ matrix.platform }}
ruby-versions: '3.1, 3.2'

- uses: actions/download-artifact@v3
with:
name: cross-gem
path: pkg/

- name: Display structure of built gems
run: ls -R
working-directory: pkg/
ruby-versions: "3.1,3.2" # SUPPORTED_RUBY_VERSIONS

- name: Publish to RubyGems
working-directory: pkg/
env:
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_API_BOT_KEY}}
GEM_OUTPUT_PATH: ${{ steps.cross-gem.outputs.gem-path }}
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
for i in *.gem; do
if [ -f "$i" ]
then
gem push "$i" || true
fi
done
gem push "${GEM_OUTPUT_PATH}" || true
echo "Pushed ${GEM_OUTPUT_PATH}"
release:
needs: ["native_gem"]
Expand All @@ -75,7 +67,7 @@ jobs:
uses: ruby/setup-ruby@v1
with:
rubygems: latest
ruby-version: 3.2
ruby-version: "3.2" # LATEST_RUBY_VERSION
bundler-cache: true

- name: Configure Git
Expand All @@ -86,7 +78,7 @@ jobs:
- name: Get current version
id: version-label
run: |
VERSION=$(grep VERSION lib/selma/version.rb | head -n 1 | cut -d'"' -f2)
VERSION=$(grep VERSION lib/commonmarker/version.rb | head -n 1 | cut -d'"' -f2)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Create tag
Expand All @@ -105,6 +97,7 @@ jobs:
git add -f CHANGELOG.md
git commit -m "docs: update changelog" || true
git push
- name: Publish release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ actual.txt
test.txt
test/progit
test/benchinput.md

*.orig
Loading

0 comments on commit e857a92

Please sign in to comment.