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

feat(ci): add status check for new workflow #290

Merged
merged 2 commits into from
Nov 1, 2023
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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install qemu
if: ${{ inputs.build-arch != 'amd64' }}
if: ${{ matrix.arch != 'amd64' }}
continue-on-error: true
run: |
sudo apt-get update
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
strategy:
matrix:
arch: [amd64, arm64]
outputs:
outputs:
amd64_image: ${{ steps.amd64_image.outputs.image }}
arm64_image: ${{ steps.arm64_image.outputs.image }}
permissions:
Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:
- name: Create markdown table
id: md-table
uses: petems/[email protected]
with:
with:
csvinput: |
ARCH, IMAGE
amd64, ${{ env.amd64_image }}
Expand All @@ -153,7 +153,7 @@ jobs:

To run smoketest:
```
# amd64
# amd64
CRYOSTAT_IMAGE=${{ env.amd64_image }} sh smoketest.sh

# or arm64
Expand Down
42 changes: 40 additions & 2 deletions .github/workflows/cryostat-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ jobs:
content: "+1",
});

checkout-branch:
checkout-branch:
runs-on: ubuntu-latest
needs: [check-before-build]
outputs:
outputs:
PR_head_ref: ${{ fromJSON(steps.comment-branch.outputs.result).ref }}
PR_head_sha: ${{ fromJSON(steps.comment-branch.outputs.result).sha }}
PR_num: ${{ fromJSON(steps.comment-branch.outputs.result).num }}
Expand Down Expand Up @@ -97,6 +97,7 @@ jobs:
username: ${{ github.event.comment.user.login }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: pull cryostat image
id: pull-image
run: podman pull ghcr.io/${{ github.repository_owner }}/cryostat-core:pr-${{ needs.checkout-branch.outputs.PR_num }}-${{ needs.checkout-branch.outputs.PR_head_sha }}-linux-${{ env.build_arch }}
- name: tag cryostat image
run: podman tag ghcr.io/${{ github.repository_owner }}/cryostat-core:pr-${{ needs.checkout-branch.outputs.PR_num }}-${{ needs.checkout-branch.outputs.PR_head_sha }}-linux-${{ env.build_arch }} quay.io/cryostat/cryostat
Expand All @@ -110,3 +111,40 @@ jobs:
- name: Print itest container logs
if: failure()
run: ls -1dt target/cryostat-*.server.log | head -n1 | xargs cat
- name: Add workflow result as comment on PR
uses: actions/github-script@v6
if: always()
with:
script: |
const name = '${{ github.workflow }}';
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
const success = '${{ job.status }}' === 'success';
const body = `${name}: ${success ? 'All tests pass ✅' : 'At least one test failed ❌'}\n${url}`;

await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})

- name: Leave a comment on pull failure
uses: actions/github-script@v6
if: always() && steps.pull-image.outcome != 'success'
with:
script: |
const body = `Image does not exist! Please wait for the initial build and push to complete before using \`/build_test\` command.`;
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})

- name: Set latest commit status as ${{ job.status }}
uses: myrotvorets/set-commit-status-action@master
if: always()
with:
sha: ${{ needs.checkout-branch.outputs.PR_head_sha}}
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
Loading