From 0beba57a986f72bfb448f6d5c0b4eeff9e127c19 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Mon, 30 Oct 2023 09:08:40 -0700 Subject: [PATCH] aider: Added a new workflow that builds the Docker image and runs tests inside it. # 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. --- .github/workflows/docker-build-and-test.yml | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/docker-build-and-test.yml diff --git a/.github/workflows/docker-build-and-test.yml b/.github/workflows/docker-build-and-test.yml new file mode 100644 index 000000000..d3f12a96f --- /dev/null +++ b/.github/workflows/docker-build-and-test.yml @@ -0,0 +1,25 @@ +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