Merge branch 'main' into gh_pr #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | ||
workflow_call: | ||
inputs: | ||
checkout-repo: | ||
required: false | ||
type: string | ||
checkout-ref: | ||
required: false | ||
type: string | ||
build-arch: | ||
required: true | ||
type: string | ||
skip-itests: | ||
required: false | ||
type: boolean | ||
default: false | ||
outputs: | ||
image-version: | ||
description: the Cryostat application version that will be built | ||
value: ${{ jobs.get-pom-properties.outputs.image-version }} | ||
secrets: | ||
GH_PKGS_READ_TOKEN: | ||
required: true | ||
description: read-only token for pulling artifacts from GitHub Packages | ||
issue_comment: | ||
types: | ||
- created | ||
jobs: | ||
get-pom-properties: | ||
runs-on: ubuntu-latest | ||
if: github.event.issue.pull_request && contains(github.event.comment.body, '/build-test') | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: ${{ inputs.checkout-repo }} | ||
ref: ${{ inputs.checkout-ref }} | ||
- id: query-pom | ||
name: Get properties from POM | ||
# Query POM for image version and save as output parameter | ||
run: | | ||
IMAGE_VERSION="$(mvn validate help:evaluate -Dexpression=cryostat.imageVersionLower -q -DforceStdout)" | ||
echo "::set-output name=image-version::$IMAGE_VERSION" | ||
outputs: | ||
image-version: ${{ steps.query-pom.outputs.image-version }} | ||
build-image: | ||
runs-on: ubuntu-latest | ||
if: github.event.issue.pull_request && contains(github.event.comment.body, '/build-test') | ||
needs: [get-pom-properties] | ||
if: github.event.issue.pull_request && contains(github.event.comment.body, '/build-test') | ||
steps: | ||
- name: Install qemu | ||
if: ${{ inputs.build-arch != 'amd64' }} | ||
continue-on-error: true | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y qemu-user-static | ||
- uses: actions/checkout@v2 | ||
if: always() | ||
with: | ||
repository: ${{ inputs.checkout-repo }} | ||
ref: ${{ inputs.checkout-ref }} | ||
submodules: true | ||
fetch-depth: 0 | ||
- uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
- name: maven-settings | ||
uses: s4u/maven-settings-action@v2 | ||
with: | ||
servers: '[{"id": "github", "username": "dummy", "password": "${env.GITHUB_TOKEN_REF}"}]' | ||
githubServer: false | ||
- uses: skjolber/maven-cache-github-action@v1 | ||
with: | ||
step: restore | ||
- run: git submodule init | ||
- run: git submodule update --remote | ||
- run: mvn -B -U -Dbuild.arch=${{ inputs.build-arch }} clean package | ||
env: | ||
GITHUB_TOKEN_REF: ${{ secrets.GH_PKGS_READ_TOKEN }} | ||
- name: Save cryostat image | ||
run: podman save -o cryostat-${{ inputs.build-arch }}.tar --format oci-archive quay.io/cryostat/cryostat | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: cryostat-${{ inputs.build-arch }} | ||
path: /home/runner/work/cryostat/cryostat/cryostat-${{ inputs.build-arch }}.tar | ||
- uses: skjolber/maven-cache-github-action@v1 | ||
with: | ||
step: save | ||
integration-tests: | ||
runs-on: ubuntu-latest | ||
needs: [build-image] | ||
if: ${{ ! inputs.skip-itests }} && github.event.issue.pull_request && contains(github.event.comment.body, '/build-test') | ||
steps: | ||
- name: Install xpath | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libxml-xpath-perl | ||
- name: Install qemu | ||
if: ${{ inputs.build-arch != 'amd64' }} | ||
continue-on-error: true | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y qemu-user-static | ||
- uses: actions/checkout@v2 | ||
if: always() | ||
with: | ||
repository: ${{ inputs.checkout-repo }} | ||
ref: ${{ inputs.checkout-ref }} | ||
submodules: true | ||
fetch-depth: 0 | ||
- uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: cryostat-${{ inputs.build-arch }} | ||
- name: Load cryostat image | ||
run: podman load -i cryostat-${{ inputs.build-arch }}.tar | ||
- uses: skjolber/maven-cache-github-action@v1 | ||
with: | ||
step: restore | ||
- name: Run integration tests | ||
run: POD_NAME=cryostat-itests CONTAINER_NAME=cryostat-itest ITEST_IMG_VERSION=latest bash repeated-integration-tests.bash | ||
- name: Print itest logs | ||
if: failure() | ||
run: ls -1dt target/cryostat-itest-*.log | head -n1 | xargs cat | ||
- name: Print itest container logs | ||
if: failure() | ||
run: ls -1dt target/cryostat-*.server.log | head -n1 | xargs cat | ||
- uses: skjolber/maven-cache-github-action@v1 | ||
with: | ||
step: save |