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

MNT: update github actions with logical sequence of tests #500

Merged
merged 34 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
872f5aa
GIT: fix the draft PR check if PR is a draft
Gui-FernandesBR Dec 3, 2023
7202e59
GIT: Add pip cache to setup-python action
Gui-FernandesBR Dec 3, 2023
0dc8da0
GIT: Add pytest runslow flag for master branch
Gui-FernandesBR Dec 3, 2023
12d6c7f
GIT: Fix condition for checking if PR is draft
Gui-FernandesBR Dec 3, 2023
3d435e3
GIT: remove 'needs' attribute from pytest action
Gui-FernandesBR Dec 3, 2023
a8dde87
WIP: remove assign reviewers
Gui-FernandesBR Dec 17, 2023
2ef1cc5
WIP: improve actions
Gui-FernandesBR Dec 17, 2023
b517a1d
WIP: bump black python requirement
Gui-FernandesBR Dec 17, 2023
8816c2d
WIP: Update pytest command to include slow tests
Gui-FernandesBR Dec 17, 2023
e0b6232
WIP: separate into different jobs
Gui-FernandesBR Dec 17, 2023
a81e7c9
WIP: separate different jobs
Gui-FernandesBR Dec 17, 2023
8c50269
WIP: avoid alias
Gui-FernandesBR Dec 17, 2023
a1ed431
WIP: update dependencies
Gui-FernandesBR Dec 17, 2023
f78d518
WIP: improve the pip install step
Gui-FernandesBR Dec 17, 2023
d79863d
WIP: no longer runs bash external file
Gui-FernandesBR Dec 17, 2023
68e957c
WIP: join build and unit tests
Gui-FernandesBR Dec 17, 2023
3f74377
WIP: Fix typo in requirements file names
Gui-FernandesBR Dec 17, 2023
d2d104e
WIP: rename Codecov workflow for uploading coverage reports
Gui-FernandesBR Dec 17, 2023
0538228
WIP: try new codecov strategy
Gui-FernandesBR Dec 17, 2023
5381193
WIP: rename targets coverage.xml
Gui-FernandesBR Dec 17, 2023
8669b75
WIP: rename coverage files
Gui-FernandesBR Dec 17, 2023
ac3bd25
WIP: better codecov workflow
Gui-FernandesBR Dec 17, 2023
9dfa748
WIP: pip install tests requirements
Gui-FernandesBR Dec 17, 2023
6db551d
WIP: change the "needs" fields again
Gui-FernandesBR Dec 17, 2023
549abd3
WIP: setting up python correctly
Gui-FernandesBR Dec 17, 2023
216844d
WIP: only normal and slow jobs now
Gui-FernandesBR Dec 17, 2023
895b232
WIP: trying to speedup code
Gui-FernandesBR Dec 17, 2023
c4d9924
WIP: Update test_pytest.yaml to improve test coverage
Gui-FernandesBR Dec 18, 2023
be91e8b
WIP: update checkout version
Gui-FernandesBR Dec 18, 2023
d3f2a25
WIP: Add directory change to fix pytest command
Gui-FernandesBR Dec 18, 2023
1f69500
WIP: Add cache for Python dependencies in GitHub Actions workflow
Gui-FernandesBR Dec 18, 2023
0bb7cf7
WIP: docs tests were not being captured
Gui-FernandesBR Dec 18, 2023
397e299
MNT: Add codecov.yml configuration file
Gui-FernandesBR Dec 18, 2023
e1c6d6f
MNT: Update Python version to 3.8 when running black linter
Gui-FernandesBR Dec 20, 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
20 changes: 0 additions & 20 deletions .github/auto-assign.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,2 @@
# Set to true to add reviewers to PRs
addReviewers: true

# Set to 'author' to add PR's author as a assignee
addAssignees: author

# A list of reviewers to be added to PRs (GitHub user name)
reviewers:
- Gui-FernandesBR
- giovaniceotto
- MateusStano
- phmbressan

# A number of reviewers added to the PR
# Set 0 to add all the reviewers (default: 0)
numberOfReviewers: 0

