summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2024-03-10 21:32:50 +0900
committerGitHub <noreply@github.com>2024-03-10 12:32:50 +0000
commit8e3cb69a83fea488d7fa279a872fba73326d2ed2 (patch)
tree50e4e6af6e54466506664bc06383823ee7ac8ee3
parentd94ad002526f0e4b515417644027e54717c4c5e8 (diff)
Report to Launchable at post-run
Instead of separate two actions, register the post run at setup. Co-authored-by: Naoto Ono <onoto1998@gmail.com>
-rw-r--r--.github/actions/launchable/record-test/action.yml40
-rw-r--r--.github/actions/launchable/setup/action.yml59
-rw-r--r--.github/workflows/macos.yml14
-rw-r--r--.github/workflows/ubuntu.yml14
4 files changed, 64 insertions, 63 deletions
diff --git a/.github/actions/launchable/record-test/action.yml b/.github/actions/launchable/record-test/action.yml
deleted file mode 100644
index 51ad6b086e..0000000000
--- a/.github/actions/launchable/record-test/action.yml
+++ /dev/null
@@ -1,40 +0,0 @@
-name: Record tests in Launchable
-description: >-
- Upload the test results to Launchable
-
-inputs:
- os:
- required: true
- description: An operating system that CI runs on. This value is used in Launchable flavor.
-
- report-path:
- default: launchable_reports.json
- required: true
- description: A file path of the test report for uploading to Launchable
-
- test-opts:
- default: none
- required: false
- description: >-
- Test options that determine how tests are run.
- This value is used in the Launchable flavor.
-
- srcdir:
- required: false
- default: ${{ github.workspace }}
- description: >-
- Directory to (re-)checkout source codes. Launchable retrives the commit information
- from the directory.
-
-outputs: {} # nothing?
-
-runs:
- using: composite
-
- steps:
- - name: Launchable - record tests
- working-directory: ${{ inputs.srcdir }}
- shell: bash
- run: |
- test_opts="$(echo ${{ inputs.test-opts }} | sed 's/=/:/g' | sed 's/ //g')"
- launchable record tests --flavor os=${{ inputs.os }} --flavor test_task=${{ matrix.test_task }} --flavor test_opts=${test_opts} raw ${{ inputs.report-path }}
diff --git a/.github/actions/launchable/setup/action.yml b/.github/actions/launchable/setup/action.yml
index 1bc0b55d64..458b0c7d72 100644
--- a/.github/actions/launchable/setup/action.yml
+++ b/.github/actions/launchable/setup/action.yml
@@ -8,12 +8,29 @@ inputs:
required: true
description: The file path of the test report for uploading to Launchable
+ os:
+ required: true
+ description: The operating system that CI runs on. This value is used in Launchable flavor.
+
+ test-opts:
+ default: none
+ required: false
+ description: >-
+ Test options that determine how tests are run.
+ This value is used in the Launchable flavor.
+
launchable-token:
required: false
description: >-
Launchable token is needed if you want to run Launchable on your forked repository.
See https://github.com/ruby/ruby/wiki/CI-Servers#launchable-ci for details.
+ builddir:
+ required: false
+ default: ${{ github.workspace }}
+ description: >-
+ Directory to create Launchable report file.
+
srcdir:
required: false
default: ${{ github.workspace }}
@@ -81,7 +98,8 @@ runs:
pip install --user launchable
launchable verify
: # The build name cannot include a slash, so we replace the string here.
- github_ref="$(echo ${{ github.ref }} | sed 's/\//_/g')"
+ github_ref="${{ github.ref }}"
+ github_ref="${github_ref//\//_}"
: # With the --name option, we need to configure a unique identifier for this build.
: # To avoid setting the same build name as the CI which runs on other branches, we use the branch name here.
: #
@@ -90,3 +108,42 @@ runs:
launchable record build --name ${github_ref}_${GITHUB_PR_HEAD_SHA}
echo "TESTS=${TESTS} --launchable-test-reports=${{ inputs.report-path }}" >> $GITHUB_ENV
if: steps.enable-launchable.outputs.enable-launchable
+
+ - name: Variables to report Launchable
+ id: variables
+ shell: bash
+ run: |
+ set -x
+ : # flavor
+ test_opts="${{ inputs.test-opts }}"
+ test_opts="${test_opts// /}"
+ test_opts="${test_opts//=/:}"
+ echo test-opts="$test_opts" >> $GITHUB_OUTPUT
+ : # report-path from srcdir
+ if [ "${srcdir}" = "${{ github.workspace }}" ]; then
+ dir=
+ else
+ # srcdir must be equal to or under workspace
+ dir=$(echo ${srcdir:+${srcdir}/} | sed 's:[^/][^/]*/:../:g')
+ fi
+ report_path="${dir}${builddir:+${builddir}/}${report_path}"
+ echo report-path="${report_path}" >> $GITHUB_OUTPUT
+ if: steps.enable-launchable.outputs.enable-launchable
+ env:
+ srcdir: ${{ inputs.srcdir }}
+ builddir: ${{ inputs.builddir }}
+ report_path: ${{ inputs.report-path }}
+
+ - name: Record test results in Launchable
+ uses: gacts/run-and-post-run@674528335da98a7afc80915ff2b4b860a0b3553a # v1.4.0
+ with:
+ shell: bash
+ working-directory: ${{ inputs.srcdir }}
+ post: |
+ : # record
+ launchable record tests --flavor os=${{ inputs.os }} --flavor test_task=${{ matrix.test_task }} --flavor test_opts=${test_opts} raw ${report_path}
+ rm -f ${report_path}
+ if: ${{ always() && steps.enable-launchable.outputs.enable-launchable }}
+ env:
+ test_opts: ${{ steps.variables.outputs.test-opts }}
+ report_path: ${{ steps.variables.outputs.report-path }}
diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml
index e71666ecee..a05c7cd439 100644
--- a/.github/workflows/macos.yml
+++ b/.github/workflows/macos.yml
@@ -90,7 +90,10 @@ jobs:
id: enable-launchable
uses: ./.github/actions/launchable/setup
with:
+ os: ${{ matrix.os }}
+ test-opts: ${{ matrix.test_opts }}
launchable-token: ${{ secrets.LAUNCHABLE_TOKEN }}
+ builddir: build
srcdir: src
- name: Set extra test options
@@ -116,17 +119,6 @@ jobs:
if: ${{ matrix.test_task == 'check' && matrix.skipped_tests }}
continue-on-error: ${{ matrix.continue-on-skipped_tests || false }}
- - name: Record test results in Launchable
- uses: ./.github/actions/launchable/record-test
- with:
- # We need to configure the `build` directory because
- # this composite action is executed in the default working directory.
- report-path: ../build/launchable_reports.json
- os: ${{ matrix.os }}
- test-opts: ${{ matrix.test_opts }}
- srcdir: src
- if: ${{ always() && steps.enable-launchable.outputs.enable-launchable }}
-
- uses: ./.github/actions/slack
with:
label: ${{ matrix.os }} / ${{ matrix.test_task }}
diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml
index 050d66e5d5..5de657bf4b 100644
--- a/.github/workflows/ubuntu.yml
+++ b/.github/workflows/ubuntu.yml
@@ -107,7 +107,10 @@ jobs:
id: enable-launchable
uses: ./.github/actions/launchable/setup
with:
+ os: ${{ matrix.os }}
+ test-opts: ${{ matrix.configure }}
launchable-token: ${{ secrets.LAUNCHABLE_TOKEN }}
+ builddir: build
srcdir: src
- name: make ${{ matrix.test_task }}
@@ -130,17 +133,6 @@ jobs:
if: ${{ matrix.test_task == 'check' && matrix.skipped_tests }}
continue-on-error: ${{ matrix.continue-on-skipped_tests || false }}
- - name: Record test results in Launchable
- uses: ./.github/actions/launchable/record-test
- with:
- # We need to configure the `build` directory because
- # this composite action is executed in the default working directory.
- report-path: ../build/launchable_reports.json
- os: ubuntu-20.04
- test-opts: ${{ matrix.configure }}
- srcdir: src
- if: ${{ always() && steps.enable-launchable.outputs.enable-launchable }}
-
- uses: ./.github/actions/slack
with:
label: ${{ matrix.test_task }} ${{ matrix.configure }}${{ matrix.arch }}