-
Notifications
You must be signed in to change notification settings - Fork 0
212 lines (177 loc) · 7.24 KB
/
ci.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
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
---
# Building the tools for RISC OS (and other platforms)
#
name: PRM-in-XML
# Controls when the action will run. Triggers the workflow on:
# * push on any branch.
# * tag creation for tags beginning with a 'v'
on:
push:
branches: ["*"]
tags: ["v*"]
# Pull request events happen on pull request state transitions, so we probably don't want this here.
#pull_request:
# branches: ["*"]
jobs:
test-examples:
runs-on: ubuntu-20.04
container: ubuntu:20.04
steps:
- uses: actions/checkout@v3
- name: Build examples
run: |
# For the purposes for which we are using this - publicly available and with the
# watermark icon and explicitly stating that we're using PrinceXML to generate the
# output - we are licensed under the terms of the Non-commercial license.
# These documents are generated by tools from http://www.princexml.com/
export PRINCEXML_I_HAVE_A_LICENSE=1
crosscompile/build-examples.sh
- uses: actions/upload-artifact@v3
with:
name: Test-Output
path: test-output
# Tests for different platforms
test-platforms:
runs-on: ubuntu-20.04
strategy:
matrix:
os: ["ubuntu:18.04", "ubuntu:20.04", "ubuntu:22.04", "centos:7", "centos:8", "debian:10", "linuxmintd/mint18-amd64", "linuxmintd/mint20-amd64"]
#os: ["ubuntu:18.04"]
container: ${{ matrix.os }}
needs: test-examples # always run after the baseline tests
steps:
- uses: actions/checkout@v3
- name: Prerequisites for CentOS 8
if: matrix.os == 'centos:8'
run: |
echo "Fixing up centos 8 being EOL'd"
for i in /etc/yum.repos.d/* ; do sed -i 's/mirrorlist/#mirrorlist/' $i ; done
for i in /etc/yum.repos.d/* ; do sed -i 's!#baseurl=http://mirror.!baseurl=http://vault.!' $i ; done
- name: Build examples
run: |
crosscompile/build-examples.sh
test-riscos:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: test-examples # always run after the baseline tests
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Install required packages
run: |
sudo apt-get install -y python2 virtualenv
- name: Test through build.riscos.online
run: |
# Ensure we have the RISC OS bits downloaded and usable
crosscompile/setup-riscos-tests.sh
# Zip up the source to send to robuild
echo Zip up our sources
zip -q9r /tmp/source-archive.zip riscos-bits ROTest,feb .robuild.yaml
# Fetch the build client
echo Fetch the build client
curl -s -L -o riscos-build-online https://github.com/gerph/robuild-client/releases/download/v0.05/riscos-build-online && chmod +x riscos-build-online
# Send the archive file to build service (with explicit timeout)
echo Run the build
timeout 660 ./riscos-build-online -i /tmp/source-archive.zip -a off -t 600 -o /tmp/built
# If it didn't report an error, the test was successful.
export-posix:
runs-on: ubuntu-20.04
needs: ["test-riscos", "test-platforms"]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Prerequisites
run: |
sudo apt-get update && sudo apt-get install -y git make
- name: Build release
run: |
set -e
eval "$(crosscompile/ci-vars)"
cd crosscompile
make cross_install ROTOOL_DIR=../artifacts
../artifacts/riscos-prminxml --version
- uses: actions/upload-artifact@v3
with:
name: Tool-POSIX
path: artifacts
export-riscos:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: ["test-riscos", "test-platforms"]
outputs:
version: ${{ steps.version.outputs.version }}
leafname: ${{ steps.version.outputs.leafname }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install required packages
run: |
sudo apt-get install -y python2 virtualenv
- name: Give the output a versioned name
id: version
run: |
eval "$(crosscompile/ci-vars)"
version="${CI_BRANCH_VERSION}"
echo "This is version: $version"
leafname="PRMinXML-$version.zip"
echo "version=$version" >> $GITHUB_OUTPUT
echo "leafname=$leafname" >> $GITHUB_OUTPUT
- name: Build through build.riscos.online
run: |
mkdir -p artifacts
eval "$(crosscompile/ci-vars)"
crosscompile/build-riscos-archive.sh ${{ steps.version.outputs.leafname }}
- uses: actions/upload-artifact@v3
with:
name: Tool-RISCOS
path: ${{ steps.version.outputs.leafname }}
# The artifact that is downloadable from the Actions is actually a zip of the artifacts
# that we supply. So it will be a regular Zip file containing a RISC OS Zip file.
# The release only triggers when the thing that was pushed was a tag starting with 'v'
release:
needs: ['export-riscos', 'export-posix']
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download built binary (RISC OS)
uses: actions/download-artifact@v1
with:
name: Tool-RISCOS
- name: Download built binary (POSIX)
uses: actions/download-artifact@v1
with:
name: Tool-POSIX
- name: Download built binary (tests)
uses: actions/download-artifact@v1
with:
name: Test-Output
# RISC OS version is already archived in a RISC OS archive format.
- name: Rename the RISC OS archive
run: |
mv "Tool-RISCOS/${{ needs.export-riscos.outputs.leafname }}" RISCOS-"${{ needs.export-riscos.outputs.leafname }}"
- name: Archive the contents of the POSIX version
run: |
cd Tool-POSIX
# For some reason, the executable flag has been lost on the tool.
chmod +x riscos-prminxml
tar zcvf ../POSIX-PRMinXML-${{ needs.export-riscos.outputs.version }}.tar.gz *
- name: Archive the contents of the Test output
run: |
cd Test-Output
# We use zip here because most people using these tools will be RISC OS users
# and zip is more friendly to them.
zip -9r ../Example-Output-${{ needs.export-riscos.outputs.version }}.zip *
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
prerelease: false
draft: true
name: Release ${{ needs.export-riscos.outputs.version }}
artifacts: "RISCOS-${{ needs.export-riscos.outputs.leafname }},POSIX-PRMinXML-${{ needs.export-riscos.outputs.version }}.tar.gz,Example-Output-${{ needs.export-riscos.outputs.version }}.zip"
artifactContentType: application/zip