Trigger ColdBox Modules Tests #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Trigger ColdBox Modules Tests | |
on: | |
workflow_dispatch: | |
inputs: | |
boxlang_commit: | |
type: string | |
required: true | |
description: Last commit in Boxlang's GitHub repository that triggered this workflow | |
permissions: | |
actions: write | |
contents: read | |
checks: write | |
env: | |
GITHUB_ORGANIZATION: coldbox-modules | |
REGEX_BOXLANG: .*boxlang.* | |
jobs: | |
trigger: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
repositories: ["cbSwagger", "cbdebugger", "cbjavaloader"] | |
fail-fast: false | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Trigger ColdBox Module | |
uses: convictional/[email protected] | |
with: | |
owner: ${{ env.GITHUB_ORGANIZATION }} | |
repo: ${{ matrix.repositories }} | |
github_token: ${{ secrets.PAT_GITHUB }} | |
workflow_file_name: snapshot.yml | |
ref: development | |
wait_interval: 120 | |
propagate_failure: false | |
trigger_workflow: true | |
wait_workflow: true | |
id: trigger | |
- name: Download Tests | |
uses: actions/download-artifact@v4 | |
id: download-tests | |
with: | |
pattern: '*boxlang*' | |
path: ${{ matrix.repositories }}-tests | |
github-token: ${{ secrets.PAT_GITHUB }} | |
repository: ${{ env.GITHUB_ORGANIZATION }}/${{ matrix.repositories }} | |
run-id: ${{ steps.trigger.outputs.workflow_id }} | |
- name: Check if there is downloads | |
id: list-download-folder | |
uses: Drafteame/list-folders-action@main | |
with: | |
paths: | | |
${{ steps.download-tests.outputs.download-path }} | |
- name: What is in download folder | |
run: | | |
pwd | |
ls -la | |
tree . | |
- name: Publish Test Results if present | |
if: ${{ steps.list-download-folder.outputs.total > 0 }} | |
id: publish-test-results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
junit_files: ${{ matrix.repositories }}-tests/**/*.xml | |
check_name: "${{ matrix.repositories }}-publishied-unit-tests" | |
action_fail_on_inconclusive: true | |
#commit: ${{ inputs.boxlang_commit }} | |
#compare_to_earlier_commit: false | |
- name: Upload Test Results if present | |
if: ${{ steps.list-download-folder.outputs.total > 0 }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.repositories }}-unit-tests | |
path: | | |
${{ matrix.repositories }}-tests/**/* | |
- name: Retrieve job logs | |
if: ${{ fromJson( steps.publish-test-results.outputs.json ).conclusion == 'failure' || steps.publish-test-results.outcome != 'skipped' }} | |
id: get-testbox-logs | |
run: | | |
echo ${{ secrets.PAT_GITHUB }} | gh auth login --with-token | |
job_id=$(gh api "/repos/${{ env.GITHUB_ORGANIZATION }}/${{ matrix.repositories }}/actions/runs/${{ steps.trigger.outputs.workflow_id }}/jobs" | jq '.jobs[] | select(.name | test("${{ env.REGEX_BOXLANG }}"))' | jq -r '.id') | |
gh api "/repos/${{ env.GITHUB_ORGANIZATION }}/${{ matrix.repositories }}/actions/jobs/$job_id/logs" > "${{ steps.trigger.outputs.workflow_id }}-$job_id.log" | |
- name: Updload jobs logs for Boxlang tests | |
if: ${{ fromJson( steps.publish-test-results.outputs.json ).conclusion == 'failure' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.repositories }}-job-logs | |
path: "**/*.log" | |
- name: Get Boxlang tests job status | |
run: | | |
echo ${{ secrets.PAT_GITHUB }} | gh auth login --with-token | |
job_conclusion=$(gh api "/repos/${{ env.GITHUB_ORGANIZATION }}/${{ matrix.repositories }}/actions/runs/${{ steps.trigger.outputs.workflow_id }}/jobs" | jq '.jobs[] | select(.name | test("${{ env.REGEX_BOXLANG }}"))' | jq -r '.conclusion') | |
echo "JOB_CONCLUSION=$job_conclusion" >> $GITHUB_ENV | |
echo "Conclusion for Boxlang tests in repository ${{ matrix.repositories }} is $job_conclusion triggered by:" | |
echo "https://github.com/ortus-boxlang/BoxLang/commit/${{ inputs.boxlang_commit }}" |