Skip to content

Commit

Permalink
Merge pull request #18 from ZeroGachis/pla-546
Browse files Browse the repository at this point in the history
pla-546: Align CI on Django Magic ci principles
  • Loading branch information
rfauglas authored Dec 20, 2023
2 parents 36c85eb + ae191f4 commit 1d7ab3e
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 24 deletions.
59 changes: 45 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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


11 changes: 1 addition & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

0 comments on commit 1d7ab3e

Please sign in to comment.