-
Notifications
You must be signed in to change notification settings - Fork 176
150 lines (137 loc) · 5.02 KB
/
basic.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
139
140
141
142
143
144
145
146
147
148
149
150
name: Basic tests
on: [push, pull_request]
jobs:
pre-commit:
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.repository == 'DIRACGrid/DIRAC'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure
shellcheck:
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.repository == 'DIRACGrid/DIRAC'
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Run shellcheck
# TODO This should cover more than just tests/CI
# Excluded codes related to sourcing files
# SC1090: Can't follow non-constant source
# SC1091: Not following sourced file
run: |
find tests/CI -name '*.sh' -print0 | xargs -0 -n1 shellcheck --exclude=SC1090,SC1091 --external-source
pycodestyle:
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.repository == 'DIRACGrid/DIRAC'
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Installing dependencies
run: |
python -m pip install pycodestyle
- name: Run pycodestyle
run: |
if [[ "${REFERENCE_BRANCH}" != "" ]]; then
git remote add upstream https://github.com/DIRACGrid/DIRAC.git
git fetch --no-tags upstream "${REFERENCE_BRANCH}"
git branch -vv
git diff -U0 "upstream/${REFERENCE_BRANCH}" ':(exclude)tests/formatting/pep8_bad.py' | pycodestyle --diff
fi
check:
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.repository == 'DIRACGrid/DIRAC'
timeout-minutes: 30
defaults:
# Activate the conda environment automatically in each step
run:
shell: bash -l {0}
strategy:
fail-fast: False
matrix:
command:
# TODO These three tests fail on Python 3:
# * `test_BaseType_Unicode` and `test_nestedStructure` fail due to
# DISET's string and unicode types being poorly defined
- pytest --runslow -k 'not test_BaseType_Unicode and not test_nestedStructure'
- pylint -j 0 -E src/
- mypy
steps:
- uses: actions/checkout@v4
- name: Fail-fast for outdated pipelines
run: .github/workflows/fail-fast.sh
- uses: conda-incubator/setup-miniconda@master
with:
environment-file: environment.yml
miniforge-variant: Mambaforge
use-mamba: true
- name: Run tests
run: |
# FIXME: The unit tests currently only work with editable installs
pip install -e .[server,testing]
${{ matrix.command }}
env:
REFERENCE_BRANCH: ${{ github['base_ref'] || github['head_ref'] }}
check-py39:
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.repository == 'DIRACGrid/DIRAC'
timeout-minutes: 30
defaults:
# Activate the conda environment automatically in each step
run:
shell: bash -l {0}
strategy:
fail-fast: False
matrix:
command:
# TODO These three tests fail on Python 3:
# * `test_BaseType_Unicode` and `test_nestedStructure` fail due to
# DISET's string and unicode types being poorly defined
- pytest --runslow -k 'not test_BaseType_Unicode and not test_nestedStructure'
- pylint -j 0 -E src/
steps:
- uses: actions/checkout@v4
- name: Fail-fast for outdated pipelines
run: .github/workflows/fail-fast.sh
- name: fix python3.9
run: |
sed -i "s/python =3.11/python =3.9/g" environment.yml
- uses: conda-incubator/setup-miniconda@master
with:
environment-file: environment.yml
miniforge-variant: Mambaforge
use-mamba: true
- name: Run tests
run: |
# FIXME: The unit tests currently only work with editable installs
pip install -e .[server,testing]
${{ matrix.command }}
env:
REFERENCE_BRANCH: ${{ github['base_ref'] || github['head_ref'] }}
pylint-py27:
name: Pylint for Python 2.7 in Pilot files
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.repository == 'DIRACGrid/DIRAC'
steps:
- uses: actions/checkout@v4
- name: Fail-fast for outdated pipelines
run: .github/workflows/fail-fast.sh
- name: prepare environment
run: |
conda config --set add_pip_as_python_dependency false
conda create -c conda-forge -n test-env python=2.7 pylint=1.9.2 astroid=1.6.5
- name: run pilot wrapper test
run: |
eval "$(conda shell.bash hook)" && conda activate test-env
pylint -j 0 -E \
tests/Integration/WorkloadManagementSystem/Test_GenerateAndExecutePilotWrapper.py \
src/DIRAC/WorkloadManagementSystem/Utilities/PilotWrapper.py \
src/DIRAC/Resources/Computing/BatchSystems/*.py