Skip to content

Commit

Permalink
Remove Python 2 builds
Browse files Browse the repository at this point in the history
Co-authored-by: Jesús García Crespo <[email protected]>
  • Loading branch information
replaceafill and sevein committed Oct 22, 2021
1 parent 75080d6 commit bf63515
Show file tree
Hide file tree
Showing 15 changed files with 542 additions and 518 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/acceptance-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
test:
if: github.event.label.name == 'AMAUAT'
name: "Test ${{ matrix.tag }} ${{ matrix.python_version }} on ${{ matrix.browser }}"
name: "Test ${{ matrix.tag }} on ${{ matrix.browser }}"
runs-on: "ubuntu-18.04"
strategy:
matrix:
Expand All @@ -24,9 +24,6 @@ jobs:
browser:
- "Firefox"
- "Chrome"
python_version:
- "python2"
- "python3"
exclude:
- tag: "black-box"
browser: Firefox
Expand All @@ -49,14 +46,11 @@ jobs:
- name: "Build images"
run: |
make -C hack/ build
env:
PYTHON_VERSION: ${{ matrix.python_version }}
- name: "Start services"
run: |
docker-compose up -d
env:
cluster.routing.allocation.disk.threshold_enabled: false
PYTHON_VERSION: ${{ matrix.python_version }}
working-directory: ./hack
- name: "Bootstrap services"
run: |
Expand Down
18 changes: 0 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,21 @@ jobs:
matrix:
include:
- rule: mcp-server
coverage: true
python_version: py27
- rule: mcp-server-py36
coverage: true
python_version: py36
- rule: mcp-client
coverage: true
python_version: py27
- rule: mcp-client-py36
coverage: true
python_version: py36
- rule: dashboard
coverage: true
python_version: py27
- rule: dashboard-py36
coverage: true
python_version: py36
- rule: archivematica-common
coverage: true
python_version: py27
- rule: archivematica-common-py36
coverage: true
python_version: py36
- rule: storage-service
coverage: false
python_version: py27
- rule: storage-service-py36
coverage: false
python_version: py36
- rule: migrations
coverage: false
python_version: py27
- rule: migrations-py36
coverage: false
python_version: py36
steps:
Expand Down
10 changes: 0 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,11 @@ pip-compile: # Compile pip requirements
pip-compile --allow-unsafe --output-file requirements.txt requirements.in
pip-compile --allow-unsafe --output-file requirements-dev.txt requirements-dev.in

.PHONY: pip-compile-py3
pip-compile-py3: # Compile pip requirements (Python 3)
pip-compile --allow-unsafe --output-file requirements-py3.txt requirements.in
pip-compile --allow-unsafe --output-file requirements-dev-py3.txt requirements-dev-py3.in

.PHONY: pip-upgrade
pip-upgrade: # Upgrade pip requirements
pip-compile --allow-unsafe --upgrade --output-file requirements.txt requirements.in
pip-compile --allow-unsafe --upgrade --output-file requirements-dev.txt requirements-dev.in

.PHONY: pip-upgrade-py3
pip-upgrade-py3: # Upgrade pip requirements
pip-compile --allow-unsafe --upgrade --output-file requirements-py3.txt requirements.in
pip-compile --allow-unsafe --upgrade --output-file requirements-dev-py3.txt requirements-dev-py3.in

.PHONY: pip-sync
pip-sync: # Sync virtualenv
pip-sync requirements.txt
Expand Down
65 changes: 8 additions & 57 deletions hack/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ARG TARGET=archivematica-mcp-server
ARG PYTHON_VERSION=python3

FROM ubuntu:18.04 AS base

Expand Down Expand Up @@ -37,15 +36,17 @@ RUN set -ex \
&& add-apt-repository --no-update --yes "deb http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse" \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential libyaml-dev clamav \
build-essential python3-dev libyaml-dev clamav \
&& /src/hack/osdeps.py Ubuntu-18 1 | grep -v -E "nginx|postfix" | xargs apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

# Download ClamAV virus signatures
RUN freshclam --quiet

