From 203b37a051808cb315a5af0bc63be8e166f08b28 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 27 May 2023 13:48:03 -0700 Subject: [PATCH] aider: Added GitHub Actions workflow for running Python tests on push and pull request to the main branch. # 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. --- .github/workflows/python-tests.yml | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/python-tests.yml diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml new file mode 100644 index 000000000..f1faf92af --- /dev/null +++ b/.github/workflows/python-tests.yml @@ -0,0 +1,34 @@ +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