Skip to content

Commit aed6758

Browse files
authored
Prevent workflow double trigger, Add PEP 561 compliance (#1348)
* update workflow files * typo fix * Update pytest * remove bad semi-colon * Fix test runner command * Remove explicit steps required from older version * Explicitly add Conda python to path for subprocess command in test * Fix the mypy compliance check * Added PEP 561 compliance * Add py.typed to MANIFEST for dist * Remove py.typed from setup.py
1 parent 887bb10 commit aed6758

File tree

10 files changed

+182
-65
lines changed

10 files changed

+182
-65
lines changed

.github/workflows/black_checker.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
name: black-format-check
22

3-
on: [push, pull_request]
3+
on:
4+
# Manually triggerable in github
5+
workflow_dispatch:
6+
7+
# When a push occurs on either of these branches
8+
push:
9+
branches:
10+
- master
11+
- development
12+
13+
# When a push occurs on a PR that targets these branches
14+
pull_request:
15+
branches:
16+
- master
17+
- development
418

519
env:
620
#If STRICT is set to true, it will fail on black check fail

.github/workflows/dist.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
name: dist-check
22

3-
on: [push, pull_request]
3+
on:
4+
# Manually triggerable in github
5+
workflow_dispatch:
6+
7+
# When a push occurs on either of these branches
8+
push:
9+
branches:
10+
- master
11+
- development
12+
13+
# When a push occurs on a PR that targets these branches
14+
pull_request:
15+
branches:
16+
- master
17+
- development
418

519
jobs:
620
dist:
@@ -36,5 +50,9 @@ jobs:
3650
- name: PEP 561 Compliance
3751
run: |
3852
pip install mypy
53+
3954
cd .. # required to use the installed version of autosklearn
40-
if ! python -c "import autosklearn"; then exit 1; fi
55+
56+
# Note this doesnt perform mypy checks, only
57+
# that the types are exported
58+
if ! mypy -c "import autosklearn"; then exit 1; fi

.github/workflows/docker-publish.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#https://help.github.com/en/actions/language-and-framework-guides/publishing-docker-images#publishing-images-to-github-packages
22
name: Publish Docker image
3+
34
on:
5+
46
push:
5-
# Push to `master` or `development`
67
branches:
78
- master
89
- development
910
- docker_workflow
1011

1112
jobs:
13+
1214
push_to_registry:
1315
name: Push Docker image to GitHub Packages
1416
runs-on: ubuntu-latest

.github/workflows/docs.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
11
name: Docs
2-
on: [pull_request, push]
2+
3+
on:
4+
# Manually triggerable in github
5+
workflow_dispatch:
6+
7+
# When a push occurs on either of these branches
8+
push:
9+
branches:
10+
- master
11+
- development
12+
13+
# When a push occurs on a PR that targets these branches
14+
pull_request:
15+
branches:
16+
- master
17+
- development
318

419
jobs:
20+
521
build-and-deploy:
622
runs-on: ubuntu-latest
723
steps:
8-
- uses: actions/checkout@v2
24+
25+
- name: Checkout
26+
uses: actions/checkout@v2
927
with:
1028
submodules: recursive
1129

.github/workflows/isort_checker.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
name: isort-check
22

3-
on: [push, pull_request, workflow_dispatch]
3+
on:
4+
# Manually triggerable in github
5+
workflow_dispatch:
6+
7+
# When a push occurs on either of these branches
8+
push:
9+
branches:
10+
- master
11+
- development
12+
13+
# When a push occurs on a PR that targets these branches
14+
pull_request:
15+
branches:
16+
- master
17+
- development
418

519
env:
620
#If STRICT is set to true, it will fail on isort check fail
721
STRICT: false
822

923
jobs:
1024

11-
black-format-check:
25+
isort-format-check:
1226
runs-on: ubuntu-latest
1327
steps:
1428

.github/workflows/pre-commit.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
name: pre-commit
22

3-
on: [push, pull_request]
3+
on:
4+
# Manually triggerable in github
5+
workflow_dispatch:
6+
7+
# When a push occurs on either of these branches
8+
push:
9+
branches:
10+
- master
11+
- development
12+
13+
# When a push occurs on a PR that targets these branches
14+
pull_request:
15+
branches:
16+
- master
17+
- development
418

519
jobs:
620
run-all-files:

.github/workflows/pytest.yml

Lines changed: 84 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,138 @@
11
name: Tests
22

33
on:
4+
# Manually triggerable in github
5+
workflow_dispatch:
6+
7+
# When a push occurs on either of these branches
48
push:
9+
branches:
10+
- master
11+
- development
12+
13+
# When a push occurs on a PR that targets these branches
514
pull_request:
6-
workflow_dispatch:
15+
branches:
16+
- master
17+
- development
18+
719
schedule:
8-
# Every Monday at 7AM UTC
9-
- cron: '0 07 * * 1'
20+
# Every day at 7AM UTC
21+
- cron: '0 07 * * *'
22+
23+
env:
24+
25+
# Arguments used for pytest
26+
pytest-args: >-
27+
--forked
28+
--durations=20
29+
--timeout=300
30+
--timeout-method=thread
31+
-s
32+
33+
# Arguments used for code-cov which is later used to annotate PR's on github
34+
code-cov-args: >-
35+
--cov=autosklearn
36+
--cov-report=xml
1037
1138
jobs:
39+
1240
ubuntu:
13-
runs-on: ubuntu-20.04
41+
42+
name: ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.kind }}
43+
runs-on: ${{ matrix.os }}
1444