# Install Node.js and Yarn
# Install pip, Node.js and Yarn
RUN set -ex \
&& curl -s https://bootstrap.pypa.io/get-pip.py | python3.6 \
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 10 \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& add-apt-repository --yes "deb https://dl.yarnpkg.com/debian/ stable main" \
&& apt-get install -y --no-install-recommends \
Expand All @@ -60,46 +61,14 @@ RUN set -ex \
&& mkdir -p /var/archivematica/sharedDirectory \
&& chown -R archivematica:archivematica /var/archivematica

# -----------------------------------------------------------------------------

FROM base AS python2

RUN set -ex \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
python-dev \
&& rm -rf /var/lib/apt/lists/*

RUN set -ex \
&& curl -s https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2.7

COPY requirements-dev.txt /src/requirements-dev.txt
RUN pip2 install -r /src/requirements-dev.txt
RUN pip3 install -r /src/requirements-dev.txt

COPY . /src

# -----------------------------------------------------------------------------

FROM base AS python3

RUN set -ex \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
python3-dev \
&& rm -rf /var/lib/apt/lists/*

RUN set -ex \
&& curl -s https://bootstrap.pypa.io/get-pip.py | python3.6 \
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 10

COPY requirements-dev-py3.txt /src/requirements-dev-py3.txt
RUN pip3 install -r /src/requirements-dev-py3.txt

COPY . /src

# -----------------------------------------------------------------------------

FROM ${PYTHON_VERSION} AS archivematica-mcp-client
FROM base AS archivematica-mcp-client

# Some scripts in archivematica-fpr-admin executed by MCPClient rely on certain
# files being available in this image (e.g. see https://git.io/vA1wF).
Expand All @@ -118,7 +87,7 @@ ENTRYPOINT ["/src/src/MCPClient/lib/archivematicaClient.py"]

# -----------------------------------------------------------------------------

FROM ${PYTHON_VERSION} AS archivematica-mcp-server
FROM base AS archivematica-mcp-server

USER archivematica

Expand All @@ -129,7 +98,7 @@ ENTRYPOINT ["/src/src/MCPServer/lib/archivematicaMCP.py"]

# -----------------------------------------------------------------------------

FROM ${PYTHON_VERSION} AS archivematica-dashboard
FROM base AS archivematica-dashboard

RUN set -ex \
&& internalDirs=' \
Expand Down Expand Up @@ -197,24 +166,6 @@ ENTRYPOINT ["yarn", "run", "test-single-run"]

FROM base AS archivematica-tests

RUN set -ex \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
python-dev python3-dev \
&& rm -rf /var/lib/apt/lists/*

RUN set -ex \
&& curl -s https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2.7 \
&& curl -s https://bootstrap.pypa.io/get-pip.py | python3.6

COPY requirements-dev.txt /src/requirements-dev.txt
RUN pip2 install -r /src/requirements-dev.txt

COPY requirements-dev-py3.txt /src/requirements-dev-py3.txt
RUN pip3 install -r /src/requirements-dev-py3.txt

COPY . /src

# -----------------------------------------------------------------------------

FROM ${TARGET}
32 changes: 6 additions & 26 deletions hack/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -223,55 +223,35 @@ test-build: ## Build archivematica-tests image.
--build-arg TARGET=archivematica-tests \
../

__TOXENVS_MCPSERVER := py27-mcpserver
__TOXENVS_MCPSERVER := py36-mcpserver
test-mcp-server: start-mysql ## Run MCPServer tests.
$(call run_toxenvs,$(__TOXENVS_MCPSERVER))

test-mcp-server-py36: start-mysql ## Run MCPServer tests in Python 3.6.
$(call run_toxenvs,py36-mcpserver)

__TOXENVS_MCPCLIENT = py27-mcpclient py27-mcpclient-ensure-no-mutable-globals
__TOXENVS_MCPCLIENT = py36-mcpclient py36-mcpclient-ensure-no-mutable-globals
test-mcp-client: start-mysql ## Run MCPClient tests.
$(call run_toxenvs,$(__TOXENVS_MCPCLIENT))

test-mcp-client-py36: start-mysql ## Run MCPClient tests in Python 3.6.
$(call run_toxenvs,py36-mcpclient py36-mcpclient-ensure-no-mutable-globals)

__TOXENVS_DASHBOARD = py27-dashboard
__TOXENVS_DASHBOARD = py36-dashboard
test-dashboard: start-mysql ## Run Dashboard tests.
$(call run_toxenvs,$(__TOXENVS_DASHBOARD))

test-dashboard-py36: start-mysql ## Run Dashboard tests in Python 3.6.
$(call run_toxenvs,py36-dashboard)

__TOXENVS_STORAGE_SERVICE = py27-storage-service
__TOXENVS_STORAGE_SERVICE = py36-storage-service
test-storage-service: start-mysql ## Run Storage Service tests.
$(call run_toxenvs,$(__TOXENVS_STORAGE_SERVICE))

test-storage-service-py36: start-mysql ## Run Storage Service tests in Python 3.6.
$(call run_toxenvs,py36-storage-service)

test-storage-service-integration: ## Run Storage Service unit and integration tests using MySQL and MinIO.
$(CURDIR)/submodules/archivematica-storage-service/integration/run.sh

__TOXENVS_ARCHIVEMATICA_COMMON = py27-archivematica-common
__TOXENVS_ARCHIVEMATICA_COMMON = py36-archivematica-common
test-archivematica-common: start-mysql ## Run Archivematica Common tests.
$(call run_toxenvs,$(__TOXENVS_ARCHIVEMATICA_COMMON))

test-archivematica-common-py36: start-mysql ## Run Archivematica Common tests in Python 3.6.
$(call run_toxenvs,py36-archivematica-common)

__TOXENVS_MIGRATIONS = py27-migrations-dashboard migrations-storage-service
__TOXENVS_MIGRATIONS = py36-migrations-dashboard migrations-storage-service
test-migrations: start-mysql ## Check there are no pending migrations.
$(call create_db,DASHBOARDTEST)
$(call create_db,SSTEST)
$(call run_toxenvs,$(__TOXENVS_MIGRATIONS))

test-migrations-py36: start-mysql ## Check there are no pending migrations in Python 3.6.
$(call create_db,DASHBOARDTEST)
$(call create_db,SSTEST)
$(call run_toxenvs,py36-migrations-dashboard)

__TOXENVS_LINTING = linting
test-linting: ## Check linting.
$(call run_toxenvs,$(__TOXENVS_LINTING))
Expand Down
1 change: 0 additions & 1 deletion hack/docker-compose.tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ services:
dockerfile: "hack/Dockerfile"
args:
TARGET: "archivematica-tests"
PYTHON_VERSION: ${PYTHON_VERSION:-python3}
volumes:
- "../:/src"
links:
Expand Down
4 changes: 0 additions & 4 deletions hack/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ services:
dockerfile: "hack/Dockerfile"
args:
TARGET: "archivematica-mcp-server"
PYTHON_VERSION: ${PYTHON_VERSION:-python3}
environment:
DJANGO_SECRET_KEY: "12345"
DJANGO_SETTINGS_MODULE: "settings.common"
Expand All @@ -122,7 +121,6 @@ services:
dockerfile: "hack/Dockerfile"
args:
TARGET: "archivematica-mcp-client"
PYTHON_VERSION: ${PYTHON_VERSION:-python3}
environment:
DJANGO_SECRET_KEY: "12345"
DJANGO_SETTINGS_MODULE: "settings.common"
Expand Down Expand Up @@ -160,7 +158,6 @@ services:
dockerfile: "hack/Dockerfile"
args:
TARGET: "archivematica-dashboard"
PYTHON_VERSION: ${PYTHON_VERSION:-python3}
environment:
FORWARDED_ALLOW_IPS: "*"
AM_GUNICORN_ACCESSLOG: "/dev/null"
Expand Down Expand Up @@ -189,7 +186,6 @@ services:
context: "submodules/archivematica-storage-service"
args:
TARGET: "archivematica-storage-service"
PYTHON_VERSION: ${PYTHON_VERSION:-python3}
environment:
FORWARDED_ALLOW_IPS: "*"
SS_GUNICORN_ACCESSLOG: "/dev/null"
Expand Down
13 changes: 0 additions & 13 deletions requirements-dev-py3.in

This file was deleted.

Loading

0 comments on commit bf63515

Please sign in to comment.