Skip to content

Commit 0e0da59

Browse files
committed
Enable CI caching with daily timeouts
Also update GitHub Actions versions and correct a minor oddity in tox.ini config.
1 parent 567ac66 commit 0e0da59

File tree

3 files changed

+65
-12
lines changed

3 files changed

+65
-12
lines changed

.github/workflows/build.yaml

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,24 @@ jobs:
77
mypy:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
11-
- uses: actions/setup-python@v2
10+
- uses: actions/checkout@v3
11+
- uses: actions/setup-python@v4
12+
with:
13+
python-version: '3.x'
14+
15+
- name: get date for caching
16+
id: get-week-number
17+
run: echo "cachedate=$(/bin/date -u "+%U")" >>$GITHUB_OUTPUT
18+
shell: bash
19+
20+
- name: cache pip packages
21+
uses: actions/cache@v3
22+
with:
23+
path: ~/.cache/pip
24+
key: pip-os-${{ runner.os }}-weeknum-${{ steps.get-week-number.outputs.cachedate }}-job-${{ github.job }}
25+
1226
- run: python -m pip install tox
27+
1328
- run: python -m tox run -e mypy
1429

1530
test:
@@ -20,12 +35,30 @@ jobs:
2035
name: "Run Tests on ${{ matrix.os }}, py${{ matrix.py }}"
2136
runs-on: ${{ matrix.os }}
2237
steps:
23-
- uses: actions/checkout@v2
24-
- uses: actions/setup-python@v2
38+
- uses: actions/checkout@v3
39+
- uses: actions/setup-python@v4
2540
with:
2641
python-version: ${{ matrix.py }}
27-
- name: install requirements
28-
run: python -m pip install tox
42+
43+
- name: get date for caching
44+
id: get-week-number
45+
run: echo "cachedate=$(/bin/date -u "+%U")" >>$GITHUB_OUTPUT
46+
shell: bash
47+
48+
- name: cache pip packages
49+
uses: actions/cache@v3
50+
with:
51+
path: ~/.cache/pip
52+
key: pip-os-${{ runner.os }}-weeknum-${{ steps.get-week-number.outputs.cachedate }}-job-${{ github.job }}
53+
54+
- run: python -m pip install tox
55+
56+
- name: cache tox virtualenvs
57+
uses: actions/cache@v3
58+
with:
59+
path: .tox
60+
key: tox-os-${{ runner.os }}-py${{ matrix.py }}-weeknum-${{ steps.get-week-number.outputs.cachedate }}-job-${{ github.job }}-hash-${{ hashFiles('tox.ini', 'setup.cfg') }}
61+
2962
- name: test
3063
run: python -m tox run -m ci
3164
- name: twine-check
@@ -35,15 +68,30 @@ jobs:
3568
name: "Self-Check"
3669
runs-on: ubuntu-latest
3770
steps:
38-
- uses: actions/checkout@v2
39-
- uses: actions/setup-python@v2
71+
- uses: actions/checkout@v3
72+
73+
- uses: actions/setup-python@v4
74+
with:
75+
python-version: '3.x'
76+
77+
- name: get date for caching
78+
id: get-week-number
79+
run: echo "cachedate=$(/bin/date -u "+%U")" >>$GITHUB_OUTPUT
80+
shell: bash
81+
82+
- name: cache pip packages
83+
uses: actions/cache@v3
4084
with:
41-
python-version: '3.11'
85+
path: ~/.cache/pip
86+
key: pip-os-${{ runner.os }}-weeknum-${{ steps.get-week-number.outputs.cachedate }}-job-${{ github.job }}
87+
4288
- name: install from source
4389
run: |
4490
python -m pip install -U pip setuptools
4591
python -m pip install .
92+
4693
- name: run on own workflows via HTTPS schema
4794
run: check-jsonschema --schemafile "https://json.schemastore.org/github-workflow" .github/workflows/*.yaml
95+
4896
- name: run on own workflows via vendored schema
4997
run: check-jsonschema --builtin-schema vendor.github-workflows .github/workflows/*.yaml

.github/workflows/daily.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@ jobs:
1010
vendor-schemas:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
14-
- uses: actions/setup-python@v2
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-python@v4
15+
with:
16+
python-version: '3.x'
17+
1518
- name: install tox
1619
run: python -m pip install 'tox'
20+
1721
- name: vendor-schemas
1822
run: make vendor-schemas
23+
1924
# this action seems to have significant usage, so it should be stable
2025
# can always re-implement with `git status --porcelain`, etc. if necessary
2126
- name: Create Pull Request

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ labels =
1010
envlist =
1111
cov_clean
1212
py{311,310,39,38,37}
13-
py{37,310}-{tomli}{,-format}
13+
py{37,310}-tomli{,-format}
1414
py{37,311}-{json5,pyjson5}
1515
cov
1616
skip_missing_interpreters = true

0 commit comments

Comments
 (0)