1545
strategy:
46+
fail-fast: false
1647
matrix:
48+
os: [windows-latest, macos-latest, ubuntu-latest]
1749
python-version: ['3.7', '3.8', '3.9', '3.10']
18-
use-conda: [true, false]
19-
use-dist: [false]
50+
kind: ['conda', 'source', 'dist']
51+
52+
exclude:
53+
# Exclude all configurations *-*-dist, include one later
54+
- kind: 'dist'
55+
56+
# Exclude windows as bash commands wont work in windows runner
57+
- os: windows-latest
58+
59+
# Exclude macos as there are permission errors using conda as we do
60+
- os: macos-latest
61+
2062
include:
21-
- python-version: '3.8'
63+
# Add the tag code-cov to ubuntu-3.7-source
64+
- os: ubuntu-latest
65+
python-version: 3.7
66+
kind: 'source'
2267
code-cov: true
23-
- python-version: '3.7'
24-
use-conda: false
25-
use-dist: true
26-
fail-fast: false
68+
69+
# Include one config with dist, ubuntu-3.7-dist
70+
- os: ubuntu-latest
71+
python-version: 3.7
72+
kind: 'dist'
2773

2874
steps:
2975

30-
- uses: actions/checkout@v2
76+
- name: Checkout
77+
uses: actions/checkout@v2
3178
with:
3279
submodules: recursive
3380

3481
- name: Setup Python ${{ matrix.python-version }}
3582
uses: actions/setup-python@v2
36-
# A note on checkout: When checking out the repository that
37-
# triggered a workflow, this defaults to the reference or SHA for that event.
38-
# Otherwise, uses the default branch (master) is used.
3983
with:
4084
python-version: ${{ matrix.python-version }}
4185

