diff --git a/.github/workflows/buildx.yml b/.github/workflows/buildx.yml index 8d201ce..515ffc9 100644 --- a/.github/workflows/buildx.yml +++ b/.github/workflows/buildx.yml @@ -2,7 +2,7 @@ name: buildx on: workflow_run: - workflows: ["docker_tests"] + workflows: ["docker_main"] branches: [main] types: - completed diff --git a/.github/workflows/docker_main.yml b/.github/workflows/docker_main.yml new file mode 100644 index 0000000..754ff44 --- /dev/null +++ b/.github/workflows/docker_main.yml @@ -0,0 +1,27 @@ +name: docker_main + +on: + workflow_run: + workflows: ["tests"] + branches: [main] + types: + - completed + +# TODO: Needs refactoring to use reusable workflows and share w/ docker_tests +jobs: + on-success: + runs-on: ubuntu-latest + steps: + - name: checkout code + uses: actions/checkout@v2 + - name: build and test (docker) + run: | + docker build --tag whoogle-search:test . + docker run --publish 5000:5000 --detach --name whoogle-search whoogle-search:test + sleep 15 + docker exec whoogle-search curl -f http://localhost:5000/healthz || exit 1 + - name: build and test (docker-compose) + run: | + docker-compose up --detach + sleep 15 + docker exec whoogle-search curl -f http://localhost:5000/healthz || exit 1 diff --git a/.github/workflows/docker_tests.yml b/.github/workflows/docker_tests.yml index e3a3a2f..f0d7deb 100644 --- a/.github/workflows/docker_tests.yml +++ b/.github/workflows/docker_tests.yml @@ -1,21 +1,25 @@ name: docker_tests on: - workflow_run: - workflows: ["tests"] - branches: [main] - types: - - completed + push: + branches: main + pull_request: + branches: main jobs: - on-success: + docker: runs-on: ubuntu-latest steps: - name: checkout code uses: actions/checkout@v2 - - name: build and test + - name: build and test (docker) run: | docker build --tag whoogle-search:test . - docker run --publish 5000:5000 --detach --name whoogle-search whoogle-search:test + docker run --publish 5000:5000 --detach --name whoogle-search-nocompose whoogle-search:test + sleep 15 + docker exec whoogle-search-nocompose curl -f http://localhost:5000/healthz || exit 1 + - name: build and test (docker-compose) + run: | + docker-compose up --detach sleep 15 docker exec whoogle-search curl -f http://localhost:5000/healthz || exit 1