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
23#
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
95
106on :
11- push :
127 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+ - " **"
1326 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)
1631 - cron : ' 36 10 * * 0'
32+ workflow_dispatch :
1733
1834# Global environment variables
1935env :
2339 GIT_AUTHOR_NAME : CI User
2440
2541jobs :
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
3544
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
3953 with :
40- python-version : " 3.8 "
54+ python-version : " ${{ matrix.python_version }} "
4155
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
4561 with :
4662 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 }}"
5064
51- - name : " Install dependencies"
65+ - name : Install dependencies
5266 run : |
53- pip install --upgrade setuptools pip
54- pip install --upgrade -r dev-requirements.txt
67+ pip install -r dev-requirements.txt
5568 pip freeze
5669
57- - name : " Run linter"
58- run : |
59- pre-commit run --all-files
70+ - run : pre-commit run --all-files
6071
6172 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+
6776 strategy :
68- fail-fast : false # Do not cancel all jobs if one fails
77+ fail-fast : false
6978 matrix :
70- python_version : ["3.8"]
79+ ubuntu_version : ["22.04"]
80+ python_version : ["3.9"]
7181 repo_type :
7282 - base
7383 - conda
@@ -80,44 +90,44 @@ jobs:
8090 - unit
8191 - venv
8292 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"
8498 repo_type : venv
8599
86100 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
92103 with :
93- python-version : ${{ matrix.python_version }}
104+ python-version : " ${{ matrix.python_version }}"
94105
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
98108 with :
99109 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
103116
104- - name : " Install"
117+ - name : Install repo2docker
105118 run : |
106- pip install --upgrade setuptools pip wheel
107- pip install --upgrade -r dev-requirements.txt
108119 python setup.py bdist_wheel
109120 pip install dist/*.whl
121+
110122 # add for mercurial tests
111123 pip install mercurial hg-evolve
124+
112125 pip freeze
113126
114- - name : " Run tests "
127+ - name : Run pytest
115128 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 }}
118130
119- - name : " Upload code coverage stats "
131+ - name : Submit codecov report
120132 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