Skip to content

Instantly share code, notes, and snippets.

@jhj0517
Created December 27, 2024 07:52
Show Gist options
  • Save jhj0517/4b1e912db3fdae1a4f315815bcfe00bb to your computer and use it in GitHub Desktop.
Save jhj0517/4b1e912db3fdae1a4f315815bcfe00bb to your computer and use it in GitHub Desktop.
pytest-ci.yaml
name: CI
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
# Update python version matrix compatible with your project
python: ["3.10", "3.11", "3.12"]
env:
# Use API Key from GA's environment variables for testing. You can remove this line if you don't need it.
SERVICE_API_KEY: ${{ secrets.SERVICE_API_KEY }}
steps:
# This will remove unnecessary files to free up space. This has done because some package needs more space to install. e.g.) torch
- name: Clean up space for action
run: rm -rf /opt/hostedtoolcache
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
# Install project dependencies with pytest and run tests
- name: Install dependencies
run: pip install -r requirements.txt pytest
# `-rs` flag is used to debug for the test failure
- name: Run test
run: python -m pytest -rs tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment