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

# Aider chat conversation: USER: add a new workflow that will build the docker image and make sure the tests succeed inside it ASSISTANT: To add a new workflow that builds the Docker image and runs tests inside it, we need to create a new GitHub Actions workflow file. Let's call it `docker-build-and-test.yml` and place it in the `.github/workflows/` directory. Here is the *SEARCH/REPLACE block* for the new file: ```yaml .github/workflows/docker-build-and-test.yml <<<<<<< SEARCH ======= name: Docker Build and Test on: push: branches: - main pull_request: branches: - main jobs: build: runs-on: ubuntu-latest steps: - name: Check out repository uses: actions/checkout@v3 - name: Build Docker image run: | docker build -t myapp:latest . - name: Run tests in Docker container run: | docker run myapp:latest python -m unittest discover -s tests >>>>>>> REPLACE ``` This workflow will trigger on every push and pull request to the `main` branch. It will build a Docker image from the Dockerfile in the root directory of the repository and then run the tests inside a container from that image.
25 lines
440 B
YAML
25 lines
440 B
YAML
name: Docker Build and Test
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Build Docker image
|
|
run: |
|
|
docker build -t myapp:latest .
|
|
|
|
- name: Run tests in Docker container
|
|
run: |
|
|
docker run myapp:latest python -m unittest discover -s tests
|