forked from before-commit/before-commit
-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (129 loc) · 3.67 KB
/
test.yml
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
---
name: test
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
pre-commit:
env:
PY_COLORS: 1
TOX_PARALLEL_NO_SPINNER: 1
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3.0.2
- name: Setup python for tox
uses: actions/setup-python@v3.1.2
- name: Install tox
run: python -m pip install tox
- name: Run test suite via tox
run: |
tox -vv --notest -e pre-commit
tox -e pre-commit --skip-pkg-install
pytest:
env:
PYTEST_ADDOPTS: "--showlocals -vv --durations=10"
PY_COLORS: 1
TOX_PARALLEL_NO_SPINNER: 1
GO111MODULE: auto
strategy:
fail-fast: false
matrix:
os:
- ubuntu-18.04
- ubuntu-20.04
- macos-11
- windows-2019
- windows-2022
py:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3.0.2
# Dependencies of the testsuite
- uses: actions/setup-node@v3.2.0
- uses: actions/setup-go@v3.1.0
- uses: actions/setup-dotnet@v2.1.0
with:
dotnet-version: |
3.1.x
5.0.x
# Use the pre-installed Conda
- if: startsWith(matrix.os, 'windows')
name: Add Conda to PATH
run: echo $env:CONDA\Scripts | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
shell: pwsh
- if: "!startsWith(matrix.os, 'windows')"
uses: conda-incubator/setup-miniconda@v2.1.1
with:
auto-update-conda: true
python-version: ${{ matrix.py }}
auto-activate-base: true
allow-softlinks: true
- uses: dart-lang/setup-dart@v1
- uses: coursier/cache-action@v6
- uses: coursier/setup-action@v1
- uses: ljmf00/setup-lua@v1.0.0
with:
install-luarocks: true
- uses: ATiltedTree/setup-rust@v1.0.5
with:
rust-version: stable
- name: Setup python for test ${{ matrix.py }}
uses: actions/setup-python@v3.1.2
with:
python-version: ${{ matrix.py }}
- name: Pick environment to run
run: |
import platform
import os
import sys
if platform.python_implementation() == "PyPy":
base = f"pypy{sys.version_info.major}"
else:
base = f"py{sys.version_info.major}{sys.version_info.minor}"
env = f"BASE={base}\n"
print(f"Picked:\n{env}for {sys.version}")
with open(os.environ["GITHUB_ENV"], "a", encoding="utf-8") as file:
file.write(env)
shell: python
- name: Setup python for tox
uses: actions/setup-python@v3.1.2
with:
python-version: 3.9
- name: Install tox
run: python -m pip install tox
- name: Run test suite via tox
run: |
tox -vv --notest -e ${{env.BASE}}
tox -e ${{env.BASE}} --skip-pkg-install
- name: Rename coverage report file
if: ${{ always() }}
run: |
if [[ -f ".tox/coverage.${BASE}.xml" ]]; then
mv ".tox/coverage.${BASE}.xml" .tox/coverage.xml
fi
shell: bash
- uses: codecov/codecov-action@v3.1.0
if: ${{ always() }}
env:
PYTHON: ${{ matrix.python }}
with:
file: ./.tox/coverage.xml
flags: tests
env_vars: PYTHON
name: ${{ matrix.py }} - ${{ matrix.os }}