build: it seems to be working #39
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- "*" | |
tags: | |
- "*" | |
pull_request: | |
branches: | |
- "*" | |
env: | |
IMAGE_DOCKER: ghcr.io/${{ secrets.NAME_LOGIN }}/flexible_inspect:latest | |
MODE_PYTHON_VERSION: dist | |
jobs: | |
# job для сборки образа (в нем будет происходит сборка и тестирование библиотеки) | |
build-image: | |
# needs: clone | |
runs-on: ubuntu-latest | |
steps: | |
# Шаг для входа в Docker Registry | |
- name: Log in to GitHub Docker Registry | |
run: echo ${{ secrets.PAT_GITHUB }} | docker login ghcr.io -u ${{ secrets.NAME_LOGIN }} --password-stdin | |
# Шаг для клонирования репозитория | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Шаг для сборки и пуша образа | |
- name: Build Image (dependencies) | |
run: | | |
docker pull ${{ env.IMAGE_DOCKER }} && \ | |
docker buildx build --push -t ${{ env.IMAGE_DOCKER }} \ | |
--cache-from type=inline,ref=${{ env.IMAGE_DOCKER }} . \ | |
--cache-from type=registry,ref=${{ env.IMAGE_DOCKER }} \ | |
--cache-to type=inline,mode=min | |
# Job для проверки кода линтером | |
linter-check: | |
needs: build-image | |
runs-on: ubuntu-latest | |
steps: | |
# Шаг для клонирования репозитория | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Шаг для запуска линтера | |
- name: Linter check (clippy) | |
run: cargo clippy -- -D warnings | |
# Job для тестирования кода | |
coverage-test: | |
needs: linter-check | |
runs-on: ubuntu-latest | |
steps: | |
# Шаг для входа в Docker Registry | |
- name: Log in to GitHub Docker Registry | |
run: echo ${{ secrets.PAT_GITHUB }} | docker login ghcr.io -u ${{ secrets.NAME_LOGIN }} --password-stdin | |
# Шаг для клонирования репозитория | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Шаг для запуска контейнера с тестами | |
- name: Coverage test (tarpaulin) | |
run: | | |
docker pull ${{ env.IMAGE_DOCKER }} && \ | |
FLEX_VALIDATOR_LOG=TRACE docker run --security-opt seccomp=unconfined ${{ env.IMAGE_DOCKER }} \ | |
cargo tarpaulin \ | |
--workspace \ | |
--exclude-files /main_project/flexible_inspect_js/* \ | |
--features export_to_other_languages,serde \ | |
--engine llvm --out xml --output-dir ./coverage/ | |
# Шаг для копирования отчета о покрытии из контейнера | |
- name: Copy coverage report from container | |
run: | | |
docker cp $(docker ps -lq):/main_project/coverage/cobertura.xml . | |
# Шаг для загрузки отчета о покрытии в Codecov | |
- name: Upload coverage report | |
uses: actions/upload-artifact@v2 | |
with: | |
name: cobertura-report | |
path: cobertura.xml | |
# Шаг для отправки отчета о покрытии в Codecov | |
- name: Send coverage report to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: cobertura.xml |