diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5ca452d5b3..54659e1210 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -47,7 +47,7 @@ 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/ @@ -55,11 +55,9 @@ jobs: 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: @@ -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: @@ -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 diff --git a/repeated-integration-tests.bash b/repeated-integration-tests.bash index 599dde39a0..49513f2b26 100755 --- a/repeated-integration-tests.bash +++ b/repeated-integration-tests.bash @@ -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