-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
218 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
--- | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: ["v*"] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
ci-data: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
result: ${{ steps.fetch.outputs.result }} | ||
steps: | ||
- id: fetch | ||
uses: oxidize-rb/actions/fetch-ci-data@v1 | ||
with: | ||
supported-ruby-platforms: | | ||
# Excluding: | ||
# `arm-linux`: Cranelift doesn't support 32-bit architectures | ||
# `x64-mingw32`: `x64-mingw-ucrt` should be used for Ruby 3.1+ (https://github.com/rake-compiler/rake-compiler-dock?tab=readme-ov-file#windows) | ||
# 3.0 is deprecated as stable ruby version according to: | ||
# https://github.com/oxidize-rb/actions/blob/main/fetch-ci-data/evaluate.rb#L54 | ||
exclude: [arm-linux, x64-mingw32] | ||
stable-ruby-versions: | | ||
exclude: [head] | ||
build: | ||
name: Build native gems | ||
needs: ci-data | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ruby-platform: ${{ fromJSON(needs.ci-data.outputs.result).supported-ruby-platforms }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1 | ||
with: | ||
ruby-version: "3.3" | ||
bundler-cache: false | ||
cargo-cache: true | ||
cargo-vendor: true | ||
cache-version: v1-${{ matrix.ruby-platform }} | ||
|
||
- uses: oxidize-rb/cross-gem-action@main | ||
with: | ||
version: latest | ||
platform: ${{ matrix.ruby-platform }} | ||
ruby-versions: ${{ join(fromJSON(needs.ci-data.outputs.result).stable-ruby-versions, ', ') }} | ||
|
||
- name: Smoke gem install | ||
if: matrix.ruby-platform == 'x86_64-linux' # GitHub actions architecture | ||
run: | | ||
gem install pkg/fast_toml-*x86_64-linux.gem --verbose | ||
script="puts FastToml.parse('[it_works]')" | ||
ruby -rfast_toml -e "$script" | grep it_work | ||
echo "✅ Successfully gem installed" | ||
release: | ||
name: Release | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1 | ||
with: | ||
ruby-version: "3.3" | ||
bundler-cache: true | ||
cargo-cache: true | ||
cache-version: v1 | ||
|
||
# It seems that v4 is not compatible with how artifacts are uploaded by | ||
# oxidize-rb/cross-gem-action. So this must stay as v3 until the issue | ||
# below is fixed. | ||
# See https://github.com/oxidize-rb/actions/issues/27, for more details. | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: cross-gem | ||
|
||
- name: Package source gem | ||
run: bundle exec rake build | ||
|
||
- name: Ensure version matches the tag | ||
run: | | ||
GEM_VERSION=$(grep 'VERSION =' lib/fast_toml/version.rb | sed -nE "s/.*VERSION = '([^']+)'.*/\1/p") | ||
if [ "v$GEM_VERSION" != "${{ github.ref_name }}" ]; then | ||
echo "Gem version does not match tag" | ||
echo " v$GEM_VERSION != ${{ github.ref_name }}" | ||
exit 1 | ||
fi | ||
- name: Push Gem | ||
working-directory: pkg/ | ||
env: | ||
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_KEY }} | ||
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 | ||
ls -l | ||
for i in *.gem; do | ||
if [ -f "$i" ]; then | ||
if ! gem push "$i" >push.out; then | ||
gemerr=$? | ||
sed 's/^/::error:: /' push.out | ||
if ! grep -q "Repushing of gem" push.out; then | ||
exit $gemerr | ||
fi | ||
fi | ||
fi | ||
done |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "fast_toml" | ||
version = "0.2.0" | ||
version = "0.3.0" | ||
edition = "2021" | ||
authors = ["Guilherme Carreiro <[email protected]>"] | ||
license = "MIT" | ||
|
@@ -12,3 +12,19 @@ crate-type = ["cdylib"] | |
[dependencies] | ||
magnus = "0.6.4" | ||
toml = "0.8.13" | ||
rb-sys = { version = "0.9.85", features = [ | ||
"bindgen-rbimpls", | ||
"bindgen-deprecated-types", | ||
"stable-api-compiled-fallback", | ||
] } | ||
|
||
[dev-dependencies] | ||
rb-sys = { version = "0.9.85", features = [ | ||
"link-ruby", | ||
"bindgen-rbimpls", | ||
"bindgen-deprecated-types", | ||
"stable-api-compiled-fallback", | ||
] } | ||
|
||
[build-dependencies] | ||
rb-sys-env = { version = "0.1.2" } |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module FastToml | ||
VERSION = '0.2.0' | ||
VERSION = '0.3.0' | ||
end |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
desc 'Initialize fast_json environment' | ||
task :env do | ||
require 'lib/fast_toml' | ||
end |