-
Notifications
You must be signed in to change notification settings - Fork 2
94 lines (81 loc) · 3.03 KB
/
comment-to-build-pr.yaml
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
name: comment '/build rpm' to build a PR (the copr way)
on:
issue_comment:
types: [created]
jobs:
build:
if: |
github.event.issue.pull_request &&
startsWith(github.event.comment.body, '/build rpm') &&
(
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'COLLABORATOR' ||
github.event.comment.author_association == 'OWNER'
)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: el8
container-image: quay.io/ovirt/buildcontainer:el8stream
- name: el9
container-image: quay.io/ovirt/buildcontainer:el9stream
name: ${{ matrix.name }}, build the rpm repo
container:
image: ${{ matrix.container-image }}
env:
CHECK_VERSION: no
PR_NUMBER: ${{ github.event.issue.number }}
steps:
- name: checkout the repo
uses: ovirt/checkout-action@main
- name: checkout the PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr checkout --repo ${GITHUB_REPOSITORY} ${PR_NUMBER}
- name: install build.sh required packages and most current nodejs-modules (as a fetch cache)
run: |
dnf -y install ovirt-engine-nodejs-modules
dnf -y builddep --spec ovirt-engine-nodejs-modules.spec
- name: build src.rpm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./automation/build.sh copr
- name: install build dependencies from src.rpm
run: |
dnf -y builddep exported-artifacts/ovirt-engine-nodejs-modules*.src.rpm
- name: Build rpm directly from src.rpm
run: |
rpmbuild \
--define="_rpmdir `pwd`/exported-artifacts" \
--rebuild exported-artifacts/ovirt-engine-nodejs-modules*.src.rpm
- name: upload artifacts
uses: ovirt/upload-rpms-action@main
with:
directory: exported-artifacts/
- name: add success comment with a link to the action's run
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
LINK=$( \
gh api -X GET \
repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} \
-q '"[action run summary]("+ .html_url +")"' \
)
echo ":heavy_check_mark: Build ${{ matrix.name }} success! See the results and artifacts at $LINK." \
| gh pr comment --repo ${GITHUB_REPOSITORY} -F - ${PR_NUMBER}
- name: add fail comment with a link to the action's run
if: failure()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
LINK=$( \
gh api -X GET \
repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} \
-q '"[action run summary]("+ .html_url +")"' \
)
echo ":x: Build ${{ matrix.name }} failed. See the results at $LINK." \
| gh pr comment --repo ${GITHUB_REPOSITORY} -F - ${PR_NUMBER}