Improve cache management
Run tests in master schedule to build cache.
@@ -6,8 +6,10 @@ env:
on:
pull_request:
- # branches:
- # - master
+ branches:
+ - master
+ schedule:
+ - cron: "0 1 * * *"
concurrency:
group: unit-${{ github.head_ref }}
@@ -17,9 +19,10 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
if: >
- github.event.pull_request.draft == false &&
+ (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/')
+ !contains(github.event.pull_request.head.ref, 'datadog-api-spec/test/')) ||
+ github.event_name == 'schedule'
steps:
- name: Get GitHub App token
id: get_token
@@ -34,12 +37,12 @@ jobs:
token: ${{ steps.get_token.outputs.token }}
- uses: actions/setup-python@v4
with:
- python-version: '3.10'
+ python-version: '3.11'
- name: Install pre-commit
run: python -m pip install pre-commit
- name: set PY
- run: echo "PY=$(python -c 'import hashlib, sys, platform;print(hashlib.sha256(platform.python_version().encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_ENV
- - uses: actions/cache@v2
+ run: echo "PY=$(python -c 'import platform;print(platform.python_version())')" >> $GITHUB_ENV
+ - uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
@@ -71,9 +74,9 @@ jobs:
strategy:
matrix:
go-version: [1.18.x, 1.19.x]
- platform: [ubuntu-latest, macos-latest]
+ platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
- 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/')
+ 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'
steps:
- name: Checkout code
uses: actions/checkout@v3
