-
Notifications
You must be signed in to change notification settings - Fork 5
86 lines (77 loc) · 2.86 KB
/
cross-gem.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
# Adjust this based on your release workflow
# 👋 Look here for another good example: https://github.com/bytecodealliance/wasmtime-rb/tree/main/.github/workflows
name: Cross Gem
on:
workflow_dispatch:
inputs:
rb-sys-branch:
description: 'rb-sys branch to test against'
required: false
default: 'main'
type: string
push:
branches: ["main", "cross-gem/*"]
jobs:
ci-data:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.fetch.outputs.result }}
steps:
# This compiles for all supported Ruby cross-compilation platforms.
- id: fetch
uses: oxidize-rb/actions/fetch-ci-data@main
with:
supported-ruby-platforms: |
exclude: []
cross_gems:
name: Cross compile 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@v3
- name: Patch rb-sys version
id: patch
if: ${{ inputs.rb-sys-branch }}
run: |
mkdir -p .cargo
echo "[patch.crates-io]" >> .cargo/config.toml
echo "rb-sys = { git = \"https://github.com/oxidize-rb/rb-sys\", branch = \"${{ inputs.rb-sys-branch }}\" }" >> .cargo/config.toml
echo "rb-sys-env = { git = \"https://github.com/oxidize-rb/rb-sys\", branch = \"${{ inputs.rb-sys-branch }}\" }" >> .cargo/config.toml
sed -i "s|gem 'rb_sys', '.*'|gem 'rb_sys', github: 'oxidize-rb/rb-sys', branch: '${{ inputs.rb-sys-branch }}'|g" Gemfile
cargo update -p rb-sys
if [[ "${{ inputs.rb-sys-branch }}" == "" ]]; then
echo "rb_sys_branch=main" >> $GITHUB_OUTPUT
else
echo "rb_sys_branch=${{ inputs.rb-sys-branch }}" >> $GITHUB_OUTPUT
fi
- uses: "ruby/setup-ruby@v1"
with:
ruby-version: "3.2"
bundler-cache: true
- uses: oxidize-rb/actions/cross-gem@v1
with:
platform: ${{ matrix.ruby-platform }}
tag: ${{ steps.patch.outputs.rb_sys_branch }}
- uses: actions/upload-artifact@v3
with:
name: cross-gem-${{ matrix.ruby-platform }}
path: pkg/*-${{ matrix.ruby-platform }}.gem
if-no-files-found: error
retention-days: 1
- name: "Set rb-sys version"
id: capture
run: |
echo "rb-sys-version=$(bundle exec rb-sys-dock --version)" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v3
with:
name: rb-sys-bindings-${{ steps.capture.outputs.rb-sys-version }}
path: |
tmp/rb-sys-dock/${{ matrix.ruby-platform }}/**/cfg-capture*
tmp/rb-sys-dock/${{ matrix.ruby-platform }}/**/bindings*
tmp/${{ matrix.ruby-platform }}/
if-no-files-found: error