Skip to content

Commit

Permalink
Bump electionguard from 1.2.1 to 1.2.3 and fix build (#304)
Browse files Browse the repository at this point in the history
* prepare Dockerfile

* change dockerfile

* fix compilation for pyodide and libgmp

* Update docker-entrypoint.sh

Co-authored-by: Andrés Pereira de Lucena <[email protected]>

* Update Dockerfile.release

Co-authored-by: Andrés Pereira de Lucena <[email protected]>

* patch Pipfile.lock

* Update voting_schemes/electionguard/docker/pyodide-electionguard/packages/libgmp/Makefile

Co-authored-by: Andrés Pereira de Lucena <[email protected]>

* update wget in dockerfile

---------

Co-authored-by: Andrés Pereira de Lucena <[email protected]>
  • Loading branch information
microstudi and andreslucena authored Sep 21, 2023
1 parent e31dbe8 commit 6918074
Show file tree
Hide file tree
Showing 20 changed files with 424 additions and 358 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.1
LABEL author="[email protected]"
FROM decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.3
LABEL author="[email protected]"

# [Option] Install zsh
ARG INSTALL_ZSH="true"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/server-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
name: Build electionguard
runs-on: ubuntu-latest
container:
image: decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.1
image: decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.3
steps:
- uses: actions/[email protected]
with:
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
runs-on: ubuntu-latest
if: ${{ needs.check_python_to_js_cache.outputs.cache-hit != 'true' }}
container:
image: decidim/pyodide-electionguard:pyodide-0.16.1-electionguard-1.2.1
image: decidim/pyodide-electionguard:pyodide-0.16.1-electionguard-1.2.3
steps:
- uses: actions/[email protected]
with:
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
needs: build_python_to_js
runs-on: ubuntu-latest
container:
image: decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.1
image: decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.3
services:
postgres:
image: postgres:11
Expand Down Expand Up @@ -246,7 +246,7 @@ jobs:
needs: [check_python_to_js_cache, build_python_to_js]
runs-on: ubuntu-latest
container:
image: decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.1
image: decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.3
services:
postgres:
image: postgres:11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
name: Test code
runs-on: ubuntu-latest
container:
image: decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.1
image: decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.3
steps:
- uses: rokroskar/[email protected]
if: "github.ref != 'refs/heads/develop'"
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
15 changes: 4 additions & 11 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This stage builds the python-wrapper package
FROM decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.1 as python-wrapper-builder
FROM decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.3 as python-wrapper-builder
LABEL author="[email protected]"

# Add Makefiles
Expand All @@ -17,7 +17,7 @@ ADD voting_schemes/electionguard/python-wrapper /code/voting_schemes/electiongua
RUN cd /code && make build_electionguard_python_wrapper

# This stage builds the pyodide packages for the previous python packages
FROM decidim/pyodide-electionguard:pyodide-0.16.1-electionguard-1.2.1 as python-to-js-builder
FROM decidim/pyodide-electionguard:pyodide-0.16.1-electionguard-1.2.3 as python-to-js-builder
LABEL author="[email protected]"

ENV PYODIDE_PACKAGES "electionguard,bulletin_board-electionguard"
Expand All @@ -43,7 +43,7 @@ RUN make
RUN cp -rf /code/voting_schemes/electionguard/python-to-js/override/* /src/pyodide/build/

# This stage builds the bulletin-board application
FROM decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.1
FROM decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.3
LABEL author="[email protected]"

# Dummy environment variables used to compile assets
Expand Down Expand Up @@ -80,12 +80,6 @@ ADD bulletin_board/server/package.json /code/bulletin_board/server/package.json
ADD bulletin_board/server/Gemfile.lock /code/bulletin_board/server/Gemfile.lock
ADD bulletin_board/server/Gemfile /code/bulletin_board/server/Gemfile

# Prevent npm ERR! code ERR_SOCKET_TIMEOUT
RUN npm install --global npm@latest && \
npm config set fetch-timeout 1800000 -g && \
npm config set fetch-retry-mintimeout 600000 -g && \
npm config set fetch-retry-maxtimeout 1800000 -g

# Install all dependencies, build artifacts and remove unnecessary files
RUN cd /code && make install && make build SKIP_PYODIDE=true && \
rm -rf /code/bulletin_board/js-client && \
Expand All @@ -102,5 +96,4 @@ RUN npm install --global yarn
RUN bundle
RUN bundle exec rake assets:precompile

# Migrate and seed database
CMD ["bundle", "exec", "rake", "db:migrate"]
CMD ["bundle", "exec", "rails", "s", "-b", "0.0.0.0"]
13 changes: 4 additions & 9 deletions Dockerfile.web
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This stage builds the python-wrapper package
FROM decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.1 as python-wrapper-builder
FROM decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.3 as python-wrapper-builder
LABEL author="[email protected]"

# Add Makefiles
Expand All @@ -17,7 +17,7 @@ ADD voting_schemes/electionguard/python-wrapper /code/voting_schemes/electiongua
RUN cd /code && make build_electionguard_python_wrapper

# This stage builds the pyodide packages for the previous python packages
FROM decidim/pyodide-electionguard:pyodide-0.16.1-electionguard-1.2.1 as python-to-js-builder
FROM decidim/pyodide-electionguard:pyodide-0.16.1-electionguard-1.2.3 as python-to-js-builder
LABEL author="[email protected]"

ENV PYODIDE_PACKAGES "electionguard,bulletin_board-electionguard"
Expand All @@ -43,7 +43,7 @@ RUN make
RUN cp -rf /code/voting_schemes/electionguard/python-to-js/override/* /src/pyodide/build/

# This stage builds the bulletin-board application
FROM decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.1
FROM decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.3
LABEL author="[email protected]"

# Dummy environment variables used to compile assets
Expand Down Expand Up @@ -80,12 +80,6 @@ ADD bulletin_board/server/package.json /code/bulletin_board/server/package.json
ADD bulletin_board/server/Gemfile.lock /code/bulletin_board/server/Gemfile.lock
ADD bulletin_board/server/Gemfile /code/bulletin_board/server/Gemfile

# Prevent npm ERR! code ERR_SOCKET_TIMEOUT
RUN npm install --global npm@latest && \
npm config set fetch-timeout 1800000 -g && \
npm config set fetch-retry-mintimeout 600000 -g && \
npm config set fetch-retry-maxtimeout 1800000 -g

# Install all dependencies, build artifacts and remove unnecessary files
RUN cd /code && make install && make build SKIP_PYODIDE=true && \
rm -rf /code/bulletin_board/js-client && \
Expand All @@ -105,3 +99,4 @@ RUN bundle exec rake assets:precompile
# Run the entrypoint script
COPY ./docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["bundle", "exec", "rails", "s", "-b", "0.0.0.0"]
12 changes: 3 additions & 9 deletions Dockerfile.worker
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This stage builds the python-wrapper package
FROM decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.1 as python-wrapper-builder
FROM decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.3 as python-wrapper-builder
LABEL author="[email protected]"

# Add Makefile
Expand All @@ -17,7 +17,7 @@ ADD bulletin_board/server.mk /code/bulletin_board/server.mk
RUN cd /code && make build_electionguard_python_wrapper

# This stage builds the pyodide packages for the previous python packages
FROM decidim/pyodide-electionguard:pyodide-0.16.1-electionguard-1.2.1 as python-to-js-builder
FROM decidim/pyodide-electionguard:pyodide-0.16.1-electionguard-1.2.3 as python-to-js-builder
LABEL author="[email protected]"

ENV PYODIDE_PACKAGES "electionguard,bulletin_board-electionguard"
Expand All @@ -43,7 +43,7 @@ RUN make
RUN cp -rf /code/voting_schemes/electionguard/python-to-js/override/* /src/pyodide/build/

# This stage builds the bulletin-board application
FROM decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.1
FROM decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.3
LABEL author="[email protected]"

# Dummy environment variables used to compile assets
Expand Down Expand Up @@ -80,12 +80,6 @@ ADD bulletin_board/server/package.json /code/bulletin_board/server/package.json
ADD bulletin_board/server/Gemfile.lock /code/bulletin_board/server/Gemfile.lock
ADD bulletin_board/server/Gemfile /code/bulletin_board/server/Gemfile

# Prevent npm ERR! code ERR_SOCKET_TIMEOUT
RUN npm install --global npm@latest && \
npm config set fetch-timeout 1800000 -g && \
npm config set fetch-retry-mintimeout 600000 -g && \
npm config set fetch-retry-maxtimeout 1800000 -g

# Install all dependencies, build artifacts and remove unnecessary files
RUN cd /code && make install && make build && \
rm -rf /code/bulletin_board/js-client && \
Expand Down
11 changes: 9 additions & 2 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,12 @@ if [ "$SEED" ]; then
bundle exec rake db:create db:setup db:seed
fi

echo "Running Rails server..."
bundle exec rails s
# Check for pending migrations
if [ -z "$SKIP_MIGRATIONS" ]; then
bundle exec rails db:migrate
else
echo "⚠️ Skipping migrations"
fi

echo "🚀 $@"
exec "$@"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM iodide/pyodide:0.16.1
LABEL author="[email protected]"
LABEL author="[email protected]"

ENV PYODIDE_PACKAGES "pyasn1,libgmp,gmpy2,micropip,attrs,sortedcontainers,hypothesis,jsons,typish,rsa"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ clean:

$(TARBALL):
[ -d $(ROOT)/downloads ] || mkdir $(ROOT)/downloads
wget -q -O $@ $(URL)
wget -v -O $@ $(URL)
sha256sum --quiet --check checksums || (rm $@; false)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90assume-yes
RUN gem install bundler

# Install system dependencies
RUN apt-get update --allow-releaseinfo-change && apt-get install -y sudo pipenv git vim curl
RUN apt-get update --allow-releaseinfo-change && apt-get install -y sudo pipenv git vim curl wget

# Install python and poetry
RUN git clone https://github.com/pyenv/pyenv.git ~/.pyenv && \
pyenv install $PYTHON_VERSION && pyenv global $PYTHON_VERSION
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
RUN curl -sSL https://install.python-poetry.org | python3 -

# Install node
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
Expand Down
2 changes: 1 addition & 1 deletion voting_schemes/electionguard/electionguard-python
2 changes: 1 addition & 1 deletion voting_schemes/electionguard/makefile.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CONSTANTS

ELECTIONGUARD_PYTHON_VERSION = 1.2.1
ELECTIONGUARD_PYTHON_VERSION = 1.2.3
ELECTIONGUARD_PYTHON_WRAPPER_VERSION = 0.1.1
ELECTIONGUARD_JAVA_VERSION = 0.9.2

Expand Down
2 changes: 1 addition & 1 deletion voting_schemes/electionguard/python-to-js/build
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rm -rf $SHARED_FOLDER/electionguard/*
cp -rf .. $SHARED_FOLDER/electionguard/

# Build packages with Pyodide
docker run --rm --mount type=bind,source=$HOST_SHARED_FOLDER/electionguard,target=/electionguard -e PYODIDE_PACKAGES="electionguard,bulletin_board-electionguard" -it decidim/pyodide-electionguard:pyodide-0.16.1-electionguard-1.2.1 /electionguard/python-to-js/build-pyodide
docker run --rm --mount type=bind,source=$HOST_SHARED_FOLDER/electionguard,target=/electionguard -e PYODIDE_PACKAGES="electionguard,bulletin_board-electionguard" -it decidim/pyodide-electionguard:pyodide-0.16.1-electionguard-1.2.3 /electionguard/python-to-js/build-pyodide

# Move generated files to the vendor folder of the js-adapter
cp -rf $SHARED_FOLDER/electionguard/python-to-js/output/* ../ruby-adapter/public/assets/electionguard/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package:
name: electionguard
version: 1.2.1
version: 1.2.3
source:
url: file:dist/electionguard-1.2.1.tar.gz
url: file:dist/electionguard-1.2.3.tar.gz
patches:
- patches/no-cryptography.patch
- patches/no-multiprocessing.patch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ diff --git a/pyproject.toml b/pyproject.toml
index 93b2adb..38a2d6c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -40,7 +40,6 @@ gmpy2 = ">=2.0.8"
numpy = ">=1.18.2"
@@ -39,7 +39,6 @@
# gmpy2 = { path = "./packages/gmpy2-2.0.8-cp38-cp38-win32.whl" } # 32 bit
jsons = ">=1.1.2"
jsonschema = ">=3.2"
-cryptography = ">=3.2"
Expand Down
2 changes: 1 addition & 1 deletion voting_schemes/electionguard/python-wrapper/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pytest = "*"
black = "*"

[packages]
electionguard = {path = "./../electionguard-python/dist/electionguard-1.2.1-py3-none-any.whl"}
electionguard = {path = "./../electionguard-python/dist/electionguard-1.2.3-py3-none-any.whl"}
jsons = '==1.2'

[requires]
Expand Down
Loading

0 comments on commit 6918074

Please sign in to comment.