Skip to content

Commit

Permalink
Update pyodide to 0.17 and fix js adapter (#308)
Browse files Browse the repository at this point in the history
* Upgrade pyodide to 0.17

* change version numbers

* update base docker image for pyodide

* update redis

* rename pythong worker

* remove todos

* some linting

* format js

* update workflows

* update workflows

* update workflows

* fix rubocop source

* update test dependencies

* fix integration test for python wrapper

* prettier on server js

* remove git check

* add exception for git

* update digest gem

* add safe git dir

* restorey types definition

* fix build

* changelog

* update prettier

* update prettier

* incremement test timeout

* incremement test timeout

* remove unnecessary import

---------

Co-authored-by: Txus Bach <[email protected]>
  • Loading branch information
microstudi and txus authored Oct 10, 2023
1 parent 2a312c1 commit 00c72db
Show file tree
Hide file tree
Showing 107 changed files with 37,241 additions and 28,656 deletions.
27 changes: 24 additions & 3 deletions .code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"name": "Bulletin Board Gem",
"path": "bulletin_board/ruby-client"
},
{
"name": "Bulletin Board JS Client",
"path": "bulletin_board/js-client"
},
{
"name": "Documentation",
"path": "docs"
Expand All @@ -20,13 +24,30 @@
"name": "Dummy JS Adapter",
"path": "voting_schemes/dummy/js-adapter"
},
{
"name": "ElectionGuard Wrapper",
"path": "voting_schemes/electionguard/python-wrapper"
},
{
"name": "ElectionGuard JS Adapter",
"path": "voting_schemes/electionguard/js-adapter"
},
{
"name": "ElectionGuard Wrapper",
"path": "voting_schemes/electionguard/python-wrapper"
"name": "ElectionGuard Ruby Adapter",
"path": "voting_schemes/electionguard/ruby-adapter"
},
{
"name": "ElectionGuard Python2JS",
"path": "voting_schemes/electionguard/python-to-js"
},
{
"name": "ElectionGuard Pyodide Base Packages",
"path": "voting_schemes/electionguard/pyodide-base-packages"
},
{
"name": "ElectionGuard Pyodide Verifier",
"path": "voting_schemes/electionguard/verifier"
}
]
],
"settings": {}
}
4 changes: 2 additions & 2 deletions .github/workflows/js-client-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-node@v2-beta
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-node@v2-beta
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ruby-client-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: ruby/setup-ruby@master
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: ruby/setup-ruby@master
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/server-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
container:
image: decidim/ruby-node-python-electionguard:ruby-3.1.1-node-16-python-3.8.11-electionguard-1.2.3
steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Copy local electionguard
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
outputs:
cache-hit: ${{ steps.save-output.outputs.cache-hit }}
steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Cache python to js
Expand All @@ -86,9 +86,9 @@ 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.3
image: decidim/pyodide-electionguard:pyodide-0.17.0-electionguard-1.2.3
steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Cache python to js
Expand Down Expand Up @@ -150,9 +150,11 @@ jobs:
DATABASE_PASSWORD: postgres
DATABASE_HOST: postgres
steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Fix safe directory for git
run: git config --global --add safe.directory /__w/decidim-bulletin-board/decidim-bulletin-board
- name: Cache python to js
uses: actions/cache@v3
env:
Expand Down Expand Up @@ -216,7 +218,6 @@ jobs:
run: |
cd bulletin_board/server
npm run format
git diff --exit-code --ignore-submodules
- name: Create database
env:
RAILS_ENV: test
Expand Down Expand Up @@ -272,9 +273,11 @@ jobs:
REDIS_HOST: redis
REDIS_PORT: 6379
steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Fix safe directory for git
run: git config --global --add safe.directory /__w/decidim-bulletin-board/decidim-bulletin-board
- name: Cache python to js
uses: actions/cache@v3
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/verifier-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-node@v2-beta
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-node@v2-beta
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/voting-scheme-dummy-js-adapter-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-node@v2-beta
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-node@v2-beta
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: ruby/setup-ruby@master
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: ruby/setup-ruby@master
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-node@v2-beta
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-node@v2-beta
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: ruby/setup-ruby@master
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: ruby/setup-ruby@master
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- Fixes for the pyodide upgrade
- Libraries updates

## [0.24.1] - 2022-11-11

- Pyodide has been upgraded to v0.17.0

## Fixed

- Fixed issue with bulletin board Ruby client OpenSSL 3.0 compatibility
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.3 as python-to-js-builder
FROM decidim/pyodide-electionguard:pyodide-0.17.0-electionguard-1.2.3 as python-to-js-builder
LABEL author="[email protected]"

ENV PYODIDE_PACKAGES "electionguard,bulletin_board-electionguard"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -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.3 as python-to-js-builder
FROM decidim/pyodide-electionguard:pyodide-0.17.0-electionguard-1.2.3 as python-to-js-builder
LABEL author="[email protected]"

ENV PYODIDE_PACKAGES "electionguard,bulletin_board-electionguard"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.worker
Original file line number Diff line number Diff line change
Expand Up @@ -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.3 as python-to-js-builder
FROM decidim/pyodide-electionguard:pyodide-0.17.0-electionguard-1.2.3 as python-to-js-builder
LABEL author="[email protected]"

ENV PYODIDE_PACKAGES "electionguard,bulletin_board-electionguard"
Expand Down
21 changes: 12 additions & 9 deletions bulletin_board/js-client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bulletin_board/js-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"jest": "^26.6.3",
"jest-fetch-mock": "^3.0.3",
"jest-transform-graphql": "^2.1.0",
"prettier": "2.1.2",
"prettier": "3.0.3",
"webpack-dev-server": "^3.11.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,20 @@ export class GraphQLClient {
logEntriesByElection[electionUniqueId].data.election.logEntries.find(
(logEntry) => {
return logEntry.contentHash === contentHash;
}
)
},
),
);
}

getElectionLogEntries({ electionUniqueId }) {
return Promise.resolve(
logEntriesByElection[electionUniqueId].data.election.logEntries
logEntriesByElection[electionUniqueId].data.election.logEntries,
);
}

getPendingMessageByMessageId({ messageId }) {
return Promise.resolve(
pendingMessageByMessageId[messageId].data.pendingMessage
pendingMessageByMessageId[messageId].data.pendingMessage,
);
}

Expand Down
7 changes: 3 additions & 4 deletions bulletin_board/js-client/src/client/client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("Client", () => {

it("initialise the api client with the given params", () => {
expect(client.apiClient.apiEndpointUrl).toEqual(
defaultParams.apiEndpointUrl
defaultParams.apiEndpointUrl,
);
expect(client.apiClient.wsEndpointUrl).toEqual(defaultParams.wsEndpointUrl);
});
Expand Down Expand Up @@ -49,9 +49,8 @@ describe("Client", () => {

describe("waitForPendingMessageToBeProcessed", () => {
it("returns the pending message for the given messageId", async () => {
const pendingMessage = await client.waitForPendingMessageToBeProcessed(
"dummy.1"
);
const pendingMessage =
await client.waitForPendingMessageToBeProcessed("dummy.1");
expect(pendingMessage).toEqual({
status: "accepted",
});
Expand Down
Loading

0 comments on commit 00c72db

Please sign in to comment.