1
- # Useful GitHub Actions docs:
1
+ # This is a GitHub workflow defining a set of jobs with a set of steps.
2
+ # ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
2
3
#
3
- # - https://help.github.com/en/actions
4
- # - https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
5
- # - https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow
6
- # - https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions
7
-
8
- name : Continuous Integration
4
+ name : Test
9
5
10
6
on :
11
- push :
12
7
pull_request :
8
+ paths-ignore :
9
+ - " docs/**"
10
+ - " **.md"
11
+ - " **.rst"
12
+ - " .github/workflows/*"
13
+ - " !.github/workflows/test.yml"
14
+ push :
15
+ paths-ignore :
16
+ - " docs/**"
17
+ - " **.md"
18
+ - " **.rst"
19
+ - " .github/workflows/*"
20
+ - " !.github/workflows/test.yml"
21
+ branches-ignore :
22
+ - " dependabot/**"
23
+ - " pre-commit-ci-update-config"
24
+ tags :
25
+ - " **"
13
26
schedule :
14
- # Weekly test so we know if tests break for external reasons
15
- # https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#scheduled-events
27
+ # Run weekly test so we know if tests break for external reasons
28
+ # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#scheduled-events
29
+ #
30
+ # At 10:36 on Sunday (https://crontab.guru)
16
31
- cron : ' 36 10 * * 0'
32
+ workflow_dispatch :
17
33
18
34
# Global environment variables
19
35
env :
23
39
GIT_AUTHOR_NAME : CI User
24
40
25
41
jobs :
26
- # Job to run linter / autoformat
27
- lint :
28
- runs-on : ubuntu-20.04
29
- steps :
30
- # Action Repo: https://github.com/actions/checkout
31
- - name : " Checkout repo"
32
- uses : actions/checkout@v2
33
- with :
34
- fetch-depth : 0
42
+ pre-commit :
43
+ runs-on : ubuntu-22.04
35
44
36
- # Action Repo: https://github.com/actions/setup-python
37
- - name : " Setup Python"
38
- uses : actions/setup-python@v2
45
+ strategy :
46
+ fail-fast : false
47
+ matrix :
48
+ python_version : ["3.9"]
49
+
50
+ steps :
51
+ - uses : actions/checkout@v3
52
+ - uses : actions/setup-python@v4
39
53
with :
40
- python-version : " 3.8 "
54
+ python-version : " ${{ matrix.python_version }} "
41
55
42
- # Action Repo: https://github.com/actions/cache
43
- - name : " Cache pip dependencies"
44
- uses : actions/cache@v2
56
+ # There will almost never be a cache hit on the cache key when this job is
57
+ # run, as it is the first of all jobs in this workflow. The subsequent
58
+ # jobs in this workflow can rely on this cache though.
59
+ - name : Save pip's install cache on job completion
60
+ uses : actions/cache@v3
45
61
with :
46
62
path : ~/.cache/pip
47
- key : ${{ runner.os }}-pip-${{ hashFiles('dev-requirements.txt') }}
48
- restore-keys : |
49
- ${{ runner.os }}-pip-
63
+ key : " ${{ github.run_id }}-${{ matrix.python_version }}"
50
64
51
- - name : " Install dependencies"
65
+ - name : Install dependencies
52
66
run : |
53
- pip install --upgrade setuptools pip
54
- pip install --upgrade -r dev-requirements.txt
67
+ pip install -r dev-requirements.txt
55
68
pip freeze
56
69
57
- - name : " Run linter"
58
- run : |
59
- pre-commit run --all-files
70
+ - run : pre-commit run --all-files
60
71
61
72
test :
62
- # Previous job must have successfully completed for this job to execute
63
- # - https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idneeds
64
- needs : lint
65
- runs-on : ubuntu-20.04
66
- # - https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategy
73
+ needs : pre-commit
74
+ runs-on : ubuntu-${{ matrix.ubuntu_version }}
75
+
67
76
strategy :
68
- fail-fast : false # Do not cancel all jobs if one fails
77
+ fail-fast : false
69
78
matrix :
70
- python_version : ["3.8"]
79
+ ubuntu_version : ["22.04"]
80
+ python_version : ["3.9"]
71
81
repo_type :
72
82
- base
73
83
- conda
@@ -80,44 +90,44 @@ jobs:
80
90
- unit
81
91
- venv
82
92
include :
83
- - python_version : " 3.6"
93
+ # The actions/setup-python action with Python version 3.6 isn't
94
+ # possible to use with the ubuntu-22.04 runner, so we use ubuntu-20.04
95
+ # for this test where Python 3.6 remain available.
96
+ - ubuntu_version : " 20.04"
97
+ python_version : " 3.6"
84
98
repo_type : venv
85
99
86
100
steps :
87
- - name : " Checkout repo"
88
- uses : actions/checkout@v2
89
-
90
- - name : " Setup Python"
91
- uses : actions/setup-python@v2
101
+ - uses : actions/checkout@v3
102
+ - uses : actions/setup-python@v4
92
103
with :
93
- python-version : ${{ matrix.python_version }}
104
+ python-version : " ${{ matrix.python_version }}"
94
105
95
- # Action Repo: https://github.com/actions/cache
96
- - name : " Cache pip dependencies"
97
- uses : actions/cache@v2
106
+ - name : Restore pip's install cache from previous job
107
+ uses : actions/cache@v3
98
108
with :
99
109
path : ~/.cache/pip
100
- key : ${{ runner.os }}-pip-${{ hashFiles('dev-requirements.txt') }}
101
- restore-keys : |
102
- ${{ runner.os }}-pip-
110
+ key : " ${{ github.run_id }}-${{ matrix.python_version }}"
111
+
112
+ - name : Install dependencies
113
+ run : |
114
+ pip install -r dev-requirements.txt
115
+ pip freeze
103
116
104
- - name : " Install"
117
+ - name : Install repo2docker
105
118
run : |
106
- pip install --upgrade setuptools pip wheel
107
- pip install --upgrade -r dev-requirements.txt
108
119
python setup.py bdist_wheel
109
120
pip install dist/*.whl
121
+
110
122
# add for mercurial tests
111
123
pip install mercurial hg-evolve
124
+
112
125
pip freeze
113
126
114
- - name : " Run tests "
127
+ - name : Run pytest
115
128
run : |
116
- cd tests
117
- pytest --durations 10 --cov repo2docker -v ${{ matrix.repo_type }}
129
+ pytest --verbose --color=yes --durations=10 --cov=repo2docker tests/${{ matrix.repo_type }}
118
130
119
- - name : " Upload code coverage stats "
131
+ - name : Submit codecov report
120
132
run : |
121
- pip install codecov
122
- pushd tests && codecov && cat
123
- cat /home/runner/work/repo2docker/repo2docker/tests/coverage.xml
133
+ codecov
0 commit comments