From 0aadf60051178223df29fa11c3499b3604c4315d Mon Sep 17 00:00:00 2001 From: Adrian Cederberg Date: Tue, 20 Aug 2024 12:34:42 -0600 Subject: [PATCH] feature(package): Added coverage report publishing. Will make only for `master` once functioning. Changed cache settings to hopefully make multistage build faster. --- .github/workflows/commit_checks.yaml | 34 ++++++++++++++++++++++++---- pyproject.toml | 1 + 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/.github/workflows/commit_checks.yaml b/.github/workflows/commit_checks.yaml index 77ea36a..d085c0e 100644 --- a/.github/workflows/commit_checks.yaml +++ b/.github/workflows/commit_checks.yaml @@ -132,11 +132,14 @@ jobs: context: . file: ./docker/dockerfile target: ci - tags: acederberg/captura-ci # should match tags in `./docker/compose.ci.yaml`. + # NOTE: ``bumpver`` will be looking for this. Futher, this should + # match tags in ``./docker/compose.ci.yaml`` which are updated + # by bumpver. + tags: acederberg/captura-ci:0.1.5 pull: false push: false - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=registry,ref=acederberg/captura-ci:buildcache + cache-to: type=registry,ref=acederberg/captura-ci:buildcache,mode=max - name: Setup. run: | @@ -153,7 +156,7 @@ jobs: docker compose \ --file docker/compose.ci.yaml \ --env-file .env \ - up --detach --build --quiet-pull + up --detach --quiet-pull # NOTE: ``act.yaml`` defined everything necessary for the client and server. - name: Generate Dummy Data In Server. @@ -194,15 +197,36 @@ jobs: continue-on-error: true - name: Create Coverage Report. + # if: github.ref == 'refs/heads/master' run: | docker compose \ --file docker/compose.ci.yaml \ exec server \ bash -c ' \ source ~/app/.venv/bin/activate \ - && poetry run coverage html' + && poetry run coverage html --directory ./coverage-report' continue-on-error: true + # --------------------------------------------------------------------- # + # NOTE: ``master`` only. + + - name: Copy Coverage Report To Host. + # if: github.ref == 'refs/heads/master' + run: | + docker compose \ + --file docker/compose.ci.yaml \ + cp server:/home/captura/app/coverage-report ./coverage-report + + - name: Put Coverage Report On GitHub Pages. + # if: github.ref == 'refs/heads/master' + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: $GITHUB_BRANCH + folder: coverage-report # The folder the action should deploy. + + + # --------------------------------------------------------------------- # + # NOTE: Finalize. - name: Stop Compose Project. if: always() run: docker compose --file docker/compose.ci.yaml down diff --git a/pyproject.toml b/pyproject.toml index 60ca522..30b4dac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -144,6 +144,7 @@ push = false "src/app/__init__.py" = ["{version}"] "docker/compose.yaml" = ["image: acederberg/captura-development:{version}"] "docker/compose.ci.yaml" = ["image: acederberg/captura-ci:{version}"] +".github/workflows/" = ["tags: acederberg/captura-ci:{version}"] [tool.setuptools_scm]