Skip to content

Added parallelization of the work comparison process #185

Added parallelization of the work comparison process

Added parallelization of the work comparison process #185

name: Check source code and push created image based on sources
on:
push:
branches:
- main
tags:
- 'v*'
paths-ignore:
- 'docs/**'
- '**.md'
pull_request:
paths-ignore:
- 'docs/**'
- '**.md'
workflow_dispatch:
jobs:
check-code:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Lint with ruff and pyright
run: |
make substitute-sources
pip install $(python3 setup.py --install-requirements)
pip install $(python3 setup.py --build-requirements)
pip install --requirement docs/notebooks/requirements.txt
pip install pre-commit==3.4.0
make pre-commit
docker-build-test-autotest:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Provide environment variable for autotests
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: |
echo "ACCESS_TOKEN=${ACCESS_TOKEN}" > .env
- name: Provides release environment variable if created new tag.
if: ${{ startsWith(github.event.ref, 'refs/tags/v') }}
run: |
echo "IS_DEVELOPED=0" >> .env
- name: Get current util version
id: get_version
run: |
echo "::set-output name=version::$(grep --max-count 1 UTIL_VERSION Makefile | grep -Eo "[0-9]+[.][0-9]+[.][0-9]+")"
- name: Create main docker image, run tests and save image for the next job
run: |
export $(cat .env | xargs)
make docker-image DOCKER_TAG=${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu20.04:${{ steps.get_version.outputs.version }}
docker image save --output /tmp/codeplag-ubuntu20.04.tar ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu20.04:${{ steps.get_version.outputs.version }}
- name: Run autotests
run: |
make docker-autotest
- name: Save created deb package
uses: actions/upload-artifact@v3
with:
name: deb-package
path: debian/deb/
retention-days: 3
if-no-files-found: error
- name: Upload created image
if: ${{ startsWith(github.event.ref, 'refs/tags/v') }}
uses: actions/upload-artifact@v3
with:
name: codeplag-ubuntu20.04
path: /tmp/codeplag-ubuntu20.04.tar
retention-days: 1
if-no-files-found: error
push-image:
runs-on: ubuntu-20.04
needs: [check-code, docker-build-test-autotest]
if: startsWith(github.event.ref, 'refs/tags/v')
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download created in the previous stage image
uses: actions/download-artifact@v3
with:
name: codeplag-ubuntu20.04
path: /tmp
- name: Get current util version
id: get_version
run: |
echo "::set-output name=version::$(grep --max-count 1 UTIL_VERSION Makefile | grep -Eo "[0-9]+[.][0-9]+[.][0-9]+")"
- name: Load Docker created image
run: |
docker load --input /tmp/codeplag-ubuntu20.04.tar
docker image tag ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu20.04:${{ steps.get_version.outputs.version }} ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu20.04:latest
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Push docker image
run: docker image push --all-tags ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu20.04