Merge pull request #4 from janthmueller:dev #12
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
# .github/workflows/python-tests.yml | |
name: Unit Tests | |
on: | |
push: | |
branches: | |
- '*' # Trigger on push to all branches | |
jobs: | |
test: | |
runs-on: ubuntu-latest # The environment to run the job in | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 # Checkout the repository code | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' # Specify the Python version to use | |
- name: Install dependencies | |
run: | | |
if [ -f requirements.txt ]; then | |
echo "requirements.txt found, installing dependencies..." | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
else | |
echo "requirements.txt not found, skipping dependency installation." | |
fi | |
- name: Run tests | |
run: | | |
mkdir -p test-results # Create directory for test results | |
python -m unittest discover -s tests -p "*test.py" | tee test-results/test_output.log | |
# Here, we're redirecting output to a log file in the test-results directory | |
- name: Upload test results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: unittest-results | |
path: test-results/test_output.log |