Skip to content

Commit

Permalink
Merge pull request #92 from aali309/testWithForkedMain7
Browse files Browse the repository at this point in the history
feat(ci): testing7
  • Loading branch information
aali309 authored Oct 24, 2023
2 parents 7f70e64 + c2fe10c commit a7b4360
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 109 deletions.
50 changes: 6 additions & 44 deletions .github/workflows/ci-build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,49 +94,11 @@ jobs:
step: save

integration-tests:
runs-on: ubuntu-latest
needs: [build-image]
if: ${{ !inputs.skip-itests && !inputs.run-tests-only }}
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@v4
if: always()
with:
repository: ${{ inputs.checkout-repo }}
ref: ${{ inputs.checkout-ref }}
submodules: true
fetch-depth: 0
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Download Cryostat Image Artifact
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

strategy:
matrix:
arch: [amd64, arm64]
uses: ./.github/workflows/integrated-test.yml
with:
build-arch: ${{ matrix.arch }}
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ permissions:


jobs:
retest-integration-tests: #testing
retest-integration-tests: #test
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
pull-requests: write
steps:
Expand All @@ -55,12 +53,19 @@ jobs:
- name: maven-settings
uses: s4u/maven-settings-action@v2
with:
servers: '[{"id": "github", "username": "dummy", "password": "${{ env.GITHUB_TOKEN }}"}]'
githubServer: true
- name: ghcr login
uses: redhat-actions/podman-login@v1
with:
registry: ghcr.io/${{ github.repository_owner }}
username: ${{ github.event.comment.user.login }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull cryostat image
run: podman pull ghcr.io/${{ github.repository_owner }}/cryostat:pr-${{ inputs.pr-number }}-${{ inputs.sha-value }}-linux-${{ inputs.build-arch }}
- name: Run integration tests
run: POD_NAME=cryostat-itests CONTAINER_NAME=cryostat-itest ITEST_IMG_VERSION=latest bash repeated-integration-tests.bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Print itest logs
if: failure()
run: ls -1dt target/cryostat-itest-*.log | head -n1 | xargs cat
Expand Down
122 changes: 61 additions & 61 deletions .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,32 +73,6 @@ jobs:
with:
checkout-repo: ${{ needs.checkout-branch.outputs.PR_repo }}
checkout-ref: ${{ needs.checkout-branch.outputs.PR_head_ref }}

build-and-test:
needs: [code-analysis, checkout-branch]
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/build_test')
strategy:
matrix:
arch: [amd64, arm64]
uses: ./.github/workflows/ci-build-image.yml
with:
build-arch: ${{ matrix.arch }}
checkout-repo: ${{ needs.checkout-branch.outputs.PR_repo }}
checkout-ref: ${{ needs.checkout-branch.outputs.PR_head_ref }}
skip-itests: ${{ matrix.arch != 'amd64' }}

# Add a new step to use /retest
retest-integration:
needs: [checkout-branch]
if: contains(github.event.comment.body, '/retest')
strategy:
matrix:
arch: [amd64, arm64]
uses: ./.github/workflows/retest-integrated-test.yml
with:
build-arch: ${{ matrix.arch }}
pr-number: ${{ github.event.issue.number }}
sha-value: ${{ needs.checkout-branch.outputs.PR_head_sha }}

start-comment:
runs-on: ubuntu-latest
Expand All @@ -118,44 +92,10 @@ jobs:
body: commentBody
});
build-and-test-pass:
runs-on: ubuntu-latest
needs: [build-and-test]
steps:
- name: Leave Actions Run Comment
uses: actions/github-script@v6
with:
script: |
const runURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${{ github.run_id }}`;
const commentBody = `build-and-test: All tests pass ✅. \n[View Actions Run](${runURL}).`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
retest-integration-pass:
runs-on: ubuntu-latest
needs: [retest-integration]
steps:
- name: Leave Actions Run Comment
uses: actions/github-script@v6
with:
script: |
const runURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${{ github.run_id }}`;
const commentBody = `retest Integration: All tests pass ✅. \n[View Actions Run](${runURL}).`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
push-to-ghcr:
runs-on: ubuntu-latest
if: startsWith(github.event.comment.body, '/build_test')
needs: [build-and-test, checkout-branch]
needs: [checkout-branch]
strategy:
matrix:
arch: [amd64, arm64]
Expand Down Expand Up @@ -224,3 +164,63 @@ jobs:
# or arm64
CRYOSTAT_IMAGE=${{ env.arm64_image }} sh smoketest.sh
```
build-and-test:
needs: [code-analysis, checkout-branch]
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/build_test')
strategy:
matrix:
arch: [amd64, arm64]
uses: ./.github/workflows/ci-build-image.yml
with:
build-arch: ${{ matrix.arch }}
checkout-repo: ${{ needs.checkout-branch.outputs.PR_repo }}
checkout-ref: ${{ needs.checkout-branch.outputs.PR_head_ref }}
skip-itests: ${{ matrix.arch != 'amd64' }}

# Add a new step to use /retest
retest-integration:
needs: [checkout-branch]
if: contains(github.event.comment.body, '/retest')
strategy:
matrix:
arch: [amd64, arm64]
uses: ./.github/workflows/integrated-test.yml
with:
build-arch: ${{ matrix.arch }}
pr-number: ${{ github.event.issue.number }}
sha-value: ${{ needs.checkout-branch.outputs.PR_head_sha }}

build-and-test-pass:
runs-on: ubuntu-latest
needs: [build-and-test]
steps:
- name: Leave Actions Run Comment
uses: actions/github-script@v6
with:
script: |
const runURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${{ github.run_id }}`;
const commentBody = `build-and-test: All tests pass ✅. \n[View Actions Run](${runURL}).`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
retest-integration-pass:
runs-on: ubuntu-latest
needs: [retest-integration]
steps:
- name: Leave Actions Run Comment
uses: actions/github-script@v6
with:
script: |
const runURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${{ github.run_id }}`;
const commentBody = `retest Integration: All tests pass ✅. \n[View Actions Run](${runURL}).`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});

0 comments on commit a7b4360

Please sign in to comment.