Skip to content

Commit

Permalink
build_test command enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
aali309 committed Sep 22, 2023
1 parent e5ac66e commit a2fb590
Showing 1 changed file with 65 additions and 8 deletions.
73 changes: 65 additions & 8 deletions .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ on:
jobs:
check-before-build:
runs-on: ubuntu-latest
if: github.repository_owner == 'cryostatio' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/build_test')
if: github.repository_owner == 'cryostatio' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/build_test') || startsWith(github.event.comment.body, '/retest'))
permissions:
pull-requests: write
steps:
- name: Fail if needs-triage label applied
- name: Fail if needs-triage label applied
if: ${{ contains(github.event.issue.labels.*.name, 'needs-triage') }}
run: exit 1
- name: Show warning if permission is denied
Expand All @@ -43,12 +43,12 @@ jobs:
repo,
comment_id: context.payload.comment.id,
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 All @@ -73,9 +73,42 @@ jobs:
with:
checkout-repo: ${{ needs.checkout-branch.outputs.PR_repo }}
checkout-ref: ${{ needs.checkout-branch.outputs.PR_head_ref }}

start-comment:
runs-on: ubuntu-latest
steps:
- name: Capture Date and Time
id: date-time
run: echo "::set-output name=date-time::$(date +'%Y-%m-%d %H:%M:%S')"
- name: Start Comment
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Workflow started at ${{steps.date-time.outputs.date-time}}.
build-and-test:
needs: [code-analysis, checkout-branch]
strategy:
matrix:
arch: [amd64, arm64]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: build-test
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' }}
- name: Set BUILD_TEST_EXECUTED flag
id: set-build-test-executed
run: echo "BUILD_TEST_EXECUTED=true" >> $GITHUB_ENV

retest-integration:
needs: [code-analysis, checkout-branch, build-and-test]
if: startsWith(github.event.comment.body, '/retest') && env.BUILD_TEST_EXECUTED == 'true'
strategy:
matrix:
arch: [amd64, arm64]
Expand All @@ -85,14 +118,38 @@ jobs:
checkout-repo: ${{ needs.checkout-branch.outputs.PR_repo }}
checkout-ref: ${{ needs.checkout-branch.outputs.PR_head_ref }}
skip-itests: ${{ matrix.arch != 'amd64' }}

check-test-results:
runs-on: ubuntu-latest
needs: [build-and-test]
steps:
- name: Check Test Results
id: check-results
run: |
if [ ... ]; then
echo "Tests passed."
echo "::set-output name=test-status::success"
else
echo "Tests failed."
echo "::set-output name=test-status::failure"
continue-on-error: true
- name: Capture Date and Time
id: date-time
run: echo "::set-output name=date-time::$(date +'%Y-%m-%d %H:%M:%S')"
- name: Comment on PR
if: ${{ always() }}
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Tests status: ${{ steps.check-results.outputs.test-status }} at ${{ steps.date-time.outputs.date-time }}.
push-to-ghcr:
runs-on: ubuntu-latest
needs: [build-and-test, checkout-branch]
strategy:
matrix:
arch: [amd64, arm64]
outputs:
outputs:
amd64_image: ${{ steps.amd64_image.outputs.image }}
arm64_image: ${{ steps.arm64_image.outputs.image }}
env:
Expand Down Expand Up @@ -138,7 +195,7 @@ jobs:
- name: Create markdown table
id: md-table
uses: petems/[email protected]
with:
with:
csvinput: |
ARCH, IMAGE
amd64, ${{ env.amd64_image }}
Expand All @@ -150,7 +207,7 @@ jobs:
To run smoketest:
```
# amd64
# amd64
CRYOSTAT_IMAGE=${{ env.amd64_image }} sh smoketest.sh
# or arm64
Expand Down

0 comments on commit a2fb590

Please sign in to comment.