Skip to content

Commit

Permalink
Fix GitHub build (#286)
Browse files Browse the repository at this point in the history
* Try fixing verification

* Fix github build

* Install pipenv

* Revert "Try fixing verification"

This reverts commit e16c15c.

* Bump rubocop related gem versions

* Fix automatic rubocop offences

* Fix Rails/TransactionExitStatement offence

* Fix Style/MapToHash offence

* Fix Rails/CompactBlank offence

* Fix Style/RedundantArgument offence

* Add rubocop-graphql recommended library

* Change branch to new one in workflow configuration

* Add missing index from schema

* Reintroduces the exit statemenent on transactions for process_message

* Update rubocop at ruby-client and fix the violations

* Fix rubocop violations at the server

* Update the rubocop gems at the ruby-adapter

* Update rubocop at the electionguard ruby-adapter

* Fix the rubocop dependency issue at the bulletin board server

* Add the net-* gems to the server development and test groups

* Fix rspec expectation

Co-authored-by: Txus Bach <[email protected]>
Co-authored-by: Antti Hukkanen <[email protected]>
  • Loading branch information
3 people authored Aug 26, 2022
1 parent f3e27b2 commit 98e9956
Show file tree
Hide file tree
Showing 120 changed files with 476 additions and 437 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/server-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
branches:
- develop
- main
- fix/github-ci

env:
CI: "true"
Expand All @@ -26,12 +27,17 @@ jobs:
fetch-depth: 1
- name: Copy local electionguard
run: cp -r /code/voting_schemes/electionguard/electionguard-python voting_schemes/electionguard

- name: Install pipenv
run: |
python3 -m pip install --upgrade pipenv wheel
- name: Upgrade setuptools for the virtual environment
working-directory: ./voting_schemes/electionguard/python-wrapper
run: |
pipenv run echo "Initialize"
python3 -m pipenv run echo "Initialize"
curl -sS https://bootstrap.pypa.io/get-pip.py | $(pipenv --py)
pipenv run python -m pip install --upgrade setuptools
python3 -m pipenv run python -m pip install --upgrade setuptools
- name: Cache python wrapper
uses: actions/cache@v3
env:
Expand Down
4 changes: 2 additions & 2 deletions bulletin_board/ruby-client/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ source "https://rubygems.org"
# Specify your gem's dependencies in decidim-bulletin_board.gemspec
gemspec

gem "rubocop", "~> 0.92.0"
gem "rubocop", "~> 1.28.0"
gem "rubocop-faker", "~> 1.1.0"
gem "rubocop-rspec", "~> 1.44.1"
gem "rubocop-rspec", "~> 2.10"
43 changes: 21 additions & 22 deletions bulletin_board/ruby-client/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ GEM
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
builder (3.2.4)
byebug (11.1.3)
Expand All @@ -81,7 +81,7 @@ GEM
crass (1.0.6)
diff-lcs (1.5.0)
erubi (1.11.0)
faker (2.20.0)
faker (2.22.0)
i18n (>= 1.8.11, < 2)
faraday (1.10.2)
faraday-em_http (~> 1.0)
Expand Down Expand Up @@ -119,7 +119,7 @@ GEM
activesupport (>= 3.0)
graphql
hashdiff (1.0.1)
i18n (1.10.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
jwt (2.5.0)
loofah (2.18.0)
Expand All @@ -141,10 +141,10 @@ GEM
racc (~> 1.4)
nokogiri (1.13.8-x86_64-linux)
racc (~> 1.4)
parallel (1.22.0)
parser (3.1.1.0)
parallel (1.22.1)
parser (3.1.2.1)
ast (~> 2.4.1)
public_suffix (4.0.6)
public_suffix (5.0.0)
racc (1.6.0)
rack (2.2.4)
rack-test (2.0.2)
Expand Down Expand Up @@ -177,7 +177,7 @@ GEM
thor (~> 1.0)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.2.1)
regexp_parser (2.5.0)
rexml (3.2.5)
rspec (3.11.0)
rspec-core (~> 3.11.0)
Expand All @@ -188,27 +188,26 @@ GEM
rspec-expectations (3.11.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-mocks (3.11.0)
rspec-mocks (3.11.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-support (3.11.0)
rubocop (0.92.0)
rubocop (1.28.2)
parallel (~> 1.10)
parser (>= 2.7.1.5)
parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 0.5.0)
rubocop-ast (>= 1.17.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (1.16.0)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.21.0)
parser (>= 3.1.1.0)
rubocop-faker (1.1.0)
faker (>= 2.12.0)
rubocop (>= 0.82.0)
rubocop-rspec (1.44.1)
rubocop (~> 0.87)
rubocop-ast (>= 0.7.1)
rubocop-rspec (2.11.1)
rubocop (~> 1.19)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.5)
sprockets (4.1.1)
Expand All @@ -221,8 +220,8 @@ GEM
thor (1.2.1)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
unicode-display_width (1.8.0)
webmock (3.14.0)
unicode-display_width (2.2.0)
webmock (3.18.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand All @@ -242,9 +241,9 @@ DEPENDENCIES
decidim-bulletin_board!
rake (~> 13.0)
rspec (~> 3.7)
rubocop (~> 0.92.0)
rubocop (~> 1.28.0)
rubocop-faker (~> 1.1.0)
rubocop-rspec (~> 1.44.1)
rubocop-rspec (~> 2.10)
webmock (~> 3.6)
wisper-rspec (~> 1.1.0)

Expand Down
1 change: 1 addition & 0 deletions bulletin_board/ruby-client/decidim-bulletin_board.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ Gem::Specification.new do |s|
s.add_development_dependency "rspec", "~> 3.7"
s.add_development_dependency "webmock", "~> 3.6"
s.add_development_dependency "wisper-rspec", "~> 1.1.0"
s.metadata["rubygems_mfa_required"] = "true"
end
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def message_id
def call
# arguments used inside the graphql operation
args = {
message_id: message_id,
message_id:,
signed_data: sign_message(message_id, message)
}

Expand Down Expand Up @@ -46,18 +46,18 @@ def call

def message
{
scheme: scheme,
bulletin_board: bulletin_board,
authority: authority,
trustees: trustees,
polling_stations: polling_stations,
scheme:,
bulletin_board:,
authority:,
trustees:,
polling_stations:,
description: {
name: text(election_data[:title]),
start_date: election_data[:start_date].strftime("%FT%T%:z"),
end_date: election_data[:end_date].strftime("%FT%T%:z"),
candidates: candidates,
contests: contests,
ballot_styles: ballot_styles
candidates:,
contests:,
ballot_styles:
}
}
end
Expand Down Expand Up @@ -149,7 +149,7 @@ def default_text(field)

def text(field)
{
text: field.map { |locale, value| { language: locale.to_s, value: value } }
text: field.map { |locale, value| { language: locale.to_s, value: } }
}
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def message_id
def call
# arguments used inside the graphql operation
args = {
message_id: message_id,
message_id:,
signed_data: sign_message(message_id, {})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def call
@election = response.data.election
@signed_data = election.log_entries.first.signed_data

broadcast(:ok, { election_results: decoded_data["results"], verifiable_results: verifiable_results })
broadcast(:ok, { election_results: decoded_data["results"], verifiable_results: })
rescue Graphlient::Errors::ServerError
broadcast(:error, "Sorry, something went wrong")
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def message_id
def call
# arguments used inside the graphql operation
args = {
message_id: message_id,
message_id:,
signed_data: sign_message(message_id, {})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def message_id
def call
# arguments used inside the graphql operation
args = {
message_id: message_id,
signed_data: sign_message(message_id, { trustee_id: trustee_id })
message_id:,
signed_data: sign_message(message_id, { trustee_id: })
}

response = graphql.query do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def message_id
def call
# arguments used inside the graphql operation
args = {
message_id: message_id,
message_id:,
signed_data: sign_message(message_id, {})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def message_id
def call
# arguments used inside the graphql operation
args = {
message_id: message_id,
message_id:,
signed_data: sign_message(message_id, {})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def message_id
def call
# arguments used inside the graphql operation
args = {
message_id: message_id,
message_id:,
signed_data: sign_message(message_id, {})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def sign_message(message_id, message)
def complete_message(message_id, message)
message.merge({
iat: Time.now.to_i,
message_id: message_id
message_id:
})
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Graphql
class FileAdapter
attr_reader :file_name

def initialize(file_name, _options = {}, &_block)
def initialize(file_name, _options = {}, &)
@file_name = file_name
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def message_id
def call
# arguments used inside the graphql operation
args = {
message_id: message_id,
message_id:,
signed_data: sign_message(message_id, { content: encrypted_vote })
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def message_id
def call
# arguments used inside the graphql operation
args = {
message_id: message_id,
signed_data: sign_message(message_id, { polling_station_id: polling_station_id })
message_id:,
signed_data: sign_message(message_id, { polling_station_id: })
}

begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ module Authority
],
default_locale: "en",
title: {
"en": "An election",
"es": "Una elección"
en: "An election",
es: "Una elección"
},
start_date: Time.new(2023, 4, 5, 6, 7, 8, "+03:00"),
end_date: Time.new(2023, 4, 7, 6, 5, 4, "+03:00"),
Expand All @@ -38,12 +38,12 @@ module Authority
slug: "question-1",
max_selections: 1,
title: {
"en": "A question",
"es": "Una pregunta"
en: "A question",
es: "Una pregunta"
},
description: {
"en": "A question description",
"es": "Una descripción de pregunta"
en: "A question description",
es: "Una descripción de pregunta"
},
answers: [
{
Expand All @@ -58,12 +58,12 @@ module Authority
slug: "question-2",
max_selections: 2,
title: {
"en": "Another question",
"es": "Otra pregunta"
en: "Another question",
es: "Otra pregunta"
},
description: {
"en": "Another question description",
"es": "Otra descripción de pregunta"
en: "Another question description",
es: "Otra descripción de pregunta"
},
answers: [
{
Expand All @@ -79,36 +79,38 @@ module Authority
{
slug: "answer-1",
title: {
"en": "An answer",
"es": "Una respuesta"
en: "An answer",
es: "Una respuesta"
}
},
{
slug: "answer-2",
title: {
"en": "Another answer",
"es": "Otra respuesta"
en: "Another answer",
es: "Otra respuesta"
}
},
{
slug: "answer-3",
title: {
"en": "An answer for another question",
"es": "Una respuesta para otra pregunta"
en: "An answer for another question",
es: "Una respuesta para otra pregunta"
}
},
{
slug: "answer-4",
title: {
"en": "Another answer for another question",
"es": "Otra respuesta para otra pregunta"
en: "Another answer for another question",
es: "Otra respuesta para otra pregunta"
}
}
],
ballot_styles: {
"ballot_style_1": ["question-1"],
"ballot_style_2": ["question-2"],
"ballot_style_3": ["question-1", "question-2"]
# rubocop:disable Naming/VariableNumber
ballot_style_1: ["question-1"],
ballot_style_2: ["question-2"],
ballot_style_3: ["question-1", "question-2"]
# rubocop:enable Naming/VariableNumber
}
}
end
Expand Down
Loading

0 comments on commit 98e9956

Please sign in to comment.