Skip to content

Commit

Permalink
add matrix of python versions to GHA test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cognifloyd committed Dec 14, 2022
1 parent d5f5ff7 commit 3a982c5
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# This Lint workflow uses pants
name: Lint
# This Test workflow uses pants
name: Test

on:
push:
Expand All @@ -23,10 +23,21 @@ on:
# - cron: '0 0 * * *'

jobs:
# Lint checks which don't depend on any service containes, etc. to be running.
lint-checks:
name: 'Tests: (pants runs: pytest)'
test:
name: '${{ matrix.name }} - Python ${{ matrix.python-version-short }}'
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
# NOTE: We need to use full Python version as part of Python deps cache key otherwise
# setup virtualenv step will fail.
include:
- name: 'Test (pants runs: pytest)'
python-version-short: '3.6'
python-version: '3.6.13'
- name: 'Test (pants runs: pytest)'
python-version-short: '3.8'
python-version: '3.8.10'

env:
COLUMNS: '120'
Expand All @@ -38,6 +49,12 @@ jobs:
# a test uses a submodule, and pants needs access to it to calculate deps.
submodules: 'true'

- name: 'Set up Python (${{ matrix.python-version }})'
uses: actions/setup-python@v2
with:
python-version: '${{ matrix.python-version }}'


#- name: Cache APT Dependencies
# id: cache-apt-deps
# uses: actions/cache@v2
Expand Down Expand Up @@ -69,7 +86,7 @@ jobs:
with:
base-branch: master
# To ignore a bad cache, bump the cache* integer.
gha-cache-key: cache0
gha-cache-key: cache0-py${{ matrix.python-version }}
# This hash should include all of our lockfiles so that the pip/pex caches
# get invalidated on any transitive dependency update.
named-caches-hash: ${{ hashFiles('requirements.txt') }}
Expand All @@ -78,7 +95,7 @@ jobs:

- name: Test
# We do not support running pytest everywhere yet. When we do it will be simply:
# ./pants lint ::
# ./pants test ::
# Until then, we need to manually adjust this command line to test what we can.
run: |
./pants test pylint_plugins/:: pants-plugins/::
Expand Down

0 comments on commit 3a982c5

Please sign in to comment.