Skip to content

Update docker base images and python packages #496

Update docker base images and python packages

Update docker base images and python packages #496

name: Python Tests - Platform API
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
inputs:
ods_branch:
description: 'If set, pip install ods-tools branch [git ref]'
required: false
workflow_call:
inputs:
ods_branch:
description: 'If set, pip install ods-tools branch [git ref]'
required: false
type: string
platform_branch:
description: "Platform branch to test (remote trigger) [git ref]"
required: True
type: string
jobs:
ods_tools:
#if: inputs.ods_branch != ''
uses: OasisLMF/ODS_Tools/.github/workflows/build.yml@main
secrets: inherit
with:
ods_branch: ${{ github.event_name != 'workflow_dispatch' && 'main' || inputs.ods_branch }}
unittest:
needs: ods_tools
env:
JUNIT_REPORT: pytest_report.xml
PLAT_BRANCH: ${{ github.ref }}
runs-on: ubuntu-22.04
steps:
- name: Branch selection (remote trigger)
if: inputs.platform_branch != ''
run: echo "PLAT_BRANCH=${{ inputs.platform_branch }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
with:
repository: OasisLMF/OasisPlatform
ref: ${{ env.PLAT_BRANCH }}
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: pip install -r requirements.txt
- name: Download package
if: needs.ods_tools.outputs.whl_filename != ''
uses: actions/download-artifact@v4
with:
name: bin_package
path: ${{ github.workspace }}/
- name: Install package
if: needs.ods_tools.outputs.whl_filename != ''
run: |
pip uninstall ods-tools -y
pip install ${{ needs.ods_tools.outputs.whl_filename }}
- name: Run Pytest
run: pytest --cov-config=tox.ini --junitxml=${{ github.workspace }}/pytest_report.xml --cov=src --cov-report=xml --cov-report=term
# - name: Run Tox
# run: |
# pip install tox
# tox -e py
- name: Generate Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: Pytest Results # Name of the check run which will be created
path: ${{ env.JUNIT_REPORT }} # Path to test results
reporter: java-junit # Format of test results
fail-on-error: 'false'