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>
This commit is contained in:
parent
d94ad00252
commit
8e3cb69a83
@ -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 }}
|
59
.github/actions/launchable/setup/action.yml
vendored
59
.github/actions/launchable/setup/action.yml
vendored
@ -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 }}
|
||||
|
14
.github/workflows/macos.yml
vendored
14
.github/workflows/macos.yml
vendored
@ -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 }}
|
||||
|
14
.github/workflows/ubuntu.yml
vendored
14
.github/workflows/ubuntu.yml
vendored
@ -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 }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user