forked from larsch/ocra
-
Notifications
You must be signed in to change notification settings - Fork 8
215 lines (184 loc) · 6.19 KB
/
test-on-push.yml
File metadata and controls
215 lines (184 loc) · 6.19 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
name: Run Tests
on:
push:
branches:
- '*'
jobs:
run-tests-linux:
strategy:
fail-fast: false
matrix:
ruby: [ '3.2', '3.3', '3.4', '4.0' ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Install dependencies
run: sudo apt-get install -y xz-utils gcc
- name: Build stub and run tests
env:
OCRAN_DEBUG: "1"
run: |
bundle exec rake build
bundle exec rake test
- name: Build zlib fixture for cross-distro test
env:
OCRAN_DEBUG: "1"
run: ruby -Ilib exe/ocran test/fixtures/zlib/zlib.rb --output /tmp/zlib_packed
- name: Run packed executable on Debian (no Ruby installed)
run: docker run --rm -e OCRAN_DEBUG=1 -v /tmp:/mnt debian:stable-slim /mnt/zlib_packed
run-tests-macos:
strategy:
fail-fast: false
matrix:
os: [macos-14, macos-15-intel]
ruby: ['3.2', '3.3', '3.4', '4.0']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Install dependencies
run: brew install xz
- name: Build stub and run tests
run: |
bundle exec rake build
bundle exec rake test
- name: Build zlib fixture for cross-system test
run: ruby -Ilib exe/ocran test/fixtures/zlib/zlib.rb --output zlib_packed
- name: Upload packed binary
uses: actions/upload-artifact@v4
with:
name: zlib-macos-${{ matrix.os }}-${{ matrix.ruby }}
path: zlib_packed
retention-days: 1
test-macos-portability:
needs: run-tests-macos
strategy:
fail-fast: false
matrix:
os: [ macos-14, macos-15-intel ]
ruby: [ '3.2', '3.3', '3.4', '4.0' ]
runs-on: ${{ matrix.os }}
steps:
- name: Download packed binary
uses: actions/download-artifact@v4
with:
name: zlib-macos-${{ matrix.os }}-${{ matrix.ruby }}
- name: Run packed executable
run: |
chmod +x zlib_packed
./zlib_packed
test-source-gem-install:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04-arm
- os: windows-11-arm
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '4.0'
- name: Install build dependencies
if: runner.os == 'Linux'
run: sudo apt-get install -y xz-utils gcc make
- name: Build and install source gem
run: |
gem build ocran-source.gemspec
gem install --local ocran-*.gem
- name: Build zlib executable and run portability test (Linux)
if: runner.os == 'Linux'
run: |
ocran test/fixtures/zlib/zlib.rb --output /tmp/zlib_from_source_gem
docker run --rm -v /tmp:/mnt debian:stable-slim /mnt/zlib_from_source_gem
- name: Build and run zlib executable (Windows)
if: runner.os == 'Windows'
run: |
ocran test/fixtures/zlib/zlib.rb --output zlib_from_source_gem.exe
.\zlib_from_source_gem.exe
run-tests-windows:
strategy:
fail-fast: false
matrix:
os: [ windows-latest ]
#ruby: [ '3.2', '3.3', '3.4', '4.0' ]
ruby: [ '3.4' ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Cache Inno Setup
id: cache-innosetup
uses: actions/cache@v4
with:
path: C:\Program Files (x86)\Inno Setup 6
key: innosetup-6.7.1
- name: Install Inno Setup
if: steps.cache-innosetup.outputs.cache-hit != 'true'
shell: pwsh
env:
INNOSETUP_VERSION: "6.7.1"
INNOSETUP_SHA256: "4D11E8050B6185E0D49BD9E8CC661A7A59F44959A621D31D11033124C4E8A7B0"
run: |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest `
-UseBasicParsing `
-Uri "https://github.com/jrsoftware/issrc/releases/download/is-$($env:INNOSETUP_VERSION -replace '\.','_')/innosetup-$($env:INNOSETUP_VERSION).exe" `
-OutFile innosetup.exe
$actual = (Get-FileHash innosetup.exe -Algorithm SHA256).Hash
if ($actual -ne $env:INNOSETUP_SHA256) {
Write-Error "Hash mismatch: expected $($env:INNOSETUP_SHA256), got $actual"
exit 1
}
Write-Host "SHA256 OK"
.\innosetup.exe /verysilent /allusers /suppressmsgboxes /norestart
- name: Add Inno Setup to PATH
shell: pwsh
run: echo "C:\Program Files (x86)\Inno Setup 6" >> $env:GITHUB_PATH
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Install bundle
run: bundle install
# - name: Install Tcl/Tk MSYS2 packages
# shell: pwsh
# run: ridk exec pacman -S --noconfirm mingw-w64-ucrt-x86_64-tcl mingw-w64-ucrt-x86_64-tk
- name: Build stub and run tests
run: |
bundle exec rake build
bundle exec rake test
- name: Build zlib fixture for portability test
run: bundle exec ruby -Ilib exe/ocran test/fixtures/zlib/zlib.rb --output zlib_packed.exe
- name: Upload packed binary
uses: actions/upload-artifact@v4
with:
name: zlib-windows-${{ matrix.ruby }}
path: zlib_packed.exe
retention-days: 1
test-windows-portability:
needs: run-tests-windows
strategy:
fail-fast: false
matrix:
os: [ windows-latest ]
#ruby: [ '3.2', '3.3', '3.4', '4.0' ]
ruby: [ '3.4' ]
runs-on: ${{ matrix.os }}
steps:
- name: Download packed binary
uses: actions/download-artifact@v4
with:
name: zlib-windows-${{ matrix.ruby }}
- name: Run packed executable
shell: pwsh
run: |
$env:PATH = "C:\Windows\system32;C:\Windows"
.\zlib_packed.exe