Skip to content

Commit be498eb

Browse files
authored
Try to improve cache management (#1256)
- Run pre-commit and tests on master schedule to make sure cache is built - Simplify cache key
1 parent 88dc3cc commit be498eb

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
pull_request:
99
branches:
1010
- master
11+
schedule:
12+
- cron: "0 2 * * *"
1113

1214
concurrency:
1315
group: unit-${{ github.head_ref }}
@@ -17,9 +19,10 @@ jobs:
1719
pre-commit:
1820
runs-on: ubuntu-latest
1921
if: >
20-
github.event.pull_request.draft == false &&
22+
(github.event.pull_request.draft == false &&
2123
!contains(github.event.pull_request.labels.*.name, 'ci/skip') &&
22-
!contains(github.event.pull_request.head.ref, 'datadog-api-spec/test/')
24+
!contains(github.event.pull_request.head.ref, 'datadog-api-spec/test/')) ||
25+
github.event_name == 'schedule'
2326
steps:
2427
- name: Get GitHub App token
2528
id: get_token
@@ -38,8 +41,8 @@ jobs:
3841
- name: Install pre-commit
3942
run: python -m pip install pre-commit
4043
- name: set PY
41-
run: echo "PY=$(python -c 'import hashlib, sys, platform;print(hashlib.sha256(platform.python_version().encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_ENV
42-
- uses: actions/cache@v2
44+
run: echo "PY=$(python -c 'import platform;print(platform.python_version())')" >> $GITHUB_ENV
45+
- uses: actions/cache@v3
4346
with:
4447
path: ~/.cache/pre-commit
4548
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
@@ -78,7 +81,7 @@ jobs:
7881
# - platform: windows-latest
7982
# python-version: 3.7
8083
runs-on: ${{ matrix.platform }}
81-
if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'ci/skip') && !contains(github.event.pull_request.head.ref, 'datadog-api-spec/test/')
84+
if: (github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'ci/skip') && !contains(github.event.pull_request.head.ref, 'datadog-api-spec/test/')) || github.event_name == 'schedule'
8285
steps:
8386
- uses: actions/checkout@v3
8487
- name: Set up Python ${{ matrix.python-version }}

0 commit comments

Comments
 (0)