Skip to content

Commit

Permalink
Allow disabling tests in workflow and do not remove artifacts when wo…
Browse files Browse the repository at this point in the history
…rkflow is successful
  • Loading branch information
mpfaff committed Apr 11, 2024
1 parent d838e1b commit 6e6ad5b
Showing 1 changed file with 10 additions and 47 deletions.
57 changes: 10 additions & 47 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ on:
make-arguments:
description: 'Additional make arguments'
required: false
run_tests:
description: 'Whether tests should be run after building'
type: boolean
required: false
default: true

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -299,6 +304,7 @@ jobs:
platform: linux-x64
bootjdk-platform: linux-x64
runs-on: ubuntu-22.04
if: github.event.inputs.run_tests

test-linux-x86:
name: linux-x86
Expand All @@ -309,6 +315,7 @@ jobs:
platform: linux-x86
bootjdk-platform: linux-x64
runs-on: ubuntu-22.04
if: github.event.inputs.run_tests

test-macos-x64:
name: macos-x64
Expand All @@ -319,6 +326,7 @@ jobs:
platform: macos-x64
bootjdk-platform: macos-x64
runs-on: macos-13
if: github.event.inputs.run_tests

test-macos-aarch64:
name: macos-aarch64
Expand All @@ -329,6 +337,7 @@ jobs:
platform: macos-aarch64
bootjdk-platform: macos-aarch64
runs-on: macos-14
if: github.event.inputs.run_tests

test-windows-x64:
name: windows-x64
Expand All @@ -339,50 +348,4 @@ jobs:
platform: windows-x64
bootjdk-platform: windows-x64
runs-on: windows-2019

# Remove bundles so they are not misconstrued as binary distributions from the JDK project
remove-bundles:
name: 'Remove bundle artifacts'
runs-on: ubuntu-22.04
if: always()
needs:
- build-linux-x64
- build-linux-x86
- build-linux-x64-hs-nopch
- build-linux-x64-hs-zero
- build-linux-x64-hs-minimal
- build-linux-x64-hs-optimized
- build-linux-cross-compile
- build-macos-x64
- build-macos-aarch64
- build-windows-x64
- build-windows-aarch64
- test-linux-x64
- test-linux-x86
- test-macos-x64
- test-windows-x64

steps:
# Hack to get hold of the api environment variables that are only defined for actions
- name: 'Get API configuration'
id: api
uses: actions/github-script@v7
with:
script: 'return { url: process.env["ACTIONS_RUNTIME_URL"], token: process.env["ACTIONS_RUNTIME_TOKEN"] }'

- name: 'Remove bundle artifacts'
run: |
# Find and remove all bundle artifacts
ALL_ARTIFACT_URLS="$(curl -s \
-H 'Accept: application/json;api-version=6.0-preview' \
-H 'Authorization: Bearer ${{ fromJson(steps.api.outputs.result).token }}' \
'${{ fromJson(steps.api.outputs.result).url }}_apis/pipelines/workflows/${{ github.run_id }}/artifacts?api-version=6.0-preview')"
BUNDLE_ARTIFACT_URLS="$(echo "$ALL_ARTIFACT_URLS" | jq -r -c '.value | map(select(.name|startswith("bundles-"))) | .[].url')"
for url in $BUNDLE_ARTIFACT_URLS; do
echo "Removing $url"
curl -s \
-H 'Accept: application/json;api-version=6.0-preview' \
-H 'Authorization: Bearer ${{ fromJson(steps.api.outputs.result).token }}' \
-X DELETE "$url" \
|| echo "Failed to remove bundle"
done
if: github.event.inputs.run_tests

0 comments on commit 6e6ad5b

Please sign in to comment.