PR-Test #3708
Workflow file for this run
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: PR-Test | |
on: | |
pull_request: | |
merge_group: | |
permissions: | |
contents: read | |
jobs: | |
determine-workflows-to-run: | |
name: Determine workflows to run | |
runs-on: ubuntu-latest | |
outputs: | |
run_docs: ${{ steps.check_files.outputs.run_docs }} | |
run_tests: ${{ steps.check_files.outputs.run_tests }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: check modified files | |
id: check_files | |
run: | | |
echo "run_docs=false" >> $GITHUB_OUTPUT | |
echo "run_tests=false" >> $GITHUB_OUTPUT | |
echo "=============== list modified files ===============" | |
git diff --name-only HEAD^ HEAD | |
echo "========== check paths of modified files ==========" | |
git diff --name-only HEAD^ HEAD > files.txt | |
while IFS= read -r file | |
do | |
echo $file | |
if [[ $file != documentation/* ]]; then | |
echo "This modified file is not under the 'documentation' folder. Will run tests." | |
echo "run_tests=true" >> $GITHUB_OUTPUT | |
else | |
echo "This modified file is under the 'documentation' folder. Will run docs workflow." | |
echo "run_docs=true" >> $GITHUB_OUTPUT | |
fi | |
done < files.txt | |
api_check: | |
needs: [ determine-workflows-to-run ] | |
if: ${{ github.repository == 'kotest/kotest' && needs.determine-workflows-to-run.outputs.run_tests == 'true' }} | |
uses: ./.github/workflows/run-gradle.yml | |
with: | |
runs-on: ubuntu-latest | |
ref: ${{ inputs.ref }} | |
task: apiCheck | |
test_linux: | |
needs: [ api_check, determine-workflows-to-run ] | |
if: ${{ github.repository == 'kotest/kotest' && needs.determine-workflows-to-run.outputs.run_tests == 'true' }} | |
strategy: | |
matrix: | |
target: | |
- jvmTest | |
- jsTest | |
- wasmJsTest | |
- linuxX64Test linuxArm64TestKlibrary | |
- androidNativeX86TestKlibrary androidNativeX64TestKlibrary androidNativeArm32TestKlibrary androidNativeArm64TestKlibrary | |
- :kotest-framework:kotest-framework-multiplatform-plugin-gradle:test | |
uses: ./.github/workflows/run-gradle.yml | |
with: | |
runs-on: ubuntu-latest | |
ref: ${{ inputs.ref }} | |
task: ${{ matrix.target }} | |
test_mac: | |
needs: [ test_linux, determine-workflows-to-run ] | |
if: ${{ github.repository == 'kotest/kotest' && needs.determine-workflows-to-run.outputs.run_tests == 'true' }} | |
strategy: | |
fail-fast: true | |
matrix: | |
target: | |
- macosX64Test macosArm64Test | |
- iosX64Test iosSimulatorArm64Test iosArm64TestKlibrary | |
- tvosX64Test tvosArm64TestKlibrary tvosSimulatorArm64Test | |
- watchosArm32TestKlibrary watchosArm64TestKlibrary watchosX64Test watchosSimulatorArm64Test watchosDeviceArm64TestKlibrary | |
uses: ./.github/workflows/run-gradle.yml | |
with: | |
runs-on: macos-latest | |
ref: ${{ inputs.ref }} | |
task: ${{ matrix.target }} | |
test_windows: | |
needs: [ api_check, determine-workflows-to-run ] | |
if: ${{ github.repository == 'kotest/kotest' && needs.determine-workflows-to-run.outputs.run_tests == 'true' }} | |
uses: ./.github/workflows/run-gradle.yml | |
with: | |
runs-on: windows-latest | |
ref: ${{ inputs.ref }} | |
task: mingwX64Test | |
test_docs: | |
needs: [ determine-workflows-to-run ] | |
if: ${{ github.repository == 'kotest/kotest' && needs.determine-workflows-to-run.outputs.run_docs == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ inputs.ref }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18.4.0' | |
- name: Build static docusaurus pages | |
run: | | |
npm --prefix documentation ci | |
npm --prefix documentation run build | |
finalize: | |
# see https://github.community/t/status-check-for-a-matrix-jobs/127354/7 | |
name: Final PR results | |
needs: [ api_check, test_linux, test_mac, test_windows, test_docs ] | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check all job status | |
# see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context | |
# see https://stackoverflow.com/a/67532120/4907315 | |
# Note: skipped results are OK in our case, we don't run code tests if there's only docs changes | |
if: >- | |
${{ | |
contains(needs.*.result, 'failure') | |
|| contains(needs.*.result, 'cancelled') | |
}} | |
run: exit 1 |