# A list of keywords to be skipped the process if PR's title include it
skipKeywords:
- wip
- work in progress
- draft
35 changes: 35 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
coverage:
status:
project:
default:
# basic
target: auto
threshold: 1%
base: auto
flags:
- unit
paths:
- "rocketpy"
# advanced settings
branches:
- master
- develop
if_ci_failed: error #success, failure, error, ignore
informational: false
only_pulls: false
patch:
default:
# basic
target: auto
threshold: 1%
base: auto
# advanced
branches:
- master
- develop
if_ci_failed: error #success, failure, error, ignore
only_pulls: false
flags:
- "unit"
paths:
- "rocketpy"
2 changes: 1 addition & 1 deletion .github/workflows/lint_black.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
python-version: 3.8

- name: Install Python dependencies
run: pip install black
run: pip install black[jupyter]

- name: Run linters
uses: wearerequired/lint-action@v1
Expand Down
104 changes: 61 additions & 43 deletions .github/workflows/test_pytest.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PyTest
name: Tests

on:
pull_request:
Expand All @@ -7,58 +7,76 @@ on:
- "**.py"
- ".github/**"

defaults:
run:
shell: bash

jobs:
fail_if_pr_is_draft:
if: github.event.pull_request.draft == true
runs-on: ubuntu-18.04
steps:
- name: Fails in order to indicate that pull request needs to be marked as ready to review and unit tests workflow needs to pass.
run: exit 1
pytest_and_doctest:
Pytest:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
python-version:
- 3.8
- 3.12
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.8, 3.12]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Build RocketPy (without optional dependencies)
run: |
pip install .
- name: Import rocketpy in python and test if it works
run: |
python -c "import sys, rocketpy; print(f'{rocketpy.__name__} running on Python {sys.version}')"
- name: Install optional dependencies
run: |
pip install -r requirements-tests.txt
- name: Test with pytest
run: |
pytest --cov=rocketpy --cov-report=xml
cd rocketpy
pytest --doctest-modules --cov=rocketpy --cov-report=xml
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3

- name: Cache Python dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-tests.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install rocketpy
run: pip install .

- name: Test importing rocketpy
run: python -c "import sys, rocketpy; print(f'{rocketpy.__name__} running on Python {sys.version}')"

- name: Install test dependencies
run: pip install -r requirements-tests.txt

- name: Run Unit Tests
run: pytest tests/unit --cov=rocketpy

- name: Run Integration Tests
run: pytest $(find tests -maxdepth 1 -name "*.py") --cov=rocketpy --cov-append

- name: Run Documentation Tests
run: pytest rocketpy --doctest-modules --cov=rocketpy --cov-append

- name: Run Acceptance Tests
run: pytest tests/acceptance --cov=rocketpy --cov-append --cov-report=xml

- name: Run pytest --runslow
if: github.ref == 'refs/heads/master'
run: pytest tests -m slow --runslow --cov=rocketpy --cov-append --cov-report=xml

- name: Upload coverage to artifacts
uses: actions/upload-artifact@v2
with:
name: coverage
path: coverage.xml

CodecovUpload:
needs: Pytest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all coverage reports
uses: actions/download-artifact@v2
- name: Upload to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/reports/
env_vars: OS,PYTHON
fail_ci_if_error: true
files: ./coverage.xml, ./rocketpy/coverage.xml
flags: unittests
name: codecov-umbrella
verbose: true
files: |
coverage.xml
29 changes: 29 additions & 0 deletions .github/workflows/upload-to-codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Upload to Codecov

on:
workflow_call:
inputs:
codecov_token:
required: true
type: string
os:
required: true
type: string
python:
required: true
type: string

jobs:
upload:
runs-on: ubuntu-latest
steps:
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ inputs.codecov_token }}
directory: ./coverage/reports/
env_vars: OS,PYTHON
files: ./coverage.xml, ./rocketpy/coverage.xml
flags: unittests
name: codecov-umbrella
verbose: true
Loading