Skip to content
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
30 changes: 15 additions & 15 deletions .github/workflows/check_n_push_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ on:

jobs:
check-code:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.10'
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
pip install pre-commit==4.3.0
make pre-commit

docker-build-test-autotest:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

Expand All @@ -56,13 +56,13 @@ jobs:
- 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]+")"
echo "::set-output name=version::$(grep -Po '^version\s*=\s*"\K[\d.]+' pyproject.toml)"

- 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-ubuntu22.04:${{ steps.get_version.outputs.version }}
docker image save --output /tmp/codeplag-ubuntu22.04.tar ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu22.04:${{ steps.get_version.outputs.version }}
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
Expand All @@ -86,13 +86,13 @@ jobs:
if: ${{ startsWith(github.event.ref, 'refs/tags/v') }}
uses: actions/upload-artifact@v4
with:
name: codeplag-ubuntu22.04
path: /tmp/codeplag-ubuntu22.04.tar
name: codeplag-ubuntu24.04
path: /tmp/codeplag-ubuntu24.04.tar
retention-days: 1
if-no-files-found: error

push-image:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: [check-code, docker-build-test-autotest]
if: startsWith(github.event.ref, 'refs/tags/v')

Expand All @@ -103,7 +103,7 @@ jobs:
- name: Download created in the previous stage image
uses: actions/download-artifact@v4
with:
name: codeplag-ubuntu22.04
name: codeplag-ubuntu24.04
path: /tmp

- name: Get current util version
Expand All @@ -113,8 +113,8 @@ jobs:

- name: Load Docker created image
run: |
docker load --input /tmp/codeplag-ubuntu22.04.tar
docker image tag ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu22.04:${{ steps.get_version.outputs.version }} ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu22.04:latest
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
Expand All @@ -123,4 +123,4 @@ jobs:
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Push docker image
run: docker image push --all-tags ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu22.04
run: docker image push --all-tags ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu24.04
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
default_language_version:
python: python3.10
python: python3.12
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.2
rev: v0.14.3
hooks:
- id: ruff
args: [ --fix ]
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ First of all thank you for your desire to contribute in that project.

## Development environment

