From 7d16a94695626aa36934e5f1da9b8572a7d791d2 Mon Sep 17 00:00:00 2001 From: Josh Abrahamsen Date: Sun, 13 Mar 2022 16:52:31 -0500 Subject: [PATCH 1/3] cache the buildx as well --- .github/workflows/rootski-ci.yml | 17 +++++++++++++++-- rootski_api/setup.py | 2 ++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rootski-ci.yml b/.github/workflows/rootski-ci.yml index 101ec1b6..fbf2b2c0 100644 --- a/.github/workflows/rootski-ci.yml +++ b/.github/workflows/rootski-ci.yml @@ -41,7 +41,9 @@ jobs: - name: cache dependencies uses: actions/cache@v2 with: - path: ${{ env.pythonLocation }} + path: | + ${{ env.pythonLocation }} + /tmp/.buildx-cache key: ${{ env.pythonLocation }}-${{ hashFiles('**/aws-cdk/**/setup.py', '**/rootski_api/setup.py')}} # cache the python environment for faster pre-commit @@ -65,6 +67,17 @@ jobs: # install docker-compose because it is needed to run the tests make install-docker-compose + + - name: Build production image + uses: docker/build-push-action@v2 + with: + context: . + builder: ${{ steps.buildx.outputs.name }} + file: ./rootski_api/tests/resources/Dockerfile + push: false + tags: api_build + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new - name: checkout trunk and current branches run: | @@ -81,7 +94,7 @@ jobs: # check the code quality across the entire project (formatting, linting, static code checks) make check-code-quality-ci - # run the backend tests + # run the backend tests, commenting this out so we can have githubactions handle it for us cd rootski_api make full-test-ci diff --git a/rootski_api/setup.py b/rootski_api/setup.py index f79d97c5..7d1e0705 100644 --- a/rootski_api/setup.py +++ b/rootski_api/setup.py @@ -60,3 +60,5 @@ # "version_scheme": version_scheme, # } ) + +#adding comment to trigger cache \ No newline at end of file From 0cf5bd98ddad41f6d10c75046fc8e9916424c6ff Mon Sep 17 00:00:00 2001 From: Josh Abrahamsen Date: Sun, 13 Mar 2022 16:54:41 -0500 Subject: [PATCH 2/3] fixed syntax errors --- .github/workflows/rootski-ci.yml | 22 +++++++++++----------- rootski_api/setup.py | 3 +-- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/rootski-ci.yml b/.github/workflows/rootski-ci.yml index fbf2b2c0..6724e964 100644 --- a/.github/workflows/rootski-ci.yml +++ b/.github/workflows/rootski-ci.yml @@ -67,17 +67,17 @@ jobs: # install docker-compose because it is needed to run the tests make install-docker-compose - - - name: Build production image - uses: docker/build-push-action@v2 - with: - context: . - builder: ${{ steps.buildx.outputs.name }} - file: ./rootski_api/tests/resources/Dockerfile - push: false - tags: api_build - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new + + - name: Build production image + uses: docker/build-push-action@v2 + with: + context: . + builder: ${{ steps.buildx.outputs.name }} + file: ./rootski_api/tests/resources/Dockerfile + push: false + tags: api_build + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new - name: checkout trunk and current branches run: | diff --git a/rootski_api/setup.py b/rootski_api/setup.py index 7d1e0705..b5005932 100644 --- a/rootski_api/setup.py +++ b/rootski_api/setup.py @@ -49,6 +49,7 @@ # return: version of the form ``X.X.X`` # """ # return ".dirty" if version.dirty else "" +# adding comment to trigger cache if __name__ == "__main__": setup( @@ -60,5 +61,3 @@ # "version_scheme": version_scheme, # } ) - -#adding comment to trigger cache \ No newline at end of file From 071e8ae06aa8b0f43ff58903e92b5ced75edd8cb Mon Sep 17 00:00:00 2001 From: Josh Abrahamsen Date: Sun, 13 Mar 2022 17:05:42 -0500 Subject: [PATCH 3/3] new ci bypassing the git commands --- .github/workflows/rootski-ci.yml | 2 +- rootski_api/tests/ci/Dockerfile | 8 ++++++ rootski_api/tests/ci/docker-compose.yml | 33 +++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 rootski_api/tests/ci/Dockerfile create mode 100644 rootski_api/tests/ci/docker-compose.yml diff --git a/.github/workflows/rootski-ci.yml b/.github/workflows/rootski-ci.yml index 6724e964..d40d0e82 100644 --- a/.github/workflows/rootski-ci.yml +++ b/.github/workflows/rootski-ci.yml @@ -73,7 +73,7 @@ jobs: with: context: . builder: ${{ steps.buildx.outputs.name }} - file: ./rootski_api/tests/resources/Dockerfile + file: ./rootski_api/tests/ci/Dockerfile push: false tags: api_build cache-from: type=local,src=/tmp/.buildx-cache diff --git a/rootski_api/tests/ci/Dockerfile b/rootski_api/tests/ci/Dockerfile new file mode 100644 index 00000000..28c819ec --- /dev/null +++ b/rootski_api/tests/ci/Dockerfile @@ -0,0 +1,8 @@ +# The context for this file needs to be path/to/rootski_api +FROM python:3.9.6-slim-buster + +RUN apt-get update && apt-get -y install git make +# RUN apt-get -y install git +WORKDIR /usr/src/rootski_api +COPY . . +RUN make install \ No newline at end of file diff --git a/rootski_api/tests/ci/docker-compose.yml b/rootski_api/tests/ci/docker-compose.yml new file mode 100644 index 00000000..1bd4b6c6 --- /dev/null +++ b/rootski_api/tests/ci/docker-compose.yml @@ -0,0 +1,33 @@ +version: "3.9" + +services: + + rootski: + command: py.test tests/functional_tests/main/endpoints -xv +# command: tail -f /dev/null + image: rootski-api + build: + context: ../.. # rootski_api/ + dockerfile: ./tests/ci/Dockerfile + env_file: + - test.env + volumes: + - ../..:/usr/src/rootski_api + depends_on: + postgres: + condition: service_healthy + + # (1) this database intentionally has no volumes; the database for tests should be fresh + # (2) we run it on port 8432 to avoid accidentally wiping databases running on 5432 + postgres: + image: postgres:9.6 + command: "-p 8432" + env_file: + - test.env + ports: + - "8432:8432" + healthcheck: + test: [ "CMD-SHELL", "pg_isready --username test-user --dbname test_db --port 8432" ] + interval: 1s + timeout: 1s + retries: 6