Skip to content

Test Runner CI

Test Runner CI #142

Workflow file for this run

# Copyright (c) 2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Test Runner CI
on:
merge_group: null
pull_request_target:
types: [opened, edited, reopened, synchronize]
branches: [main]
paths:
- 'test-runner/**'
push:
branches:
- main
permissions: read-all
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
unit-test:
runs-on: k8-runners
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: true
steps:
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
egress-policy: audit
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
if: ${{ github.event_name == 'push' }}
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
if: ${{ github.event_name == 'pull_request_target' }}
with:
fetch-depth: 0
ref: "refs/pull/${{ github.event.number }}/merge"
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
if: ${{ github.event_name == 'merge_group' }}
with:
fetch-depth: 0
ref: ${{ github.event.merge_group.head_ref }}
- uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
with:
driver: docker
- uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ${{ secrets.REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: ${{ matrix.python }}
- name: Install requirements
run: python -m pip install -U pip tox-gh-actions
- name: Tox
run: python -m tox
env:
CACHE_REGISTRY: ${{ secrets.CACHE_REGISTRY }}
FORCE_COLOR: 1
REGISTRY: ${{ secrets.REGISTRY }}
REPO: ${{ secrets.REPO }}
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: covdata-${{ matrix.python }}
path: ${{ github.workspace }}/.coverage*
coverage:
needs: [unit-test]
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
egress-policy: audit
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
if: ${{ github.event_name == 'push' }}
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
if: ${{ github.event_name == 'pull_request_target' }}
with:
fetch-depth: 0
ref: "refs/pull/${{ github.event.number }}/merge"
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
if: ${{ github.event_name == 'merge_group' }}
with:
fetch-depth: 0
ref: ${{ github.event.merge_group.head_ref }}
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: "3.10"
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
merge-multiple: true
- name: Coverage
run: |
python -m pip install coverage
python -m coverage combine --debug=pathmap
python -m coverage xml --skip-empty
- name: Comment on PR
if: ${{ github.event_name == 'pull_request' }}
uses: orgoro/coverage@4e3bc9302f715595336a40f7dd4a3b15c687bdb4 # v3.1
with:
coverageFile: coverage.xml
token: ${{ secrets.ACTION_TOKEN }}
treshholdAll: 80
integration-test:
runs-on: k8-runners
steps:
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
egress-policy: audit
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
if: ${{ github.event_name == 'push' }}
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
if: ${{ github.event_name == 'pull_request_target' }}
with:
fetch-depth: 0
ref: "refs/pull/${{ github.event.number }}/merge"
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
if: ${{ github.event_name == 'merge_group' }}
with:
fetch-depth: 0
ref: ${{ github.event.merge_group.head_ref }}
- uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
with:
driver: docker
- uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ${{ secrets.REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: "3.8"
- name: Test Container Group
uses: intel/ai-containers/test-runner@28ee014b2e4e9ffc4126d1b226691e5c72b75df5 # main
with:
cache_registry: ${{ secrets.CACHE_REGISTRY }}
recipe_dir: test-runner
registry: ${{ secrets.REGISTRY }}
repo: ${{ secrets.REPO }}
test_dir: test-runner
token: ${{ secrets.ACTION_TOKEN }}