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 committed Nov 4, 2022
1 parent 2d34699 commit b8691c4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
40 changes: 19 additions & 21 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,13 +26,14 @@ jobs:
uses: actions/setup-python@v4.3.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
- name: Generate partial Python venv restore key
id: generate-python-key
run: >-
echo "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') }}" >>
$GITHUB_OUTPUT
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.11
Expand All @@ -40,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 @@ -62,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 @@ -93,16 +91,18 @@ jobs:
uses: actions/setup-python@v4.3.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 "key=venv-${{ env.CACHE_VERSION }}-${{
hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt',
'requirements_test_brain.txt') }}" >> $GITHUB_OUTPUT
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.11
Expand All @@ -111,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 @@ -149,6 +147,7 @@ jobs:
uses: actions/setup-python@v4.3.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Restore Python virtual environment
id: cache-venv
uses: actions/cache@v3.0.11
Expand Down Expand Up @@ -197,11 +196,12 @@ jobs:
uses: actions/setup-python@v4.3.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Generate partial Python venv restore key
id: generate-python-key
run: >-
echo "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',
'requirements_test_brain.txt') }}" >> $env:GITHUB_OUTPUT
- name: Restore Python virtual environment
id: cache-venv
Expand All @@ -211,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 @@ -242,11 +240,13 @@ jobs:
uses: actions/setup-python@v4.3.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Generate partial Python venv restore key
id: generate-python-key
run: >-
echo "key=venv-${{ env.CACHE_VERSION }}-${{
hashFiles('setup.cfg', 'requirements_test_min.txt') }}" >> $GITHUB_OUTPUT
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.11
Expand All @@ -255,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
5 changes: 1 addition & 4 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 @@ -17,7 +14,7 @@ jobs:
steps:
- name: Check out code from GitHub
uses: actions/checkout@v3.1.0
- name: Set up Python
- name: Set up Python 3.9
id: python
uses: actions/setup-python@v4.3.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.3.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 b8691c4

Please sign in to comment.