42-
- name: Conda Install test dependencies
43-
if: matrix.use-conda == true
86+
- name: Conda install
87+
if: matrix.kind == 'conda'
4488
run: |
4589
# Miniconda is available in $CONDA env var
4690
$CONDA/bin/conda create -n testenv --yes pip wheel gxx_linux-64 gcc_linux-64 swig python=${{ matrix.python-version }}
4791
$CONDA/envs/testenv/bin/python3 -m pip install --upgrade pip
4892
$CONDA/envs/testenv/bin/pip3 install -e .[test]
4993
50-
- name: Install test dependencies
51-
if: matrix.use-conda == false && matrix.use-dist == false
94+
- name: Source install
95+
if: matrix.kind == 'source'
5296
run: |
5397
python -m pip install --upgrade pip
54-
if [[ `python -c 'import platform; print(platform.python_version())' | cut -d '.' -f 2` -eq 6 ]]; then
55-
# Numpy 1.20 dropped suppert for Python3.6
56-
pip install "numpy<=1.19"
57-
fi
5898
pip install -e .[test]
59-
sudo apt-get update
60-
sudo apt-get remove swig
61-
sudo apt-get install swig3.0
62-
sudo ln -s /usr/bin/swig3.0 /usr/bin/swig
6399
64-
- name: Dist Install test dependencies
65-
if: matrix.use-conda == false && matrix.use-dist == true
100+
- name: Dist install
101+
if: matrix.kind == 'dist'
66102
run: |
67103
python -m pip install --upgrade pip
68-
sudo apt-get update
69-
sudo apt-get remove swig
70-
sudo apt-get install swig3.0
71-
sudo ln -s /usr/bin/swig3.0 /usr/bin/swig
72-
# We need to install for the dependencies, like pytest
73104
python setup.py sdist
74105
last_dist=$(ls -t dist/auto-sklearn-*.tar.gz | head -n 1)
75106
pip install $last_dist[test]
76107
77-
- name: Store repository status
108+
- name: Store git status
78109
id: status-before
79110
run: |
80111
echo "::set-output name=BEFORE::$(git status --porcelain -b)"
81112
82-
- name: Conda Run tests
113+
- name: Tests
83114
timeout-minutes: 60
84-
if: matrix.use-conda == true
85115
run: |
86116
export OPENBLAS_NUM_THREADS=1
87117
export OMP_NUM_THREADS=1
88118
export MKL_NUM_THREADS=1
89-
# We activate conda as metalearning uses python directly, so we need
90-
# to change the default python
91-
export PATH="$CONDA/envs/testenv/bin:$PATH"
92-
if [ ${{ matrix.code-cov }} ]; then codecov='--cov=autosklearn --cov-report=xml'; fi
93-
$CONDA/envs/testenv/bin/python3 -m pytest --durations=20 --timeout=300 --timeout-method=thread -v $codecov test
94119
95-
- name: Run tests
96-
timeout-minutes: 60
97-
if: matrix.use-conda == false
98-
run: |
99-
export OPENBLAS_NUM_THREADS=1
100-
export OMP_NUM_THREADS=1
101-
export MKL_NUM_THREADS=1
102-
if [ ${{ matrix.code-cov }} ]; then codecov='--cov=autosklearn --cov-report=xml'; fi
103-
pytest --durations=20 --timeout=300 --timeout-method=thread -v $codecov test
120+
if [[ ${{ matrix.kind }} == 'conda' ]]; then
121+
PYTHON=$CONDA/envs/testenv/bin/python3
122+
123+
# As one of the tests runs a subprocess command and calls `python3`, we must
124+
# explicitly add it to the path
125+
export PATH="$CONDA/envs/testenv/bin:$PATH"
126+
127+
else
128+
PYTHON=$(which python3)
129+
fi
130+
131+
if [ ${{ matrix.code-cov }} ]; then
132+
$PYTHON -m pytest ${{ env.pytest-args }} ${{ env.code-cov-args }} test
133+
else
134+
$PYTHON -m pytest ${{ env.pytest-args }} test
135+
fi
104136
105137
- name: Check for files left behind by test
106138
if: ${{ always() }}
@@ -116,7 +148,7 @@ jobs:
116148
117149
- name: Upload coverage
118150
if: matrix.code-cov && always()
119-
uses: codecov/codecov-action@v1
151+
uses: codecov/codecov-action@v2
120152
with:
121153
fail_ci_if_error: true
122154
verbose: true

.github/workflows/stale.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
name: 'Close stale issues'
2+
23
on:
34
schedule:
4-
- cron: '30 1 * * *'
5+
- cron: '0 7 * * *'
56

67
jobs:
8+
79
stale:
810
runs-on: ubuntu-latest
911
steps:
1012
- uses: actions/stale@v3
1113
with:
1214
days-before-stale: 60
1315
days-before-close: 7
16+
stale-issue-label: 'stale'
17+
only-issue-labels: 'Answered,Feedback-Required,invalid,wontfix'
18+
exempt-all-milestones: true
19+
1420
stale-issue-message: >
1521
This issue has been automatically marked as stale because it has not had
1622
recent activity. It will be closed if no further activity occurs for the
1723
next 7 days. Thank you for your contributions.
24+
1825
close-issue-message: >
1926
This issue has been automatically closed due to inactivity.
20-
stale-issue-label: 'stale'
21-
only-issue-labels: 'Answered,Feedback-Required,invalid,wontfix'
22-
exempt-all-milestones: true

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ include LICENSE.txt
22
include requirements.txt
33
include autosklearn/util/logging.yaml
44
include autosklearn/requirements.txt
5+
include autosklearn/py.typed
56

67
# Meta-data
78
recursive-include autosklearn/metalearning/files *.arff *.csv *.txt

autosklearn/py.typed

Whitespace-only changes.

0 commit comments

Comments
 (0)