Fixed tests #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: build | |
env: | |
package: sploitkit | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install pandoc | |
run: sudo apt-get install -y pandoc | |
- name: Install ${{ env.package }} | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pytest pytest-cov pytest-pythonpath coverage | |
pip install -r requirements.txt | |
pip install . | |
- name: Test ${{ env.package }} with pytest | |
run: | | |
pytest --cov=$package | |
coverage: | |
needs: build | |
runs-on: ubuntu-latest | |
env: | |
cov_badge_path: docs/coverage.svg | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install pandoc | |
run: sudo apt-get install -y pandoc notification-daemon | |
- name: Install ${{ env.package }} | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pytest pytest-cov pytest-pythonpath | |
pip install -r requirements.txt | |
pip install . | |
- name: Make coverage badge for ${{ env.package }} | |
run: | | |
pip install genbadge[coverage] | |
pytest --cov=$package --cov-report=xml | |
genbadge coverage -i coverage.xml -o $cov_badge_path | |
- name: Verify Changed files | |
uses: tj-actions/verify-changed-files@v12 | |
id: changed_files | |
with: | |
files: ${{ env.cov_badge_path }} | |
- name: Commit files | |
if: steps.changed_files.outputs.files_changed == 'true' | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add $cov_badge_path | |
git commit -m "Updated coverage.svg" | |
- name: Push changes | |
if: steps.changed_files.outputs.files_changed == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.github_token }} | |
branch: ${{ github.ref }} |