-
Notifications
You must be signed in to change notification settings - Fork 1
174 lines (148 loc) · 4.95 KB
/
build.yml
File metadata and controls
174 lines (148 loc) · 4.95 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: Build
on:
pull_request:
branches:
- "*"
push:
branches:
- main
jobs:
specs:
runs-on: ${{ matrix.os }}
name: specs ruby-${{ matrix.ruby }} ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-22.04, macos-15 ]
ruby: [ 2.7, 3.0, 3.1, 3.2 ]
fail-fast: false
steps:
- uses: actions/checkout@v6
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: default
bundler-cache: true
- name: Run specs
run: |
COVERAGE=true bundle exec rake spec
- name: Run rubocop
run: |
bundle exec rubocop
smoke:
runs-on: ${{ matrix.os }}
name: smoke ruby-${{ matrix.ruby }} ${{ matrix.os }}
strategy:
matrix:
include:
- { os: ubuntu-22.04 , platform: x86_64-linux , ruby: 3.0 }
- { os: macos-15 , platform: x86_64-darwin , ruby: 3.0 }
fail-fast: false
steps:
- uses: actions/checkout@v6
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: default
bundler-cache: true
- name: Smoke test gem
run: |
bundle exec rake build
gem install pkg/asherah-$(bundle exec rake version).gem
ruby spec/smoke_test.rb # Don't use `bundle exec` to load the installed gem.
gem uninstall asherah
- name: Smoke test platform gem
run: |
bundle exec rake native:build:${{ matrix.platform }}
gem install pkg/asherah-$(bundle exec rake version)-${{ matrix.platform }}.gem
ruby spec/smoke_test.rb # Don't use `bundle exec` to load the installed gem.
gem uninstall asherah
smoke_arm64:
runs-on: ${{ matrix.os }}
name: smoke arm32 ruby-${{ matrix.ruby }} ${{ matrix.os }}
strategy:
matrix:
include:
- { os: ubuntu-22.04 , platform: aarch64-linux , ruby: 3.0 }
fail-fast: false
steps:
- uses: actions/checkout@v6
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: default
bundler-cache: true
- name: Smoke test gems
run: |
bundle exec rake build
bundle exec rake native:build:${{ matrix.platform }}
GEM_NAME=asherah-$(bundle exec rake version).gem
GEM_PLATFORM_NAME=asherah-$(bundle exec rake version)-${{ matrix.platform }}.gem
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker run --rm --volume "$(pwd):/asherah" \
--platform linux/arm64/v8 \
--workdir /asherah \
ruby:${{matrix.ruby}}-bullseye \
/bin/sh -c "
gem install pkg/$GEM_NAME
ruby spec/smoke_test.rb
gem uninstall asherah
gem install pkg/$GEM_PLATFORM_NAME
ruby spec/smoke_test.rb
gem uninstall asherah
"
cross_language_tests:
runs-on: ubuntu-22.04
name: cross-language-tests
env:
MYSQL_HOSTNAME: 127.0.0.1
MYSQL_DATABASE: testdb
MYSQL_USERNAME: root
MYSQL_PASSWORD: password
services:
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: ${{ env.MYSQL_DATABASE }}
MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_PASSWORD }}
ports:
- 3306:3306
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10
steps:
- uses: actions/checkout@v6
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler: default
bundler-cache: true
- name: Download binary for current platform
run: |
bundle exec rake download
- name: Initialize RDBMS metastore
run: |
mysql -h ${{ env.MYSQL_HOSTNAME }} -P${{ job.services.mysql.ports[3306] }} -u ${{ env.MYSQL_USERNAME }} -p${{ env.MYSQL_PASSWORD }} -e "CREATE TABLE ${{ env.MYSQL_DATABASE }}.encryption_key (
id VARCHAR(255) NOT NULL,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
key_record TEXT NOT NULL,
PRIMARY KEY (id, created),
INDEX (created)
);"
- name: Set up Go
uses: actions/setup-go@v6.0.0
with:
go-version: 1.24
- name: Test Cross-Language
env:
TEST_DB_NAME: ${{ env.MYSQL_DATABASE }}
TEST_DB_PASSWORD: ${{ env.MYSQL_PASSWORD }}
TEST_DB_HOSTNAME: ${{ env.MYSQL_HOSTNAME }}
TEST_DB_USER: ${{ env.MYSQL_USERNAME }}
TEST_DB_PORT: ${{ job.services.mysql.ports[3306] }}
ASHERAH_SERVICE_NAME: service
ASHERAH_PRODUCT_NAME: product
ASHERAH_KMS_MODE: static
CUCUMBER_PUBLISH_QUIET: true
run: bin/cross-language-test.sh