-
Notifications
You must be signed in to change notification settings - Fork 31
68 lines (64 loc) · 2.27 KB
/
pr-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
name: CI build and push (PR)
concurrency:
group: pr-${{ github.event.number }}
cancel-in-progress: true
on:
pull_request_target:
types:
- opened
- reopened
- synchronize
- labeled
- unlabeled
branches:
- main
- v[0-9]+
- v[0-9]+.[0-9]+
- cryostat-v[0-9]+.[0-9]+
jobs:
build-and-test:
uses: ./.github/workflows/ci-jobs.yml
with:
checkout-repo: ${{ github.event.pull_request.head.repo.full_name }}
checkout-ref: ${{ github.event.pull_request.head.ref }}
secrets: inherit
if: github.repository_owner == 'cryostatio' && contains(github.event.pull_request.labels.*.name, 'safe-to-test')
push-to-ghcr:
runs-on: ubuntu-latest
needs: [build-and-test]
steps:
- name: Fail if needs-triage label applied
if: ${{ contains(github.event.pull_request.labels.*.name, 'needs-triage') }}
run: exit 1
- name: Fail if safe-to-test label NOT applied
if: ${{ !contains(github.event.pull_request.labels.*.name, 'safe-to-test') }}
run: exit 1
- uses: actions/download-artifact@v3
with:
name: cryostat
if: github.repository_owner == 'cryostatio'
- name: Load cryostat image
run: podman load -i cryostat.tar
if: github.repository_owner == 'cryostatio'
- name: Tag cryostat image
run: podman tag cryostat ghcr.io/${{ github.repository_owner }}/cryostat:pr-${{ github.event.number }}-${{ github.event.pull_request.head.sha }}
if: github.repository_owner == 'cryostatio'
- name: Push PR test image to ghcr.io
id: push-to-ghcr
uses: redhat-actions/push-to-registry@v2
with:
image: cryostat
tags: pr-${{ github.event.number }}-${{ github.event.pull_request.head.sha }}
registry: ghcr.io/${{ github.repository_owner }}
username: ${{ github.event.pull_request.user.login }}
password: ${{ secrets.GHCR_PR_TOKEN }}
if: github.repository_owner == 'cryostatio'
- name: Comment test image link
uses: thollander/actions-comment-pull-request@v1
with:
message: |-
Test image available:
```
$ CRYOSTAT_IMAGE=${{ steps.push-to-ghcr.outputs.registry-path }} sh smoketest.sh
```
if: github.repository_owner == 'cryostatio'