Skip to content
name: Run Tests on PR with changes to market_time.py
on:
pull_request:
paths:
- 'MarketTime/market_time.py'
workflow_dispatch:
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.9
- name: Copy MarketTime/ folder to tests/ directory
run: |
cp -r MarketTime/ tests/
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: |
python -m unittest tests/test_market_time.py
- name: Add test results to PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const results = `Test results:\n${process.env.unittests}`;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: results
})