-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (116 loc) · 3.4 KB
/
Copy pathci.yml
File metadata and controls
122 lines (116 loc) · 3.4 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: ci
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
ruby-version: ["3.1", "3.4"]
steps:
- uses: actions/checkout@v6
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- run: bundle exec rake
- run: cargo fmt --check
- run: cargo clippy --workspace --all-features --locked -- -D warnings
native-gems:
if: startsWith(github.ref, 'refs/tags/v')
needs: test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
artifact: x86_64-linux
- os: ubuntu-24.04-arm
artifact: aarch64-linux
- os: macos-15-intel
artifact: x86_64-darwin
- os: macos-14
artifact: arm64-darwin
- os: windows-latest
artifact: x64-mingw-ucrt
steps:
- uses: actions/checkout@v6
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
ruby-version: "3.1"
bundler-cache: true
cargo-cache-clean: false
- name: Check tag version
shell: bash
run: |
expected="${GITHUB_REF_NAME#v}"
actual="$(ruby -Ilib -r dotenvx/version -e 'print Dotenvx::VERSION')"
test "$actual" = "$expected"
- run: bundle exec rake package:native
- name: Test packaged gem
shell: bash
run: |
gem install --local --ignore-dependencies pkg/*.gem
ruby -e 'require "dotenvx"; abort unless Dotenvx::VERSION == ENV.fetch("GITHUB_REF_NAME").delete_prefix("v")'
- uses: actions/upload-artifact@v7
with:
name: gem-${{ matrix.artifact }}
path: pkg/*.gem
rails-gem:
if: startsWith(github.ref, 'refs/tags/v')
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
- name: Check tag version
shell: bash
run: |
expected="${GITHUB_REF_NAME#v}"
actual="$(ruby -Ilib -r dotenvx/version -e 'print Dotenvx::VERSION')"
test "$actual" = "$expected"
- name: Build Rails gem
run: |
mkdir -p pkg
gem build dotenvx-rails.gemspec
mv dotenvx-rails-*.gem pkg/
gem specification pkg/dotenvx-rails-*.gem
- uses: actions/upload-artifact@v7
with:
name: gem-rails
path: pkg/*.gem
publish:
if: startsWith(github.ref, 'refs/tags/v')
needs: [native-gems, rails-gem]
runs-on: ubuntu-latest
environment: release
permissions:
contents: read
id-token: write
steps:
- uses: actions/download-artifact@v6
with:
pattern: gem-*
path: pkg
merge-multiple: true
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
- name: Configure RubyGems credentials
uses: rubygems/configure-rubygems-credentials@dc5a8d8553e6ee01fc26761a49e99e733d17954a # v2.1.0
- name: Publish platform gems
run: |
for gem in pkg/*.gem; do
gem push "$gem"
done