Skip to content

Commit

Permalink
Add multiple python versions to CI tests (#858)
Browse files Browse the repository at this point in the history
* Add multiple python versions to CI tests

* Remove duplicate key

* Combine CI jobs

* Update ubuntu image and actually install Python versions

* Replace pyenv with apt-get to install python versions

* Remove sudo

* Remove get from 'apt-get'

* Update apt before attempting to install

* Add ppa/deadsnakes repository

* Add prereq

* Fix typo

* Add -y to install command

* Move -y to correct spot

* Add more -ys

* Add some echoes to debug

* Switch back to pyenv approach

* Remove tests from circleci config and move to new github actions config

Note: no caching yet, this is more of a proof of concept

* Split out Mac tests into seaparate file

* Set testing environmental variable separately

* First attempt to add depdendency cache

* Remove windows tests for now

* Fix circleci config

* Fix circleci for real this time

* Add tests on merging of PRs and update readme to show we do not support for Python 3.7
  • Loading branch information
shaunagm authored Aug 4, 2023
1 parent 349adfa commit de15142
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 48 deletions.
51 changes: 4 additions & 47 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,22 @@
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#

version: 2

workflows:
version: 2
build:
jobs:
- test
- docs-build
- docs-build-deploy:
filters:
branches:
only: main

version: 2
jobs:
test:
docker:
- image: cimg/python:3.10

working_directory: ~/repo

steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v2-dependencies-python10-{{ checksum "requirements.txt" }}
# fallback to using the latest cache if no exact match is found
- v2-dependencies-python3.10-

- run:
name: install dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
- save_cache:
paths:
- ./venv
key: v2-dependencies-python3.10-{{ checksum "requirements.txt" }}

- run:
name: run tests
command: |
. venv/bin/activate
TESTING=1 pytest -rf test/
- run:
name: check linting
command: |
. venv/bin/activate
# E203 and W503 don't work well with black
flake8 parsons/ test/ useful_resources/ --extend-ignore=E203,W503
black --check parsons/ test/ useful_resources/
- store_artifacts:
path: test-reports
destination: test-reports

# Documentation CI
docs-build:
docker:
- image: cimg/python:3.10
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/test-linux-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: tests

on:
pull_request:
branches: ["main"]
push:
branches: ["main"]

env:
TESTING: 1

jobs:
build:
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']
os: [ubuntu-latest] # add in windows-latest to add windows testing
include:
- os: ubuntu-latest
path: ~/.cache/pip
# - os: windows-latest
# path: ~\AppData\Local\pip\Cache
runs-on: ${{ matrix.os }}

steps:

- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v3
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: python -m pip install -r requirements.txt

- name: Run tests
run: pytest -rf test/

- name: check linting
run: |
# E203 and W503 don't work well with black
flake8 parsons/ test/ useful_resources/ --extend-ignore=E203,W503
black --check parsons/ test/ useful_resources/
43 changes: 43 additions & 0 deletions .github/workflows/tests-mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: tests for mac
# test mac on single python version as mac tests use 10x minutes/storage

on:
pull_request:
branches: ["main"]
push:
branches: ["main"]

env:
TESTING: 1

jobs:
build:
runs-on: macos-latest

steps:

- uses: actions/checkout@v3

- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8

- uses: actions/cache@v3
with:
path: ~/Library/Caches/pip
key: mac-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
mac-pip-
- name: Install dependencies
run: python -m pip install -r requirements.txt

- name: Run tests
run: TESTING=1 pytest -rf test/

- name: check linting
run: |
# E203 and W503 don't work well with black
flake8 parsons/ test/ useful_resources/ --extend-ignore=E203,W503
black --check parsons/ test/ useful_resources/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Parsons offers simplified interactions with these services and tools, including

This project is maintained by [The Movement Cooperative](https://movementcooperative.org/) and is named after [Lucy Parsons](https://en.wikipedia.org/wiki/Lucy_Parsons). The Movement Cooperative is a member-led organization focused on providing data, tools, and strategic support for the progressive community.

Parsons is only compatible with Python 3.7-10
Parsons is only supported for Python 3.8-10.

## Table of Contents
- [License and Usage](#license-and-usage)
Expand Down

0 comments on commit de15142

Please sign in to comment.