Before starting work with this project you need to install [Python 3.10](https://www.python.org/), [Docker](https://www.docker.com/) (for commands like 'make docker-test').
Before starting work with this project you need to install [Python 3.12](https://www.python.org/), [Docker](https://www.docker.com/) (for commands like 'make docker-test').

After that you'll need to install and setup pre-commit hooks for checking style of source code, formatting it and checking types:

Expand Down
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
UTIL_VERSION := 0.5.30
UTIL_NAME := codeplag
PWD := $(shell pwd)
UTIL_VERSION := $(shell grep -Po '^version\s*=\s*"\K[\d.]+' pyproject.toml)
UTIL_NAME := $(shell grep -Po '^name\s*=\s*"\K\w+' pyproject.toml)

USER_UID ?= $(shell id --user)
USER_GID ?= $(shell id --group)

BASE_DOCKER_VERSION := 1.3
DIST := ubuntu22.04
BASE_DOCKER_TAG := $(shell echo $(UTIL_NAME)-base-${DIST}:$(BASE_DOCKER_VERSION))
TEST_DOCKER_TAG := $(shell echo $(UTIL_NAME)-test-${DIST}:$(UTIL_VERSION))
DOCKER_TAG ?= $(shell echo $(UTIL_NAME)-${DIST}:$(UTIL_VERSION))
BASE_DOCKER_VERSION := 1.0
DIST := ubuntu24.04
BASE_DOCKER_TAG := "$(UTIL_NAME)-base-${DIST}:$(BASE_DOCKER_VERSION)"
TEST_DOCKER_TAG := "$(UTIL_NAME)-test-${DIST}:$(UTIL_VERSION)"
DOCKER_TAG ?= "$(UTIL_NAME)-${DIST}:$(UTIL_VERSION)"

PYTHONDONTWRITEBYTECODE := "1"
PYTHONPATH := $(PWD)/src/:$(PWD)/test/auto
Expand Down Expand Up @@ -85,7 +84,9 @@ install: substitute-sources man translate-compile

@echo "Cleaning unnecessary files after Cython compilation in $(PY_INSTALL_PATH)"
find "$(DESTDIR)/$(PY_INSTALL_PATH)/$(UTIL_NAME)/" -type f -name '*.py' -exec rm --force '{}' +
find "$(DESTDIR)/$(PY_INSTALL_PATH)/$(UTIL_NAME)/" -type f -name '*.c' -exec rm --force '{}' +
find "$(DESTDIR)/$(PY_INSTALL_PATH)/$(UTIL_NAME)" -type d -iname "__pycache__" -exec rm --recursive --force '{}' +
find "$(DESTDIR)/$(PY_INSTALL_PATH)/webparsers" -type d -iname "__pycache__" -exec rm --recursive --force '{}' +

@echo "Cleaning unnecessary temporary Python files after installation in $(PY_INSTALL_PATH)"
find "$(DESTDIR)/$(PY_INSTALL_PATH)/$(UTIL_NAME)/" -type f -name '*.tmp.py' -exec rm --force '{}' +
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ Program for finding plagiarism in the source code written in Python 3, C, and C+
### 1.3 Install with package manager apt-get

- Requirements:
- OS Ubuntu Linux == 22.04
- Python version == 3.10
- OS Ubuntu Linux == 24.04
- Python version == 3.12

- For this purpose, you need to get installing package from releases [tab](https://github.com/OSLL/code-plagiarism/releases) with extension .deb;
- The next step is run commands on the target system:
Expand Down Expand Up @@ -81,8 +81,8 @@ If you want to use MongoDB cache for saving reports and works metadata, complete
# Before local checking, you need to install dependencies into your virtual environment.
$ python3 -m pip install --requirement docs/notebooks/requirements.txt
$ python3 -m pip install $(python3 -m setup.py --build-requirements)
$ python3 -m pip install $(python3 -m setup.py --lint-requirements)
$ python3 -m pip install $(python3 -m setup.py --install-requirements)
$ python3 -m pip install pre-commit==4.3.0
$ make pre-commit
```

Expand Down
4 changes: 2 additions & 2 deletions debian/control.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Build-Depends: debhelper (>= 10)

Package: @UTIL_NAME@-util
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, python3 (>= 3.10), python3-pip (>= 19.0),
clang, libncurses5, man
Depends: ${shlibs:Depends}, ${misc:Depends}, python3 (>= 3.12), python3-pip (>= 19.0),
clang, libncurses6, man
Description: Program for finding plagiarism in the source code written on Python3, C, C++ based on compare AST metadata.
2 changes: 1 addition & 1 deletion debian/preinst.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

echo "Pre installation ($@) ..."

pip3 install @PYTHON_REQUIRED_LIBS@
pip3 install --break-system-packages @PYTHON_REQUIRED_LIBS@
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:22.04
FROM ubuntu:24.04

ARG PYTHON_REQUIRED_LIBS
ARG UTIL_NAME
Expand All @@ -9,13 +9,18 @@ RUN if [ "$(dpkg-divert --truename /usr/bin/man)" = "/usr/bin/man.REAL" ]; then
dpkg-divert --quiet --remove --rename /usr/bin/man; \
fi
RUN apt-get update
RUN apt-get install -y python3-pip
RUN pip3 install --upgrade setuptools
RUN apt-get install -y clang libncurses5
RUN apt-get install -y man
RUN apt-get install -y vim nano less
RUN apt-get install -y --no-install-recommends \
python3-pip \
clang \
libncurses6 \
vim \
nano \
less
RUN apt-get clean

RUN pip3 install $PYTHON_REQUIRED_LIBS
RUN pip3 install --break-system-packages $PYTHON_REQUIRED_LIBS

RUN rm --recursive --force /tmp/* /var/tmp/*

VOLUME /usr/src/works
WORKDIR /usr/src/$UTIL_NAME
6 changes: 3 additions & 3 deletions docker/docker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ docker-base-image: substitute-sources substitute-docker
--tag "$(BASE_DOCKER_TAG)" \
--build-arg PYTHON_REQUIRED_LIBS="$(PYTHON_REQUIRED_LIBS)" \
--build-arg UTIL_NAME="$(UTIL_NAME)" \
--file docker/base_ubuntu2204.dockerfile \
--file docker/base_ubuntu2404.dockerfile \
. \
)

Expand All @@ -42,7 +42,7 @@ docker-test-image: docker-base-image
--build-arg PYTHON_BUILD_LIBS="$(PYTHON_BUILD_LIBS)" \
--build-arg LOGS_PATH="$(LOGS_PATH)" \
--build-arg UTIL_NAME="$(UTIL_NAME)" \
--file docker/test_ubuntu2204.dockerfile \
--file docker/test_ubuntu2404.dockerfile \
.

.PHONY: docker-test-mongo-run
Expand Down Expand Up @@ -109,7 +109,7 @@ docker-image: docker-base-image docker-test-image
--build-arg UTIL_NAME="$(UTIL_NAME)" \
--build-arg DEBIAN_PACKAGES_PATH="$(DEBIAN_PACKAGES_PATH)" \
--build-arg DEB_PKG_NAME="$(DEB_PKG_NAME)" \
--file docker/ubuntu2204.dockerfile \
--file docker/ubuntu2404.dockerfile \
. \
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ ARG UTIL_NAME
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update
RUN apt-get install -y debhelper
RUN pip3 install $PYTHON_TEST_LIBS $PYTHON_BUILD_LIBS
RUN apt-get install -y --no-install-recommends debhelper python3-dev build-essential
RUN pip3 install --break-system-packages $PYTHON_TEST_LIBS $PYTHON_BUILD_LIBS
RUN mkdir -p $LOGS_PATH

# TODO: Move to middle docker file or make another solution
Expand All @@ -24,4 +24,7 @@ ADD locales/ /usr/src/$UTIL_NAME/locales
ADD docker/docker.mk /usr/src/$UTIL_NAME/docker/docker.mk
ADD debian/ /usr/src/$UTIL_NAME/debian

RUN apt-get clean
RUN rm --recursive --force /tmp/* /var/tmp/*

CMD make test
3 changes: 3 additions & 0 deletions docker/ubuntu2204.dockerfile → docker/ubuntu2404.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ RUN apt-get install -y /usr/src/$UTIL_NAME/$DEBIAN_PACKAGES_PATH/$DEB_PKG_NAME.d
RUN install -D -m 0644 $DEBIAN_PACKAGES_PATH/$UTIL_NAME.1 /usr/share/man/man1/
RUN rm --recursive /usr/src/$UTIL_NAME/debian

RUN apt-get clean
RUN rm --recursive --force /tmp/* /var/tmp/*

RUN register-python-argcomplete $UTIL_NAME >> ~/.bashrc

CMD ["/bin/bash"]
Loading
Loading