build: upgrades used base docker image to Ubuntu 24.04. #332
Workflow file for this run
This file contains hidden or 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: 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-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - 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 $(python3 setup.py --lint-requirements) | |
| pip install --requirement docs/notebooks/requirements.txt | |
| make pre-commit | |
| docker-build-test-autotest: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - 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-ubuntu24.04:${{ steps.get_version.outputs.version }} | |
| docker image save --output /tmp/codeplag-ubuntu24.04.tar ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu24.04:${{ steps.get_version.outputs.version }} | |
| - name: Pytest coverage comment | |
| uses: MishaKav/pytest-coverage-comment@v1 | |
| with: | |
| pytest-xml-coverage-path: ./test/unit/pytest-coverage.xml | |
| - name: Run autotests | |
| run: | | |
| export $(cat .env | xargs) | |
| make docker-autotest | |
| - name: Save created deb package | |
| uses: actions/upload-artifact@v4 | |
| 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@v4 | |
| with: | |
| name: codeplag-ubuntu24.04 | |
| path: /tmp/codeplag-ubuntu24.04.tar | |
| retention-days: 1 | |
| if-no-files-found: error | |
| push-image: | |
| runs-on: ubuntu-24.04 | |
| needs: [check-code, docker-build-test-autotest] | |
| if: startsWith(github.event.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download created in the previous stage image | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: codeplag-ubuntu24.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-ubuntu24.04.tar | |
| docker image tag ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu24.04:${{ steps.get_version.outputs.version }} ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu24.04:latest | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| 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-ubuntu24.04 |