Skip to content

Commit

Permalink
CI improvements (#1860)
Browse files Browse the repository at this point in the history
* Add check-latest to setup-python
* Use pyproject.toml for hash
  • Loading branch information
cdce8p authored and Pierre-Sassoulas committed Nov 19, 2022
1 parent a48a915 commit 7dab003
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 27 deletions.
43 changes: 21 additions & 22 deletions .github/workflows/ci.yaml
Expand Up @@ -8,7 +8,8 @@ on:
pull_request: ~

env:
CACHE_VERSION: 6
CACHE_VERSION: 1
KEY_PREFIX: venv
DEFAULT_PYTHON: "3.10"
PRE_COMMIT_CACHE: ~/.cache/pre-commit

Expand All @@ -25,12 +26,14 @@ jobs:
uses: actions/setup-python@v4.0.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
- name: Generate partial Python venv restore key
id: generate-python-key
run: >-
echo "::set-output name=key::base-venv-${{ env.CACHE_VERSION }}-${{
hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt',
'requirements_test_brain.txt', 'requirements_test_pre_commit.txt') }}"
echo "key=base-venv-${{ env.CACHE_VERSION }}-${{
hashFiles('pyproject.toml', 'requirements_test.txt',
'requirements_test_min.txt', 'requirements_test_brain.txt',
'requirements_test_pre_commit.txt') }}" >> $GITHUB_OUTPUT
- name: Restore Python virtual environment
id: cache-venv
uses: actions/cache@v3.0.4
Expand All @@ -39,8 +42,6 @@ jobs:
key: >-
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
steps.generate-python-key.outputs.key }}
restore-keys: |
${{ runner.os }}-${{ steps.python.outputs.python-version }}-base-venv-${{ env.CACHE_VERSION }}-
- name: Create Python virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
Expand All @@ -61,8 +62,6 @@ jobs:
path: ${{ env.PRE_COMMIT_CACHE }}
key: >-
${{ runner.os }}-${{ steps.generate-pre-commit-key.outputs.key }}
restore-keys: |
${{ runner.os }}-pre-commit-${{ env.CACHE_VERSION }}-
- name: Install pre-commit dependencies
if: steps.cache-precommit.outputs.cache-hit != 'true'
run: |
Expand Down Expand Up @@ -92,16 +91,18 @@ jobs:
uses: actions/setup-python@v4.0.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Install Qt
if: ${{ matrix.python-version == '3.10' }}
run: |
sudo apt-get install build-essential libgl1-mesa-dev
- name: Generate partial Python venv restore key
id: generate-python-key
run: >-
echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{
hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt',
'requirements_test_brain.txt') }}"
echo "key=${{ env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{
hashFiles('pyproject.toml', 'requirements_test.txt',
'requirements_test_min.txt', 'requirements_test_brain.txt') }}" >>
$GITHUB_OUTPUT
- name: Restore Python virtual environment
id: cache-venv
uses: actions/cache@v3.0.4
Expand All @@ -110,8 +111,6 @@ jobs:
key: >-
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
steps.generate-python-key.outputs.key }}
restore-keys: |
${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}-
- name: Create Python virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
Expand Down Expand Up @@ -148,6 +147,7 @@ jobs:
uses: actions/setup-python@v4.0.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Restore Python virtual environment
id: cache-venv
uses: actions/cache@v3.0.4
Expand Down Expand Up @@ -196,12 +196,13 @@ jobs:
uses: actions/setup-python@v4.0.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Generate partial Python venv restore key
id: generate-python-key
run: >-
echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{
hashFiles('setup.cfg', 'requirements_test_min.txt',
'requirements_test_brain.txt') }}"
echo "key=${{ env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{
hashFiles('pyproject.toml', 'requirements_test_min.txt',
'requirements_test_brain.txt') }}" >> $env:GITHUB_OUTPUT
- name: Restore Python virtual environment
id: cache-venv
uses: actions/cache@v3.0.4
Expand All @@ -210,8 +211,6 @@ jobs:
key: >-
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
steps.generate-python-key.outputs.key }}
restore-keys: |
${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}-
- name: Create Python virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
Expand Down Expand Up @@ -241,11 +240,13 @@ jobs:
uses: actions/setup-python@v4.0.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Generate partial Python venv restore key
id: generate-python-key
run: >-
echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{
hashFiles('setup.cfg', 'requirements_test_min.txt') }}"
echo "key=${{ env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{
hashFiles('pyproject.toml', 'requirements_test_min.txt')
}}" >> $GITHUB_OUTPUT
- name: Restore Python virtual environment
id: cache-venv
uses: actions/cache@v3.0.4
Expand All @@ -254,8 +255,6 @@ jobs:
key: >-
${{ runner.os }}-${{ matrix.python-version }}-${{
steps.generate-python-key.outputs.key }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-venv-${{ env.CACHE_VERSION }}-
- name: Create Python virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/release-tests.yml
Expand Up @@ -2,9 +2,6 @@ name: Release tests

on: workflow_dispatch

env:
DEFAULT_PYTHON: "3.10"

permissions:
contents: read

Expand All @@ -16,8 +13,8 @@ jobs:
timeout-minutes: 5
steps:
- name: Check out code from GitHub
uses: actions/checkout@v3.0.2
- name: Set up Python
uses: actions/checkout@v3.1.0
- name: Set up Python 3.9
id: python
uses: actions/setup-python@v4.0.0
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Expand Up @@ -26,6 +26,7 @@ jobs:
uses: actions/setup-python@v4.0.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
- name: Install requirements
run: |
# Remove dist, build, and astroid.egg-info
Expand Down

0 comments on commit 7dab003

Please sign in to comment.