Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pla-546: Align CI on Django Magic ci principles #18

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]