Skip to content

Make RUNNER_OS available to if #2

Make RUNNER_OS available to if

Make RUNNER_OS available to if #2

Workflow file for this run

name: Publish
on:
workflow_call:
jobs:
publish-dockerfile:
name: Publish Test Results (Dockerfile)
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
TODO: publish with linux / macos / windows actions
steps:

Check failure on line 15 in .github/workflows/publish.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/publish.yml

Invalid workflow file

You have an error in your yaml syntax on line 15
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare publish action from this branch
run: |
sed --in-place "s/image: .*/image: 'Dockerfile'/" action.yml
shell: bash
- name: Publish Test Results
id: test-results
uses: ./
with:
check_name: Test Results (Dockerfile)
files: "artifacts/**/*.xml"
json_file: "tests.json"
json_suite_details: true
json_test_case_results: true
report_suite_logs: "any"
log_level: DEBUG
- name: JSON output
uses: ./misc/action/json-output
with:
json: '${{ steps.test-results.outputs.json }}'
json_file: 'tests.json'
publish-docker-image:
name: Publish Test Results (Docker Image ${{ matrix.arch }})
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
security-events: write
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: ${{ matrix.arch }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
id: build
uses: docker/build-push-action@v5
with:
load: true
push: false
platforms: linux/${{ matrix.arch }}
tags: enricomi/publish-unit-test-result-action:latest
outputs: type=docker
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish Test Results
id: test-results
if: always()
env:
INPUT_GITHUB_TOKEN: ${{ github.token }}
INPUT_CHECK_NAME: Test Results (Docker Image ${{ matrix.arch }})
INPUT_FILES: "artifacts/**/*.xml"
INPUT_JSON_FILE: "tests.json"
INPUT_JSON_SUITE_DETAILS: true
INPUT_JSON_TEST_CASE_RESULTS: true
INPUT_REPORT_SUITE_LOGS: "any"
run: |
docker run --platform linux/${{ matrix.arch }} \
--workdir $GITHUB_WORKSPACE \
--rm \
-e "INPUT_CHECK_NAME" \
-e "INPUT_JSON_FILE" \
-e "INPUT_JSON_SUITE_DETAILS" \
-e "INPUT_JSON_TEST_CASE_RESULTS" \
-e "INPUT_LOG_LEVEL" \
-e "INPUT_ROOT_LOG_LEVEL" \
-e "INPUT_GITHUB_TOKEN" \
-e "INPUT_GITHUB_TOKEN_ACTOR" \
-e "INPUT_GITHUB_RETRIES" \
-e "INPUT_COMMIT" \
-e "INPUT_COMMENT_TITLE" \
-e "INPUT_COMMENT_MODE" \
-e "INPUT_FAIL_ON" \
-e "INPUT_ACTION_FAIL" \
-e "INPUT_ACTION_FAIL_ON_INCONCLUSIVE" \
-e "INPUT_FILES" \
-e "INPUT_JUNIT_FILES" \
-e "INPUT_NUNIT_FILES" \
-e "INPUT_XUNIT_FILES" \
-e "INPUT_TRX_FILES" \
-e "INPUT_TIME_UNIT" \
-e "INPUT_TEST_FILE_PREFIX" \
-e "INPUT_REPORT_INDIVIDUAL_RUNS" \
-e "INPUT_REPORT_SUITE_LOGS" \
-e "INPUT_DEDUPLICATE_CLASSES_BY_FILE_NAME" \
-e "INPUT_LARGE_FILES" \
-e "INPUT_IGNORE_RUNS" \
-e "INPUT_CHECK_RUN" \
-e "INPUT_JOB_SUMMARY" \
-e "INPUT_COMPARE_TO_EARLIER_COMMIT" \
-e "INPUT_PULL_REQUEST_BUILD" \
-e "INPUT_EVENT_FILE" \
-e "INPUT_EVENT_NAME" \
-e "INPUT_TEST_CHANGES_LIMIT" \
-e "INPUT_CHECK_RUN_ANNOTATIONS" \
-e "INPUT_CHECK_RUN_ANNOTATIONS_BRANCH" \
-e "INPUT_SECONDS_BETWEEN_GITHUB_READS" \
-e "INPUT_SECONDS_BETWEEN_GITHUB_WRITES" \
-e "INPUT_SECONDARY_RATE_LIMIT_WAIT_SECONDS" \
-e "INPUT_JSON_THOUSANDS_SEPARATOR" \
-e "INPUT_SEARCH_PULL_REQUESTS" \
-e "HOME" \
-e "GITHUB_JOB" \
-e "GITHUB_REF" \
-e "GITHUB_SHA" \
-e "GITHUB_REPOSITORY" \
-e "GITHUB_REPOSITORY_OWNER" \
-e "GITHUB_RUN_ID" \
-e "GITHUB_RUN_NUMBER" \
-e "GITHUB_RETENTION_DAYS" \
-e "GITHUB_RUN_ATTEMPT" \
-e "GITHUB_ACTOR" \
-e "GITHUB_TRIGGERING_ACTOR" \
-e "GITHUB_WORKFLOW" \
-e "GITHUB_HEAD_REF" \
-e "GITHUB_BASE_REF" \
-e "GITHUB_EVENT_NAME" \
-e "GITHUB_SERVER_URL" \
-e "GITHUB_API_URL" \
-e "GITHUB_GRAPHQL_URL" \
-e "GITHUB_REF_NAME" \
-e "GITHUB_REF_PROTECTED" \
-e "GITHUB_REF_TYPE" \
-e "GITHUB_WORKSPACE" \
-e "GITHUB_ACTION" \
-e "GITHUB_EVENT_PATH" \
-e "GITHUB_ACTION_REPOSITORY" \
-e "GITHUB_ACTION_REF" \
-e "GITHUB_PATH" \
-e "GITHUB_ENV" \
-e "GITHUB_STEP_SUMMARY" \
-e "GITHUB_STATE" \
-e "GITHUB_OUTPUT" \
-e "RUNNER_OS" \
-e "RUNNER_ARCH" \
-e "RUNNER_NAME" \
-e "RUNNER_TOOL_CACHE" \
-e "RUNNER_TEMP" \
-e "RUNNER_WORKSPACE" \
-e "ACTIONS_RUNTIME_URL" \
-e "ACTIONS_RUNTIME_TOKEN" \
-e "ACTIONS_CACHE_URL" \
-e GITHUB_ACTIONS=true \
-e CI=true \
-v "$RUNNER_TEMP":"$RUNNER_TEMP" \
-v "/var/run/docker.sock":"/var/run/docker.sock" \
-v "/home/runner/work/_temp/_github_home":"/github/home" \
-v "/home/runner/work/_temp/_github_workflow":"/github/workflow" \
-v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" \
-v "/home/runner/work/publish-unit-test-result-action/publish-unit-test-result-action":"$GITHUB_WORKSPACE" \
enricomi/publish-unit-test-result-action:latest
shell: bash
- name: JSON output
uses: ./misc/action/json-output
with:
json: '${{ steps.test-results.outputs.json }}'
json_file: 'tests.json'
- name: Scan for vulnerabilities
id: scan
uses: crazy-max/ghaction-container-scan@v3
with:
image: enricomi/publish-unit-test-result-action:latest
dockerfile: ./Dockerfile
annotations: true
- name: Upload SARIF artifact
uses: actions/upload-artifact@v4
with:
name: SARIF ${{ matrix.arch }}
path: ${{ steps.scan.outputs.sarif }}
- name: Upload SARIF file
if: always() && steps.scan.outputs.sarif != ''
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: ${{ steps.scan.outputs.sarif }}
publish-composite:
name: Publish Test Results (${{ matrix.os-label }} python ${{ matrix.python }})
runs-on: ${{ matrix.os }}
permissions:
checks: write
pull-requests: write
strategy:
fail-fast: false
max-parallel: 3
matrix:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
# test *-latest and newer (because newer eventually become 'latest' and should be tested to work before that)
include:
- os: macos-latest
os-label: macOS
python: "3.8"
- os: macos-latest
os-label: macOS
python: "venv"
- os: macos-latest
os-label: macOS
python: "installed"
- os: macos-11
os-label: macOS 11
python: "installed"
- os: macos-13
os-label: macOS 13
python: "installed"
- os: macos-14
os-label: macOS 14
python: "installed"
- os: ubuntu-latest
os-label: Linux
python: "3.8"
- os: ubuntu-latest
os-label: Linux
python: "venv"
- os: ubuntu-latest
os-label: Linux
python: "installed"
- os: ubuntu-20.04
os-label: Linux 20.04
python: "installed"
- os: windows-latest
os-label: Windows
python: "installed"
- os: windows-latest
os-label: Windows
python: "venv"
- os: windows-2019
os-label: Windows 2019
python: "installed"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
if: matrix.python != 'installed' && matrix.python != 'venv'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install virtualenv
if: matrix.python == 'venv'
run: |
python3 -m pip install virtualenv
shell: bash
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish Test Results
id: test-results
uses: ./composite
with:
check_name: Test Results (${{ matrix.os-label }} python ${{ matrix.python }})
files: |
artifacts/**/*.xml
artifacts\**\*.xml
json_file: "tests.json"
json_suite_details: true
json_test_case_results: true
report_suite_logs: "any"
- name: JSON output
uses: ./misc/action/json-output
with:
json: '${{ steps.test-results.outputs.json }}'
json_file: 'tests.json'
publish-test-files:
name: Publish Test Files
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Copy test result files
run: cp -rv python/test/files test-files
shell: bash
- name: Prepare publish action from this branch
run: |
sed --in-place "s/image: .*/image: 'Dockerfile'/" action.yml
shell: bash
- name: Publish Test Results
id: test-results
uses: ./
with:
check_name: Test Results (Test Files)
fail_on: nothing
files: |
test-files/**/*.xml
test-files/**/*.trx
test-files/**/*.json
junit_files: "test-files/junit-xml/**/*.xml"
nunit_files: "test-files/nunit/**/*.xml"
xunit_files: "test-files/xunit/**/*.xml"
trx_files: "test-files/trx/**/*.trx"
json_file: "tests.json"
json_suite_details: true
json_test_case_results: true
report_suite_logs: "any"
log_level: DEBUG
- name: JSON output
uses: ./misc/action/json-output
with:
json: '${{ steps.test-results.outputs.json }}'
json_file: 'tests.json'
publish-test-file:
name: Publish Test File
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Copy test junit xml files
run: cp -rv python/test/files/junit-xml test-files
shell: bash
- name: Prepare publish action from this branch
run: |
sed --in-place "s/image: .*/image: 'Dockerfile'/" action.yml
shell: bash
- name: Publish Test Results
id: test-results
uses: ./
with:
check_name: Test Results (Test File)
fail_on: nothing
files: "test-files/pytest/junit.gloo.standalone.xml"
json_file: "tests.json"
json_suite_details: true
json_test_case_results: true
report_suite_logs: "any"
log_level: DEBUG
- name: JSON output
uses: ./misc/action/json-output
with:
json: '${{ steps.test-results.outputs.json }}'
json_file: 'tests.json'