forked from AmberELEC/AmberELEC
-
Notifications
You must be signed in to change notification settings - Fork 5
183 lines (175 loc) · 8.08 KB
/
build-pr.yaml
File metadata and controls
183 lines (175 loc) · 8.08 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
name: build-pr
on:
pull_request:
# We don't need to run builds when these files change
paths-ignore:
- '.github/**'
- 'LICENSE.md'
- 'Dockerfile'
- '.dockerignore'
branches:
- main
- dev
types: [opened, closed, synchronize, ready_for_review, labeled]
env:
# This is used by 'make docker-*' commands to determine image to build with
DOCKER_IMAGE: ghcr.io/${{ github.event.repository.owner.login }}/${{ github.event.repository.name }}-build:latest
# Ensure that if there are multiple builds for a PR only 1 is queued
# Example: 1st commit in PR starts a build then 2-9 commits come in during the first build.
# This makes it so that only commit 9 is enqueued to build rather than builds for 2-9 all being queued
concurrency:
group: pr-${{ github.event.pull_request.number }}
cancel-in-progress: false #only 1 build at a time per PR
jobs:
build-init:
timeout-minutes: 60
# Run on self-hosted runners with the 'pr' label
runs-on: pr
# Don't run on drafts - skip 'closed' PR's
#if: github.event.action != 'closed' && ( github.event.pull_request.draft == false || github.event.label.name == 'build' )
if: github.event.action != 'closed' && ( github.event.label.name == 'build' )
steps:
- uses: actions/checkout@v4
name: Checkout (pull request)
with:
# clean: false ensures that we don't remove all the build files
clean: false
build-rg351p:
needs: [build-init]
timeout-minutes: 360
# Run on self-hosted runners with the 'pr' label
runs-on: pr
# Don't run on drafts - skip 'closed' PR's
#if: github.event.action != 'closed' && ( github.event.pull_request.draft == false || github.event.label.name == 'build' )
if: github.event.action != 'closed' && ( github.event.label.name == 'build' )
steps:
- name: Get date for artifacts
id: date
run: echo "date=$(date +'%Y%m%d_%H%M')" >> $GITHUB_OUTPUT
- name: Get short SHA for artifacts
id: sha
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get PR version
id: version
run: echo "version=pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}-${{ steps.date.outputs.date }}-${{ steps.sha.outputs.sha }}" >> $GITHUB_OUTPUT
- name: Build RG351P
run: |
set -e
export CUSTOM_VERSION="${{ steps.version.outputs.version }}"
export DOCKER_WORK_DIR=/work
make docker-RG351P
build-rg351v:
needs: [build-init, build-rg351p]
timeout-minutes: 360
# Run on self-hosted runners with the 'pr' label
runs-on: pr
# Don't run on drafts - skip 'closed' PR's
#if: github.event.action != 'closed' && ( github.event.pull_request.draft == false || github.event.label.name == 'build' )
if: github.event.action != 'closed' && ( github.event.label.name == 'build' )
steps:
- name: Get date for artifacts
id: date
run: echo "date=$(date +'%Y%m%d_%H%M')" >> $GITHUB_OUTPUT
- name: Get short SHA for artifacts
id: sha
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get PR version
id: version
run: echo "version=pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}-${{ steps.date.outputs.date }}-${{ steps.sha.outputs.sha }}" >> $GITHUB_OUTPUT
- name: Build RG351V
run: |
set -e
export CUSTOM_VERSION="${{ steps.version.outputs.version }}"
export DOCKER_WORK_DIR=/work
make docker-RG351V
build-rg351mp:
needs: [build-init, build-rg351p, build-rg351v]
timeout-minutes: 360
# Run on self-hosted runners with the 'pr' label
runs-on: pr
# Don't run on drafts - skip 'closed' PR's
#if: github.event.action != 'closed' && ( github.event.pull_request.draft == false || github.event.label.name == 'build' )
if: github.event.action != 'closed' && ( github.event.label.name == 'build' )
steps:
- name: Get date for artifacts
id: date
run: echo "date=$(date +'%Y%m%d_%H%M')" >> $GITHUB_OUTPUT
- name: Get short SHA for artifacts
id: sha
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get PR version
id: version
run: echo "version=pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}-${{ steps.date.outputs.date }}-${{ steps.sha.outputs.sha }}" >> $GITHUB_OUTPUT
- name: Build RG351MP
run: |
set -e
export CUSTOM_VERSION="${{ steps.version.outputs.version }}"
export DOCKER_WORK_DIR=/work
make docker-RG351MP
build-rg552:
needs: [build-init, build-rg351p, build-rg351v, build-rg351mp]
timeout-minutes: 360
# Run on self-hosted runners with the 'pr' label
runs-on: pr
# Don't run on drafts - skip 'closed' PR's
#if: github.event.action != 'closed' && ( github.event.pull_request.draft == false || github.event.label.name == 'build' )
if: github.event.action != 'closed' && ( github.event.label.name == 'build' )
steps:
- name: Get date for artifacts
id: date
run: echo "date=$(date +'%Y%m%d_%H%M')" >> $GITHUB_OUTPUT
- name: Get short SHA for artifacts
id: sha
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get PR version
id: version
run: echo "version=pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}-${{ steps.date.outputs.date }}-${{ steps.sha.outputs.sha }}" >> $GITHUB_OUTPUT
- name: Build RG552
run: |
set -e
export CUSTOM_VERSION="${{ steps.version.outputs.version }}"
export DOCKER_WORK_DIR=/work
make docker-RG552
build-finalize:
needs: [build-init, build-rg351p, build-rg351v, build-rg351mp, build-rg552]
timeout-minutes: 360
# Run on self-hosted runners with the 'pr' label
runs-on: pr
# Don't run on drafts - skip 'closed' PR's
#if: github.event.action != 'closed' && ( github.event.pull_request.draft == false || github.event.label.name == 'build' )
if: github.event.action != 'closed' && ( github.event.label.name == 'build' )
steps:
- name: Get short SHA for artifacts
id: sha
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Cleanup system artifacts (no .img in PR builds)
run: |
set -e
rm -rf release/aarch64/RG*/*.system*
rm -rf release/aarch64/RG*/*.kernel*
#PR's builds only include the .tar for speed
rm -rf release/aarch64/RG*/*.img.gz*
- name: Archive RG351P-PR-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}
uses: actions/upload-artifact@v4
with:
name: RG351P-PR-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}-${{ steps.sha.outputs.sha }}
path: |
release/aarch64/RG351P/
- name: Archive RG351V-PR-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}
uses: actions/upload-artifact@v4
with:
name: RG351V-PR-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}-${{ steps.sha.outputs.sha }}
path: |
release/aarch64/RG351V/
- name: Archive RG351MP-PR-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}
uses: actions/upload-artifact@v4
with:
name: RG351MP-PR-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}-${{ steps.sha.outputs.sha }}
path: |
release/aarch64/RG351MP/
- name: Archive RG552-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}
uses: actions/upload-artifact@v4
with:
name: RG552-PR-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}-${{ steps.sha.outputs.sha }}
path: |
release/aarch64/RG552/