mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-12 15:45:00 +00:00

# Context: USER: how can i run my tests in ci on github? ASSISTANT: To run your tests in a CI environment on GitHub, you can use GitHub Actions. Here's a step-by-step guide to set up a basic Python testing workflow: 1. Create a new directory named `.github` in the root of your repository if it doesn't exist. 2. Inside the `.github` directory, create another directory named `workflows`. 3. Create a new file named `python-tests.yml` inside the `workflows` directory. Now, add the following content to the `python-tests.yml` file: ```yaml .github/workflows/python-tests.yml <<<<<<< ORIGINAL ======= name: Python Tests on: push: branches: - main pull_request: branches: - main jobs: build: runs-on: ubuntu-latest strategy: matrix: python-version: [3.6, 3.7, 3.8, 3.9] steps: - name: Check out repository uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - name: Run tests run: | python -m unittest discover >>>>>>> UPDATED ``` This workflow will run your tests on every push and pull request to the `main` branch using Python versions 3.6, 3.7, 3.8, and 3.9. After you've added the `python-tests.yml` file to your repository, GitHub Actions will automatically start running your tests according to the specified workflow.
34 lines
655 B
YAML
34 lines
655 B
YAML
name: Python Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version: [3.6, 3.7, 3.8, 3.9]
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
|
|
- name: Run tests
|
|
run: |
|
|
python -m unittest discover
|