-
Notifications
You must be signed in to change notification settings - Fork 2
110 lines (100 loc) · 3.18 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: CI
run-name: "${{ github.event_name == 'workflow_dispatch' && format('CI: {0}', github.ref_name) || '' }}"
on:
push:
branches:
- main
- develop
- release/*
- feature/*
pull_request: ~
workflow_dispatch:
inputs:
skip-lint:
description: "Skip linting"
required: false
default: false
type: boolean
skip-tests:
description: "Skip tests"
required: false
default: false
type: boolean
permissions:
contents: read # Read-only access
env:
DEFAULT_PYTHON_VERSION: "3.12"
TARGET_PYTHON_VERSIONS: "[ '3.9', '3.10', '3.11', '3.12', '3.13' ]"
jobs:
#----------------------------------------------
# Collect information
prepare:
name: Prepare
outputs:
package-version: ${{ steps.compute-version.outputs.pep440-version }}
target_python_versions: ${{ env.TARGET_PYTHON_VERSIONS }}
default_python_version: ${{ env.DEFAULT_PYTHON_VERSION }}
runs-on: ubuntu-latest
steps:
#----------------------------------------------
# Display Github environment variables
- name: Display Github environment variables
run: printenv | grep '^GITHUB_' | sort
#----------------------------------------------
# Check-out repo
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
#----------------------------------------------
# Compute the version of the project based in the current checkout branch
- name: Compute version
id: compute-version
uses: ./.github/workflows/compute-version
#----------------------------------------------
# Send to Github Actions
- name: Display information
run: |
echo "package-version=${{ steps.compute-version.outputs.pep440-version }}"
echo "target-python-versions=${{ env.TARGET_PYTHON_VERSIONS }}"
echo "default-python-version=${{ env.DEFAULT_PYTHON_VERSION }}"
#----------------------------------------------
# Lint
lint:
name: Lint
needs: prepare
runs-on: ubuntu-latest
if: ${{ !github.event.inputs.skip-lint }}
steps:
#----------------------------------------------
# Check-out repo
- name: Check out repository
uses: actions/checkout@v4
#----------------------------------------------
# Linting the code
- name: Lint
uses: ./.github/workflows/python-lint
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
#----------------------------------------------
# Test
test:
name: Test
needs: [prepare, lint]
runs-on: "ubuntu-latest"
if: ${{ !github.event.inputs.skip-tests }}
strategy:
fail-fast: true
matrix:
python-version: ${{ fromJSON(needs.prepare.outputs.target_python_versions) }}
steps:
#----------------------------------------------
# Check-out repo
- name: Check out repository
uses: actions/checkout@v4
#----------------------------------------------
# Testing the code
- name: Test
uses: ./.github/workflows/python-test
with:
python-version: ${{ matrix.python-version }}