diff --git a/.github/auto-assign.yml b/.github/auto-assign.yml index 5b0b21e2f..f7a38c053 100644 --- a/.github/auto-assign.yml +++ b/.github/auto-assign.yml @@ -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 diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 000000000..2ec5f6c56 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -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" diff --git a/.github/workflows/lint_black.yaml b/.github/workflows/lint_black.yaml index 59c2fc353..975efd83c 100644 --- a/.github/workflows/lint_black.yaml +++ b/.github/workflows/lint_black.yaml @@ -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 diff --git a/.github/workflows/test_pytest.yaml b/.github/workflows/test_pytest.yaml index 855cac949..9934c53a6 100644 --- a/.github/workflows/test_pytest.yaml +++ b/.github/workflows/test_pytest.yaml @@ -1,4 +1,4 @@ -name: PyTest +name: Tests on: pull_request: @@ -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 diff --git a/.github/workflows/upload-to-codecov.yml b/.github/workflows/upload-to-codecov.yml new file mode 100644 index 000000000..431131c2a --- /dev/null +++ b/.github/workflows/upload-to-codecov.yml @@ -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