Choose tox env according to tox212 value #121
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build workflow-testing | |
on: | |
push: | |
branches: | |
- "**" | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
pull_request: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
tests: | |
strategy: | |
matrix: | |
python-version: [ "3.8", "3.9" ] | |
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ] | |
nodeellip: [ false, true ] | |
tf212: [ false, true ] | |
exclude: | |
- os: "windows-latest" | |
nodeellip: true | |
- os: "macos-latest" | |
nodeellip: true | |
- os: "ubuntu-latest" | |
nodeellip: true | |
python-version: 3.9 | |
- os: "windows-latest" | |
tf212: true | |
- os: "macos-latest" | |
tf212: true | |
- os: "ubuntu-latest" | |
tf212: true | |
python-version: 3.9 | |
- os: "ubuntu-latest" | |
tf212: true | |
nodeellip: false | |
python-version: 3.8 | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Chekc strategy | |
run: | | |
echo ${{ matrix.python-version }} | |
echo ${{ matrix.os }} | |
echo ${{ matrix.nodeellip }} | |
echo ${{ matrix.tf212 }} | |
- name: Pick proper tox env | |
shell: python | |
run: | | |
import os; import platform; import sys; from pathlib import Path | |
platform_mapping = { | |
"Linux": "linux", | |
"Darwin": "macos", | |
"Windows": "win", | |
} | |
pythonversion = f'py{"" if platform.python_implementation() == "CPython" else "py"}3{sys.version_info.minor}' | |
platformversion=platform_mapping[platform.system()] | |
toxenv = f"{pythonversion}-{platformversion}" | |
if "${{ matrix.nodeellip }}" == "true": | |
toxenv += "-nodeellip" | |
if "${{ matrix.tf212 }}" == "true": | |
toxenv += "-tf212" | |
set_toxenv_cmd = f"TOXENV={toxenv}" | |
print(f"Picked: {toxenv}") | |
with Path(os.environ["GITHUB_ENV"]).open("ta") as file_handler: | |
file_handler.write(set_toxenv_cmd) |