Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiple python versions to CI tests #858

Merged
merged 25 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c8536f1
Add multiple python versions to CI tests
shaunagm Jul 26, 2023
fb58f59
Remove duplicate key
shaunagm Jul 26, 2023
d2b4563
Combine CI jobs
shaunagm Jul 26, 2023
32b5a1d
Update ubuntu image and actually install Python versions
shaunagm Jul 26, 2023
a5ddd82
Replace pyenv with apt-get to install python versions
shaunagm Jul 26, 2023
bbae815
Remove sudo
shaunagm Jul 26, 2023
421b6a1
Remove get from 'apt-get'
shaunagm Jul 26, 2023
7b00140
Update apt before attempting to install
shaunagm Jul 26, 2023
8f0ab5e
Add ppa/deadsnakes repository
shaunagm Jul 26, 2023
e148501
Add prereq
shaunagm Jul 26, 2023
83d15a6
Fix typo
shaunagm Jul 26, 2023
bcd9a87
Add -y to install command
shaunagm Jul 26, 2023
5497f03
Move -y to correct spot
shaunagm Jul 26, 2023
eadcdc4
Add more -ys
shaunagm Jul 26, 2023
4183899
Add some echoes to debug
shaunagm Jul 26, 2023
15e02e6
Switch back to pyenv approach
shaunagm Jul 26, 2023
faf6587
Remove tests from circleci config and move to new github actions config
shaunagm Jul 31, 2023
2dbf3b4
Split out Mac tests into seaparate file
shaunagm Jul 31, 2023
fd922b1
Set testing environmental variable separately
shaunagm Jul 31, 2023
876e08b
First attempt to add depdendency cache
shaunagm Jul 31, 2023
d7959f4
Remove windows tests for now
shaunagm Jul 31, 2023
7786c26
Fix circleci config
shaunagm Jul 31, 2023
ca9e69c
Fix circleci for real this time
shaunagm Jul 31, 2023
2debaa1
Merge branch 'main' into update-ci
shaunagm Jul 31, 2023
af933e7
Add tests on merging of PRs and update readme to show we do not suppo…
shaunagm Aug 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Contributor

@gcollazo gcollazo Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding "on push" so tests run once more when PRs are merged into main

on:
  push:
    branches: ["main"]

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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding "on push"

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