Skip to content

Commit

Permalink
Add unit tests to CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
vlaszdunov committed Jun 5, 2024
1 parent dfbe49a commit e4707b4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 48 deletions.
53 changes: 6 additions & 47 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: build checker
run-name: Build and Python images

on:
pull_request:
push:
branches-ignore: main
env:
Expand All @@ -22,52 +23,10 @@ jobs:
python-version: 3.12

- name: install dependencies
run: pip install -r requirements.txt
run: pip install -r requirements/requirements.txt

- name: Create Dockerfiles of Python Images
run: python ./src/parse.py
- name: install dev dependencies
run: pip install -r requirements/requirements-dev.txt

- uses: danyow/json-matrix-builder@v0.5.0
id: array
with:
cmd: ls Python_dockerfiles
separator: newline
- name: "Upload Artifact"
uses: actions/upload-artifact@v4
with:
name: Generated_Dockerfiles
path: Python_dockerfiles/
retention-days: 1
outputs:
param: ${{ steps.array.outputs.build }}

matrix_input:
permissions:
contents: read
packages: write
id-token: write
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
param: ${{ fromJson(needs.setup.outputs.param) }}

steps:

- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: Generated_Dockerfiles

- name: building images
run: |
tags=$(cat ${{matrix.param}}/tags.txt)
IFS=$'\n'
for tag in $tags; do
docker build -q --file ${{matrix.param}}/Dockerfile --tag ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:$tag .
done
- name: delete artifacts
uses: geekyeggo/delete-artifact@v1
with:
name: Generated_Dockerfiles
- name: Run tests
run: python -m pytest
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ __pycache__
.env

# ide-staff
.vscode
.vscode

# Unit test
.pytest_cache
5 changes: 5 additions & 0 deletions requirements/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
colorama==0.4.6
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
pytest==8.2.2
File renamed without changes.

0 comments on commit e4707b4

Please sign in to comment.