generated from interTwin-eu/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
155 lines (147 loc) · 5.18 KB
/
main.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
--- # trunk-ignore(checkov)
name: CI
on:
push:
pull_request:
concurrency:
group: ${{ github.workflow }}
jobs:
build-fedora:
name: build-fedora
runs-on: ubuntu-latest
container: fedora:39
steps:
- name: Install build requisites
run: |
dnf -y update
dnf -y install rpmdevtools systemd-rpm-macros rpmlint rsync git
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: rpm_build
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
export "version=$(git describe --tags --dirty)"
echo "version=$(git describe --tags --dirty)" >> "$GITHUB_OUTPUT"
export "version_rpm=$(git describe --tags --abbrev=0)"
echo "version_rpm=$(git describe --tags --abbrev=0)" >> "$GITHUB_OUTPUT"
chmod 777 rpm/teapot-rpm-fedora.sh
rpm/teapot-rpm-fedora.sh
- uses: actions/upload-artifact@v4
with:
name: teapot-${{ steps.rpm_build.outputs.version }}_rpm_fedora_39
path: /github/home/rpmbuild/RPMS/x86_64/teapot-${{ steps.rpm_build.outputs.version_rpm }}*.x86_64.rpm
outputs:
version: ${{ steps.rpm_build.outputs.version }}
version_rpm: ${{ steps.rpm_build.outputs.version_rpm }}
build-rockylinux:
name: build-rockylinux
needs: build-fedora
runs-on: ubuntu-latest
container: rockylinux:9.3
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install build requisites
run: |
dnf -y update
dnf -y install rpmdevtools rpmlint rsync systemd-rpm-macros
- name: Build rpm
run: |
export "version_rpm=${{ needs.build-fedora.outputs.version_rpm }}"
chmod 777 rpm/teapot-rpm-rocky.sh
rpm/teapot-rpm-rocky.sh
- uses: actions/upload-artifact@v4
with:
name: teapot-${{ needs.build-fedora.outputs.version }}_rpm_rockylinux_9.3
path: /github/home/rpmbuild/RPMS/x86_64/teapot-${{ steps.rpm_build.outputs.version_rpm }}*.x86_64.rpm
build-almalinux:
name: build-almalinux
needs: build-fedora
runs-on: ubuntu-latest
container: almalinux:9.4
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install build requisites
run: |
dnf -y update
dnf -y install rpmdevtools rpmlint rsync systemd-rpm-macros
- name: Build rpm
run: |
export "version_rpm=${{ needs.build-fedora.outputs.version_rpm }}"
echo "version_rpm is $version_rpm"
chmod 777 rpm/teapot-rpm-alma.sh
rpm/teapot-rpm-alma.sh
- uses: actions/upload-artifact@v4
with:
name: teapot-${{ needs.build-fedora.outputs.version }}_rpm_almalinux_9.4
path: /github/home/rpmbuild/RPMS/x86_64/teapot-${{ steps.rpm_build.outputs.version_rpm }}*.x86_64.rpm
containerization:
name: containerization
needs: build-fedora
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: teapot-${{ needs.build-fedora.outputs.version }}_rpm_fedora_39
path: /home/runner/work/teapot/teapot/robot
- name: Building Teapot docker image
env:
TOKEN: ${{ secrets.TOKEN }}
USERNAME: ${{ secrets.USERNAME }}
run: |
cd robot
docker build . --tag ghcr.io/intertwin-eu/teapot:latest
echo "$TOKEN" | docker login ghcr.io -u "$USERNAME" --password-stdin
docker push ghcr.io/intertwin-eu/teapot:latest
test:
name: test
needs: [build-fedora, containerization]
runs-on: ubuntu-latest
container:
image: dvrbanec/main:latest
services:
keycloak:
image: dvrbanec/keycloak-dev:1
teapot:
image: ghcr.io/intertwin-eu/teapot:latest
credentials:
username: ${{ secrets.USERNAME }}
password: ${{ secrets.TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Test Teapot
run: |
eval "$(oidc-agent)"
oidc-gen --flow password -f keycloak-setup/client_config.json --op-username test-user1 --op-password secret1 --prompt none --pw-file keycloak_setup/pw-file test-user1
oidc-gen --flow password -f keycloak-setup/client_config.json --op-username test-user2 --op-password secret2 --prompt none --pw-file keycloak_setup/pw-file test-user2
robot --outputdir /__w/teapot/teapot/robot/output/ /__w/teapot/teapot/robot/teapot-tests.robot
- uses: actions/upload-artifact@v4
if: always()
with:
name: robot-tests
path: /__w/teapot/teapot/robot/output
generate_report:
if: always()
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: robot-tests
path: /home/runner/work/teapot/teapot/reports/
- name: Send report to commit
uses: joonvena/[email protected]
with:
gh_access_token: ${{ secrets.TOKEN }}