mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 11:06:56 +08:00
https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
125 lines
6.4 KiB
YAML
125 lines
6.4 KiB
YAML
# ==================================================================================================================== #
|
|
# Authors: #
|
|
# Patrick Lehmann #
|
|
# Unai Martinez-Corral #
|
|
# #
|
|
# ==================================================================================================================== #
|
|
# Copyright 2020-2022 The pyTooling Authors #
|
|
# #
|
|
# 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. #
|
|
# #
|
|
# SPDX-License-Identifier: Apache-2.0 #
|
|
# ==================================================================================================================== #
|
|
name: Parameters
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
python_version:
|
|
description: 'Python version.'
|
|
required: false
|
|
default: '3.10'
|
|
type: string
|
|
python_version_list:
|
|
description: 'Space separated list of Python versions to run tests with.'
|
|
required: false
|
|
default: '3.7 3.8 3.9 3.10'
|
|
type: string
|
|
system_list:
|
|
description: 'Space separated list of systems to run tests on.'
|
|
required: false
|
|
default: 'ubuntu windows msys2 macos'
|
|
type: string
|
|
name:
|
|
description: 'Name of the tool.'
|
|
required: true
|
|
type: string
|
|
outputs:
|
|
params:
|
|
description: "Parameters to be used in other jobs."
|
|
value: ${{ jobs.Parameters.outputs.params }}
|
|
python_jobs:
|
|
description: "List of Python versions to be used in the matrix of other jobs."
|
|
value: ${{ jobs.Parameters.outputs.python_jobs }}
|
|
|
|
jobs:
|
|
|
|
Parameters:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
params: ${{ steps.params.outputs.params }}
|
|
python_jobs: ${{ steps.params.outputs.python_jobs }}
|
|
steps:
|
|
|
|
- name: Generate 'params' and 'python_jobs'
|
|
id: params
|
|
shell: python
|
|
run: |
|
|
from os import environ
|
|
|
|
name = '${{ inputs.name }}'
|
|
params = {
|
|
'python_version': '${{ inputs.python_version }}',
|
|
'artifacts': {
|
|
'unittesting': f'{name}-TestReport',
|
|
'coverage': f'{name}-coverage',
|
|
'typing': f'{name}-typing',
|
|
'package': f'{name}-package',
|
|
'doc': f'{name}-doc',
|
|
}
|
|
}
|
|
|
|
with open(environ['GITHUB_OUTPUT'], 'a', encoding='utf-8') as gho:
|
|
gho.write(f"params={params!s}\n")
|
|
print("Parameters:")
|
|
print(params)
|
|
|
|
systems = '${{ inputs.system_list }}'.split(' ')
|
|
versions = '${{ inputs.python_version_list }}'.split(' ')
|
|
if '3.6' in versions:
|
|
print("::warning title=Deprecated::Support for Python 3.6 ended in 2021.12.23.")
|
|
if '3.11' in versions:
|
|
print(f"::notice title=Experimental::Python 3.11 (3.11.0-alpha3) is a pre-release.")
|
|
data = {
|
|
'python': {
|
|
'3.6': { 'icon': '⚫', 'until': '2021.12.23' },
|
|
'3.7': { 'icon': '🔴', 'until': '2023.06.27' },
|
|
'3.8': { 'icon': '🟠', 'until': '2024.10' },
|
|
'3.9': { 'icon': '🟡', 'until': '2025.10' },
|
|
'3.10': { 'icon': '🟢', 'until': '2026.10' },
|
|
'3.11': { 'icon': '🟣', 'until': '2027.10' },
|
|
},
|
|
'sys': {
|
|
'ubuntu': { 'icon': '🐧', 'runs-on': 'ubuntu-latest', 'shell': 'bash' },
|
|
'windows': { 'icon': '🧊', 'runs-on': 'windows-latest', 'shell': 'pwsh' },
|
|
'msys2': { 'icon': '🟦', 'runs-on': 'windows-latest', 'shell': 'msys2 {0}' },
|
|
'macos': { 'icon': '🍎', 'runs-on': 'macos-latest', 'shell': 'bash' }
|
|
}
|
|
}
|
|
jobs = [
|
|
{
|
|
'sysicon': data['sys'][system]['icon'],
|
|
'system': system,
|
|
'runs-on': data['sys'][system]['runs-on'],
|
|
'shell': data['sys'][system]['shell'],
|
|
'pyicon': data['python'][version]['icon'],
|
|
'python': '3.11.0-alpha.3' if version == '3.11' else version
|
|
}
|
|
for system in systems
|
|
for version in (versions if system != 'msys2' else ['3.10'])
|
|
]
|
|
with open(environ['GITHUB_OUTPUT'], 'a', encoding='utf-8') as gho:
|
|
gho.write(f"python_jobs={jobs!s}\n")
|
|
print("Python jobs:")
|
|
print(jobs)
|