Skip to content

Commit

Permalink
add action for automated testing
Browse files Browse the repository at this point in the history
  • Loading branch information
f-peverali committed Oct 15, 2024
1 parent 7d29628 commit 33a64da
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
57 changes: 57 additions & 0 deletions .github/workflows/test_python_script.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# This action executes the Python test 'test_update_index.py' and outputs the test results whenever a change to the file 'update_index.py' in the 'scripts' folder is pushed to the repository.

name: Test Python Script for index update

on:
push:
paths:
- 'scripts/update_index.py'
pull_request:
paths:
- 'scripts/update_index.py'

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
id: run_tests
run: |
python -m unittest discover -s tests -p '*.py'
continue-on-error: true

- name: Generate coverage report
run: |
pip install coverage
coverage run -m unittest discover -s tests -p '*.py'
coverage xml
coverage report
- name: Post test results as comment
if: always()
uses: actions/github-script@v4
with:
script: |
const fs = require('fs');
const results = fs.readFileSync('coverage.xml', 'utf8');
const comment = `## Test Results\n\n\`\`\`xml\n${results}\n\`\`\``;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
2 changes: 1 addition & 1 deletion .github/workflows/unzip_and_process_IG_for_archive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
push:
branches:
- gh-pages
- feature/automate-gh*
- feature/automate-gh* # TODO remove this line after testing
paths:
- IG/isik-*.zip # Trigger auf das Hinzufügen einer ZIP-Datei im IG-Ordner

Expand Down

0 comments on commit 33a64da

Please sign in to comment.