Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(tests): split container/compile-build and itests run steps in ci #1138

Merged
merged 20 commits into from
Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 91 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,17 @@ jobs:
with:
step: restore
- run: mvn -B -U -DskipTests=true clean install
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cryostat-core
path: /home/runner/.m2/repository/io/cryostat/cryostat-core/
- uses: skjolber/maven-cache-github-action@v1
with:
step: save

build:
build-image:
runs-on: ubuntu-latest
needs: [get-pom-properties, build-deps]
env:
CRYOSTAT_IMG: quay.io/cryostat/cryostat
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -72,16 +70,102 @@ jobs:
- uses: skjolber/maven-cache-github-action@v1
with:
step: restore
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: cryostat-core
path: /home/runner/.m2/repository/io/cryostat/cryostat-core/
- run: git submodule init
- run: git submodule update --remote
- run: mvn -B -U clean verify
- run: mvn -B -U clean package
- name: Save cryostat image
run: podman save -o cryostat.tar --format oci-archive quay.io/cryostat/cryostat
- uses: actions/upload-artifact@v3
with:
name: cryostat
path: /home/runner/work/cryostat/cryostat/cryostat.tar
- uses: skjolber/maven-cache-github-action@v1
with:
step: save

integration-tests:
runs-on: ubuntu-latest
needs: [build-image]
steps:
- uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- uses: actions/download-artifact@v3
with:
name: cryostat
- name: Load cryostat image
run: podman load -i cryostat.tar
- uses: skjolber/maven-cache-github-action@v1
with:
step: restore
- name: Run integration tests
run: POD_NAME=cryostat-itests CONTAINER_NAME=cryostat-itest bash repeated-integration-tests.bash
- name: Print itest logs
if: ${{ failure() }}
run: ls -1dt target/cryostat-itest-*.log | head -n1 | xargs cat
run: ls -1dt target/cryostat-itests-*.log | head -n1 | xargs cat
- uses: skjolber/maven-cache-github-action@v1
with:
step: save

spotless:
runs-on: ubuntu-latest
needs: [build-image]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- uses: skjolber/maven-cache-github-action@v1
with:
step: restore
- name: Run spotless
run: mvn spotless:check

spotbugs:
runs-on: ubuntu-latest
needs: [build-image]
steps:
- uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0
- uses: skjolber/maven-cache-github-action@v1
with:
step: restore
- uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- name: Run spotbugs
run: mvn compile spotbugs:check

shellcheck:
runs-on: ubuntu-latest
needs: [build-image]
steps:
- uses: actions/checkout@v2
- uses: skjolber/maven-cache-github-action@v1
with:
step: restore
- name: Run shellcheck
run: mvn shellcheck:check

push-to-quay:
runs-on: ubuntu-latest
needs: [integration-tests, spotless, spotbugs, shellcheck]
env:
CRYOSTAT_IMG: quay.io/cryostat/cryostat
steps:
- name: Tag images
id: tag-image
env:
Expand All @@ -96,9 +180,6 @@ jobs:
echo "::set-output name=tags::$IMAGE_VERSION"
fi
if: ${{ github.event_name == 'push' && github.repository_owner == 'cryostatio' }}
- uses: skjolber/maven-cache-github-action@v1
with:
step: save
- name: Push to quay.io
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
Expand Down
9 changes: 7 additions & 2 deletions repeated-integration-tests.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ if [ -z "${MVN}" ]; then
MVN="$(which mvn)"
fi

POD_NAME="$(xpath -q -e 'project/properties/cryostat.itest.podName/text()' pom.xml)"
CONTAINER_NAME="$(xpath -q -e 'project/properties/cryostat.itest.containerName/text()' pom.xml)"
if [ -z "${POD_NAME}" ]; then
POD_NAME="$(xpath -q -e 'project/properties/cryostat.itest.podName/text()' pom.xml)"
fi

if [ -z "${CONTAINER_NAME}" ]; then
CONTAINER_NAME="$(xpath -q -e 'project/properties/cryostat.itest.containerName/text()' pom.xml)"
fi

function cleanup() {
if podman pod exists "${POD_NAME}"; then
Expand Down