forked from cryostatio/cryostat
-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (124 loc) · 4.37 KB
/
push-ci.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
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
name: CI build and push
concurrency:
group: ci-${{ github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 1' # every Monday at midnight
push:
branches:
- main
- v[0-9]+
- v[0-9]+.[0-9]+
- cryostat-v[0-9]+.[0-9]+
env:
CI_USER: cryostat+bot
CI_REGISTRY: quay.io/cryostat
CI_IMG: quay.io/cryostat/cryostat
jobs:
get-pom-properties:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- id: query-pom
name: Get properties from POM
# Query POM image version and save as output parameter
run: |
IMAGE_VERSION="$(mvn -q -DforceStdout validate help:evaluate -Dexpression=quarkus.application.version)"
echo "::set-output name=image-version::$IMAGE_VERSION"
outputs:
image-version: ${{ steps.query-pom.outputs.image-version }}
build-and-test:
# runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: [get-pom-properties]
strategy:
matrix:
# java: [ '17', '21' ]
java: ['17']
env:
IMAGE_VERSION: ${{ needs.get-pom-properties.outputs.image-version }}
cache-name: cache-yarn
name: Build and test Java ${{ matrix.java }}
permissions:
packages: write
contents: read
if: ${{ github.repository_owner == 'cryostatio' }}
steps:
- name: Install qemu
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'maven'
- run: git submodule init && git submodule update
- name: Cache yarn packages
uses: actions/cache@v3
with:
path: "./src/main/webui/.yarn/cache"
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Initialize web assets
run: |
cd src/main/webui
yarn install && yarn yarn:frzinstall
cd -
- name: Ensure podman 4+ and podman-docker installed
run: sudo apt update && sudo apt -y satisfy "podman (>= 4.0), podman-docker"
- name: Set up testcontainers for podman
run: |
echo ryuk.container.privileged=true > ~/.testcontainers.properties
echo docker.client.strategy=org.testcontainers.dockerclient.UnixSocketClientProviderStrategy >> ~/.testcontainers.properties
echo testcontainers.reuse.enable=false >> ~/.testcontainers.properties
- name: Start Podman API
run: systemctl --user enable --now podman.socket
- name: Set DOCKER_HOST environment variable
run: echo "DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock" >> "$GITHUB_ENV"
- name: Build application
run: ./mvnw -B -U -Dquarkus.container-image.additional-tags= clean verify
continue-on-error: ${{ matrix.java != '17' }}
- name: Delete local integration test image
run: podman rmi ${{ env.CI_IMG }}:${{ env.IMAGE_VERSION }}
continue-on-error: true
- name: Build container images and manifest
if: ${{ matrix.java == '17' && github.repository_owner == 'cryostatio' }}
id: buildah-build
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.CI_IMG }}
oci: true
archs: amd64, arm64
tags: ${{ env.IMAGE_VERSION }} ${{ github.ref == 'refs/heads/main' && 'latest' || '' }}
extra-args: |
--ulimit=nofile=4096:4096
--ignorefile=.dockerignore.builder
--jobs=2
containerfiles: |
./src/main/docker/Dockerfile.builder
- name: Push to quay.io
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
with:
image: cryostat
tags: ${{ steps.buildah-build.outputs.tags }}
registry: ${{ env.CI_REGISTRY }}
username: ${{ env.CI_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
if: ${{ matrix.java == '17' && github.repository_owner == 'cryostatio' }}
- name: Print image URL
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
if: ${{ matrix.java == '17' && github.repository_owner == 'cryostatio' }}