Skip to content

Commit

Permalink
[CI] Move native stats upload to separate reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
zakkak committed Jun 14, 2024
1 parent 831f374 commit bf4b30b
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 48 deletions.
32 changes: 6 additions & 26 deletions .github/workflows/base-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ env:
PYTHONIOENCODING: utf-8
QUARKUS_PATH: ${{ github.workspace }}\quarkus
MANDREL_PACKAGING_REPO: ${{ github.workspace }}\mandrel-packaging
COLLECTOR_URL: https://collector.foci.life/api/v1/image-stats

jobs:
build-vars:
Expand Down Expand Up @@ -533,36 +532,17 @@ jobs:

native-tests-stats-upload:
name: Upload build stats to collector
if: always() && inputs.build-stats-tag != 'null' && github.event_name != 'pull_request'
if: always() && inputs.build-stats-tag != 'null' && github.event_name != 'pull_request' && needs.native-tests.result != 'skipped' && needs.native-tests.result != 'cancelled'
needs:
- native-tests
- get-test-matrix
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.get-test-matrix.outputs.tests-matrix) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
if: startsWith(matrix.os-name, 'windows')
with:
repository: graalvm/mandrel
fetch-depth: 1
path: workflow-mandrel
- uses: actions/download-artifact@v4
if: startsWith(matrix.os-name, 'windows')
with:
name: build-stats-${{matrix.category}}-${{ needs.get-test-matrix.outputs.artifacts-suffix }}
path: .
- name: Extract and import build stats
if: startsWith(matrix.os-name, 'windows')
env:
UPLOAD_TOKEN: ${{ secrets.UPLOAD_COLLECTOR_TOKEN }}
shell: bash
run: |
tar -xf build-stats.tgz
export BUILD_STATS_TAG="$(echo ${{ inputs.build-stats-tag }})"
echo "Tag for stat upload is going to be: '${BUILD_STATS_TAG}'"
DIR=quarkus/ TAG="${BUILD_STATS_TAG}" TOKEN="${UPLOAD_TOKEN}" URL="${COLLECTOR_URL}" bash workflow-mandrel/.github/import_stats.sh
uses: ./.github/workflows/native-tests-stats-upload.yml
with:
artifacts-suffix: ${{ needs.get-test-matrix.outputs.artifacts-suffix }}
build-stats-tag: ${{ inputs.build-stats-tag }}
category: ${{ matrix.category }}

mandrel-integration-tests:
name: Q Mandrel IT
Expand Down
27 changes: 5 additions & 22 deletions .github/workflows/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ env:
QUARKUS_PATH: ${{ github.workspace }}/quarkus
MANDREL_IT_PATH: ${{ github.workspace }}/mandrel-integration-tests
MANDREL_PACKAGING_REPO: ${{ github.workspace }}/mandrel-packaging
COLLECTOR_URL: https://collector.foci.life/api/v1/image-stats

jobs:
build-vars:
Expand Down Expand Up @@ -628,28 +627,12 @@ jobs:
- native-tests
- get-test-matrix
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.get-test-matrix.outputs.tests-matrix) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: graalvm/mandrel
fetch-depth: 1
path: workflow-mandrel
- uses: actions/download-artifact@v4
with:
name: build-stats-${{matrix.category}}-${{ needs.get-test-matrix.outputs.artifacts-suffix }}
path: .
- name: Extract and import build stats
env:
UPLOAD_TOKEN: ${{ secrets.UPLOAD_COLLECTOR_TOKEN }}
shell: bash
run: |
tar -xf build-stats.tgz
export BUILD_STATS_TAG="$(echo ${{ inputs.build-stats-tag }})"
echo "Tag for stat upload is going to be: '${BUILD_STATS_TAG}'"
DIR=quarkus/ TAG="${BUILD_STATS_TAG}" TOKEN="${UPLOAD_TOKEN}" URL="${COLLECTOR_URL}" bash workflow-mandrel/.github/import_stats.sh
uses: ./.github/workflows/native-tests-stats-upload.yml
with:
artifacts-suffix: ${{ needs.get-test-matrix.outputs.artifacts-suffix }}
build-stats-tag: ${{ inputs.build-stats-tag }}
category: ${{ matrix.category }}

mandrel-integration-tests:
name: Q Mandrel IT
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/native-tests-stats-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Native tests stats upload

on:
workflow_call:
inputs:
artifacts-suffix:
type: string
description: 'The stats artifact suffix to download'
default: "null"
build-stats-tag:
type: string
description: 'The tag to use for build stats upload of native tests (e.g. 22.3.0-dev-jdk17-mytest-patch-before)'
default: "null"
category:
type: string
description: 'The native integration test category to upload stats for'
default: "null"
secrets:
UPLOAD_COLLECTOR_TOKEN:
description: 'A token used to report build statistics to a collector'
required: false

jobs:
native-tests-stats-upload:
name: Upload build stats to collector
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: graalvm/mandrel
fetch-depth: 1
path: workflow-mandrel
- uses: actions/download-artifact@v4
with:
name: build-stats-${{inputs.category}}-${{ inputs.artifacts-suffix }}
path: .
- name: Extract and import build stats
env:
BUILD_STATS_TAG: ${{ inputs.build-stats-tag }}
UPLOAD_TOKEN: ${{ secrets.UPLOAD_COLLECTOR_TOKEN }}
COLLECTOR_URL: https://collector.foci.life/api/v1/image-stats
shell: bash
run: |
tar -xf build-stats.tgz
echo "Tag for stat upload is going to be: '${BUILD_STATS_TAG}'"
DIR=quarkus/ TAG="${BUILD_STATS_TAG}" TOKEN="${UPLOAD_TOKEN}" URL="${COLLECTOR_URL}" bash workflow-mandrel/.github/import_stats.sh

0 comments on commit bf4b30b

Please sign in to comment.