From 2a96b864fcf275407c5e58993adde43440698298 Mon Sep 17 00:00:00 2001 From: Ronan FAUGLAS Date: Tue, 19 Dec 2023 17:48:15 +0100 Subject: [PATCH 1/2] pla-546 --- .github/workflows/ci.yml | 59 ++++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c62b951..353d77c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,17 +5,48 @@ on: jobs: build: - runs-on: [self-hosted, terraform-python] - steps: - - name: Clean Workspace - uses: mickem/clean-after-action@v1 - - name: Checkout - uses: actions/checkout@v3 - - name: Install source - run: pip3 install -e .[dev] - - name: Black - run: python3 -m black --check --diff magicparse/ tests/ setup.py - - name: flake8 - run: python3 -m flake8 - - name: Pytest - run: python3 -m pytest + uses: ZeroGachis/.github/.github/workflows/build-image.yml@v2 + with: + image_name: magicparse + dockerfile_context: . + regitry_url: ghcr.io + vault_url: ${{ vars.PULLREQUEST_VAULT_URL }} + vault_github_actions_role: ${{ vars.VAULT_GITHUB_ACTIONS_ROLE }} + secrets: inherit + + static-metrics: + needs: + [ + build, + ] + uses: ZeroGachis/.github/.github/workflows/run-docker.yml@v2 + with: + image_url: ${{ needs.build.outputs.image-url }} + workdir: /home/src/magicparse + vault_url: ${{ vars.PULLREQUEST_VAULT_URL }} + vault_github_actions_role: ${{ vars.VAULT_GITHUB_ACTIONS_ROLE }} + run_command: | + black magicparse/ --check --diff + flake8 + secrets: inherit + + unit-tests: + needs: + [ + build, + ] + uses: ZeroGachis/.github/.github/workflows/run-docker-with-db.yml@v2 + with: + image_url: ${{ needs.build.outputs.image-url }} + workdir: /home/src/magicparse + vault_url: ${{ vars.PULLREQUEST_VAULT_URL }} + vault_github_actions_role: ${{ vars.VAULT_GITHUB_ACTIONS_ROLE }} + run_command: | + pytest --verbose --junit-xml reports/unit_tests_results.xml + enable_test_report: true + test_report_name: "UT Report" + test_report_path: reports/unit_tests_results.xml + test_report_format: java-junit + secrets: inherit + + From ae191f4e924763c7d917792100c2857b0ec8b23d Mon Sep 17 00:00:00 2001 From: Ronan Fauglas Date: Wed, 20 Dec 2023 09:05:11 +0100 Subject: [PATCH 2/2] fix Dockerfile for image build in CI --- Dockerfile | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3a0f366..bf8895a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,21 +2,12 @@ FROM python:3.10-slim-bullseye RUN apt update && apt install -y git -ARG USERNAME -ARG USER_UID=1000 -ARG USER_GID=$USER_UID -RUN \ - groupadd --gid $USER_GID $USERNAME \ - && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME +RUN pip install pytest WORKDIR /home/src/magicparse -RUN pip install pytest - COPY . ./ RUN pip install -e .[dev] -USER $USERNAME - CMD ["bash"]