106 lines
2.8 KiB
YAML
106 lines
2.8 KiB
YAML
---
|
|
# DESCRIPTION: Github actions config
|
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
|
|
|
name: reusable-test
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
archive:
|
|
description: "Name of the repository archive artifact from reusable-build"
|
|
required: true
|
|
type: string
|
|
os: # e.g. ubuntu-24.04
|
|
required: true
|
|
type: string
|
|
cc: # gcc or clang
|
|
required: true
|
|
type: string
|
|
reloc: # 0 or 1
|
|
required: true
|
|
type: number
|
|
suite: # e.g. dist-vlt-0
|
|
required: true
|
|
type: string
|
|
dev-gcov:
|
|
required: true
|
|
type: number
|
|
|
|
env:
|
|
CI_OS_NAME: linux
|
|
CCACHE_COMPRESS: 1
|
|
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
|
CCACHE_LIMIT_MULTIPLE: 0.95
|
|
INSTALL_DIR: ${{ github.workspace }}/install
|
|
RELOC_DIR: ${{ github.workspace }}/relloc
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
working-directory: repo
|
|
|
|
jobs:
|
|
|
|
test:
|
|
runs-on: ${{ inputs.os }}
|
|
name: Test
|
|
env:
|
|
CI_BUILD_STAGE_NAME: test
|
|
CI_RUNS_ON: ${{ inputs.os }}
|
|
CI_RELOC: ${{inputs.reloc }}
|
|
CXX: ${{ inputs.cc == 'clang' && 'clang++' || 'g++' }}
|
|
CACHE_BASE_KEY: test-${{ inputs.os }}-${{ inputs.cc }}-${{inputs.reloc }}-${{ inputs.suite }}
|
|
CCACHE_MAXSIZE: 100M # Per build per suite (* 5 * 5 = 2500M in total)
|
|
steps:
|
|
|
|
- name: Download repository archive
|
|
uses: actions/download-artifact@v6
|
|
with:
|
|
name: ${{ inputs.archive }}
|
|
path: ${{ github.workspace }}
|
|
|
|
- name: Unpack repository archive
|
|
working-directory: ${{ github.workspace }}
|
|
run: |
|
|
tar -x -z -f ${{ inputs.archive }}
|
|
ls -lsha
|
|
|
|
- name: Cache $CCACHE_DIR
|
|
uses: actions/cache@v4
|
|
env:
|
|
CACHE_KEY: ${{ env.CACHE_BASE_KEY }}-ccache2
|
|
with:
|
|
path: ${{ env.CCACHE_DIR }}
|
|
key: ${{ env.CACHE_KEY }}-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ env.CACHE_KEY }}-
|
|
|
|
- name: Install test dependencies
|
|
run: ./ci/ci-install.bash
|
|
|
|
- name: Test
|
|
id: run-test
|
|
continue-on-error: true
|
|
env:
|
|
TESTS: ${{ inputs.suite }}
|
|
run: ./ci/ci-script.bash
|
|
|
|
- name: Combine code coverage data
|
|
if: ${{ inputs.dev-gcov }}
|
|
run: |
|
|
make coverage-combine
|
|
mv obj_coverage/verilator.info obj_coverage/verilator-${{ inputs.suite }}.info
|
|
ls -lsha obj_coverage
|
|
|
|
- name: Upload code coverage data
|
|
if: ${{ inputs.dev-gcov }}
|
|
uses: actions/upload-artifact@v5
|
|
with:
|
|
path: ${{ github.workspace }}/repo/obj_coverage/verilator-${{ inputs.suite }}.info
|
|
name: code-coverage-${{ inputs.suite }}
|
|
|
|
- name: Fail job if a test failed
|
|
if: ${{ steps.run-test.outcome == 'failure' && !cancelled() }}
|
|
run: exit 1
|