Update Gists #653
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
name: Update Gists | |
on: | |
schedule: | |
- cron: '0 */12 * * *' # Runs every 12 hours (change here for more or less periodicity) | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
update-gists: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run linter | |
run: ruff check . | |
- name: Run Tests | |
run: | | |
pytest | |
- name: Run tests with coverage | |
run: | | |
python -m coverage run -p -m pytest | |
python -m coverage combine | |
python -m coverage report -m --skip-covered | |
python -m coverage json | |
- name: Upload coverage to Codecov | |
uses: codecov/[email protected] | |
with: | |
file: ./coverage.json | |
flags: unittests | |
name: codecov-umbrella | |
- name: Run cProfile | |
run: | | |
python tests/profile_gists.py | |
- name: Upload profiling results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: profiling-results | |
path: tests/restats | |
- name: Run Update Script | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GISTMASTER_TOKEN: ${{ secrets.GISTMASTER_TOKEN }} | |
run: | | |
python scripts/update_gists.py | |
- name: Commit and Push Changes | |
if: github.repository != 'local-testing' # Ensure this step is skipped for local testing | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add . | |
git commit -m "chore: update gists" || echo "No changes to commit" | |
git push |