Skip to content

Commit

Permalink
add CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
p4vook committed May 17, 2024
1 parent 7d3ef2b commit c134adf
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Python CI
on:
push:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
pip install flake8 flake8-html pytest pytest-cov pytest-html
- name: Run tests
run: |
mkdir -p reports/coverage reports/flake8 reports/junit
python -m pytest test --cov=interpreter --cov-report term --junitxml=reports/junit/junit.xml --html=reports/junit/index.html
coverage report
coverage xml -o reports/coverage/coverage.xml
coverage html -d reports/coverage
flake8 interpreter.py --exit-zero --format=html --htmldir reports/flake8 --statistics --tee --output-file reports/flake8/flake8stats.txt
- name: Upload reports
uses: actions/upload-artifact@v4
with:
name: reports
path: reports

update-badges:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout gh-pages
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Download reports
uses: actions/download-artifact@v4
with:
name: reports
path: reports
- name: Create badges
run: |
pip install genbadge[all]
genbadge tests -o badges/tests.svg
genbadge coverage -o badges/coverage.svg
genbadge flake8 -o badges/flake8.svg
- name: Deploy badges
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'Update badges'
branch: gh-pages
file_pattern: 'badges/* reports/*'
skip_fetch: true
skip_checkout: true
- name: Checkout back
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

0 comments on commit c134adf

Please sign in to comment.