Skip to content

Commit 0806556

Browse files
authored
Merge pull request #395 from dedis/c4dt-main-jean
merge c4dt work on d-voting upgraded to go 1.23
2 parents 7a341fd + e60afb1 commit 0806556

File tree

266 files changed

+8599
-3553
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

266 files changed

+8599
-3553
lines changed

.env.example

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# This is an example .env file with default passwords and private keys.
2+
# Do not use this in production or with any public-facing ports!
3+
BACKEND_HOST=backend # name of the 'backend' container
4+
BACKEND_PORT=5000 # port of the 'backend' container
5+
COMPOSE_FILE=./docker-compose/docker-compose.yml # Docker Compose configuration file to use
6+
DATABASE_HOST=db # name of the PostgreSQL container
7+
DATABASE_PASSWORD=Ohw0phoa # choose any PostgreSQL password
8+
DATABASE_PORT=5432 # port of the PostgreSQL container
9+
DATABASE_USERNAME=dvoting
10+
DB_PATH=dvoting # LMDB database path
11+
DELA_PROXY_URL=http://172.19.44.254:8080 # IP and port of one of the DELA containers
12+
FRONT_END_URL=http://127.0.0.1:3000 # the automated frontend tests expect this value do not change it
13+
NODEPORT=2000 # DELA node port
14+
# For public-facing services and production, this key needs to be changed!
15+
PRIVATE_KEY=6aadf480d068ac896330b726802abd0da2a5f3824f791fe8dbd4cd555e80b809
16+
PROXYPORT=8080 # DELA proxy port
17+
PUBLIC_KEY=3e5fcaed4c5d79a8eccceeb087ee0a13b8f91d917ed62017a9cd28e13b228389
18+
REACT_APP_DEV_LOGIN=true # debugging admin login /!\ disable in production /!\
19+
REACT_APP_RANDOMIZE_VOTE_ID=true # randomize voter ID for debugging /!\ disable in production /!\
20+
REACT_APP_SCIPER_ADMIN=123456 # debugging admin ID /!\ disable in production /!\
21+
REACT_APP_BLOCKLIST= # comma-separad form IDs to hide from non-admin users
22+
SESSION_SECRET=kaibaaF9 # choose any secret

.github/pull_request_template.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Thank you for opening a pull request with this project, please also:
2+
3+
* [ ] add a brief description of your changes here
4+
* [ ] assign the PR to yourself, or to the person(s) working on it
5+
* [ ] start in `draft` mode and `in progress` pipeline in the project (if applicable)
6+
* [ ] if applicable, add this PR to its related issue by one of the special keywords [Closing keywords](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue)
7+
* once it's ready
8+
* [ ] put it in the `Review` or `Ready4Merge` pipeline in the project (if applicable)
9+
* [ ] remove `draft`
10+
* [ ] assign a reviewer

.github/workflows/build-docker.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Build docker
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened, ready_for_review]
9+
10+
jobs:
11+
build-docker:
12+
name: Build D-Voting Docker images
13+
runs-on: ubuntu-22.04
14+
env:
15+
DockerTag: latest
16+
push: ${{ (github.ref == 'refs/heads/main') && 'true' || 'false' }}
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
- name: Set env
24+
run: |
25+
git describe --tags
26+
echo "REACT_APP_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
27+
echo "REACT_APP_BUILD=$(git describe --tags)" >> $GITHUB_ENV
28+
echo "REACT_APP_BUILD_TIME=$(date)" >> $GITHUB_ENV
29+
- name: Set up Docker Buildx
30+
id: buildx
31+
uses: docker/setup-buildx-action@v3
32+
- name: Login to GHCR
33+
if: ${{ env.push == 'true' }}
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ghcr.io
37+
username: ${{ github.repository_owner }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Build Frontend
41+
uses: docker/build-push-action@v6
42+
with:
43+
context: .
44+
file: Dockerfiles/Dockerfile.frontend
45+
platforms: linux/amd64
46+
build-args: |
47+
REACT_APP_VERSION
48+
REACT_APP_BUILD
49+
REACT_APP_BUILD_TIME
50+
push: ${{ env.push }}
51+
tags: ghcr.io/dedis/d-voting-frontend:${{ env.DockerTag }}
52+
- name: Build Backend
53+
uses: docker/build-push-action@v6
54+
with:
55+
context: .
56+
file: Dockerfiles/Dockerfile.backend
57+
platforms: linux/amd64
58+
push: ${{ env.push }}
59+
tags: ghcr.io/dedis/d-voting-backend:${{ env.DockerTag }}
60+
- name: Build D-Voting
61+
uses: docker/build-push-action@v6
62+
with:
63+
context: .
64+
file: Dockerfiles/Dockerfile.dela
65+
platforms: linux/amd64
66+
push: ${{ env.push }}
67+
tags: ghcr.io/dedis/d-voting-dela:${{ env.DockerTag }}

.github/workflows/go_dvoting_test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ jobs:
1212
name: Scenario
1313
runs-on: ubuntu-latest
1414
steps:
15-
- name: Set up Go ^1.17
16-
uses: actions/setup-go@v2
15+
- name: Check out code into the Go module directory
16+
uses: actions/checkout@v4
17+
18+
- name: Use Go 1.23
19+
uses: actions/setup-go@v5
1720
with:
18-
go-version: ^1.17
21+
go-version: '1.23'
1922

2023
- name: Install crypto util from Dela
2124
run: |
2225
git clone https://github.com/dedis/dela.git
2326
cd dela
2427
go install ./cli/crypto
2528
26-
- name: Check out code into the Go module directory
27-
uses: actions/checkout@v2
28-
2929
- name: Create a private key
3030
run: crypto bls signer new --save private.key
3131

.github/workflows/go_integration_tests.yml

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,58 +8,63 @@ on:
88

99
jobs:
1010
integration:
11-
name: Integration test
11+
name: Integration tests
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Set up Go ^1.17
15-
uses: actions/setup-go@v2
16-
with:
17-
go-version: ^1.17
18-
1914
- name: Check out code into the Go module directory
20-
uses: actions/checkout@v2
15+
uses: actions/checkout@v4
16+
17+
- name: Use Go 1.23
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version: '1.23'
2121

2222
- name: Run the integration test
2323
run: go test -timeout 10m -run TestIntegration ./integration/...
2424
bad_vote:
2525
name: Test bad vote
2626
runs-on: ubuntu-latest
2727
steps:
28-
- name: Set up Go ^1.17
29-
uses: actions/setup-go@v2
30-
with:
31-
go-version: ^1.17
32-
3328
- name: Check out code into the Go module directory
34-
uses: actions/checkout@v2
29+
uses: actions/checkout@v4
30+
31+
- name: Use Go 1.23
32+
uses: actions/setup-go@v5
33+
with:
34+
go-version: '1.23'
3535

3636
- name: Run the bad vote test
3737
run: go test -timeout 10m -run TestBadVote ./integration/...
3838
crash:
3939
name: Test crash
4040
runs-on: ubuntu-latest
4141
steps:
42-
- name: Set up Go ^1.17
43-
uses: actions/setup-go@v2
44-
with:
45-
go-version: ^1.17
46-
4742
- name: Check out code into the Go module directory
48-
uses: actions/checkout@v2
43+
uses: actions/checkout@v4
44+
45+
- name: Use Go 1.23
46+
uses: actions/setup-go@v5
47+
with:
48+
go-version: '1.23'
4949

5050
- name: Run the crash test
51-
run: go test -timeout 10m -run TestCrash ./integration/...
51+
run: |
52+
for a in $( seq 3 ); do
53+
echo "Testing sequence $a"
54+
go test -timeout 10m -run TestCrash ./integration/... && exit 0
55+
done
56+
exit 1
5257
revote:
5358
name: Test revote
5459
runs-on: ubuntu-latest
5560
steps:
56-
- name: Set up Go ^1.17
57-
uses: actions/setup-go@v2
58-
with:
59-
go-version: ^1.17
60-
6161
- name: Check out code into the Go module directory
62-
uses: actions/checkout@v2
62+
uses: actions/checkout@v4
63+
64+
- name: Use Go 1.23
65+
uses: actions/setup-go@v5
66+
with:
67+
go-version: '1.23'
6368

6469
- name: Run the revote test
6570
run: go test -timeout 10m -run TestRevote ./integration/...

.github/workflows/go_scenario_test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
name: Tests
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Set up Go ^1.17
15-
uses: actions/setup-go@v2
14+
- name: Use Go 1.23
15+
uses: actions/setup-go@v5
1616
with:
17-
go-version: ^1.17
17+
go-version: '1.23'
1818

1919
- name: Install crypto util from Dela
2020
run: |
@@ -23,7 +23,7 @@ jobs:
2323
go install ./cli/crypto
2424
2525
- name: Check out code into the Go module directory
26-
uses: actions/checkout@v2
26+
uses: actions/checkout@v4
2727

2828
- name: Create a private key
2929
run: crypto bls signer new --save private.key

.github/workflows/go_test.yml

Lines changed: 9 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,52 +10,22 @@ jobs:
1010
name: Tests
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Use Go >= 1.19
14-
uses: actions/setup-go@v3
13+
- name: Use Go 1.23
14+
uses: actions/setup-go@v5
1515
with:
16-
go-version: '>=1.19'
16+
go-version: '1.23'
1717
id: go
1818

1919
- name: Check out code into the Go module directory
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
2121

22-
- name: Run lint
23-
run: make lint
24-
22+
# TODO: https://github.com/dedis/d-voting/issues/392
23+
# - name: Run lint
24+
# run: make lint
25+
#
2526
- name: Run vet
2627
run: make vet
2728

2829
- name: Test all, except integration, with coverage
2930
run: |
30-
go test -json -covermode=count -coverprofile=profile.cov $(go list ./... | grep -v /integration) 2>&1 | tee report.json
31-
32-
- name: Sonarcloud scan
33-
uses: sonarsource/sonarcloud-github-action@master
34-
with:
35-
args: >
36-
-Dsonar.organization=dedis
37-
-Dsonar.projectKey=dedis_d-voting
38-
-Dsonar.go.tests.reportPaths=report.json
39-
-Dsonar.go.coverage.reportPaths=profile.cov
40-
-Dsonar.coverage.exclusions=**/*_test.go,/internal/**/*
41-
-Dsonar.issue.ignore.multicriteria=e1
42-
-Dsonar.issue.ignore.multicriteria.e1.ruleKey=*Naming*
43-
-Dsonar.issue.ignore.multicriteria.e1.resourceKey=**/*_test.go
44-
env:
45-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
47-
48-
- name: Send coverage
49-
uses: shogo82148/actions-goveralls@v1
50-
with:
51-
path-to-profile: profile.cov
52-
parallel: true
53-
54-
# notifies that all test jobs are finished.
55-
finish:
56-
needs: test
57-
runs-on: ubuntu-latest
58-
steps:
59-
- uses: shogo82148/actions-goveralls@v1
60-
with:
61-
parallel-finished: true
31+
go test $(go list ./... | grep -v /integration)

.github/workflows/releases.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ jobs:
1111

1212
steps:
1313
- name: checkout
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1515

16-
- name: Use go
17-
uses: actions/setup-go@v3
16+
- name: Use Go 1.23
17+
uses: actions/setup-go@v5
1818
with:
19-
go-version: '>=1.18'
19+
go-version: '1.23'
2020

2121
- name: Install fpm
2222
run: |
@@ -52,8 +52,8 @@ jobs:
5252
working-directory: ./web/backend
5353

5454
steps:
55-
- uses: actions/checkout@v3
56-
- uses: actions/setup-node@v3
55+
- uses: actions/checkout@v4
56+
- uses: actions/setup-node@v4
5757
with:
5858
node-version: 18
5959

@@ -104,8 +104,8 @@ jobs:
104104
working-directory: ./web/frontend
105105

106106
steps:
107-
- uses: actions/checkout@v3
108-
- uses: actions/setup-node@v3
107+
- uses: actions/checkout@v4
108+
- uses: actions/setup-node@v4
109109
with:
110110
node-version: 18
111111

.github/workflows/web_backend_lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
working-directory: ./web/backend
1616

1717
steps:
18-
- uses: actions/checkout@v3
19-
- uses: actions/setup-node@v3
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-node@v4
2020
with:
2121
node-version: '16'
2222

.github/workflows/web_frontend_lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
working-directory: ./web/frontend
1616

1717
steps:
18-
- uses: actions/checkout@v3
19-
- uses: actions/setup-node@v3
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-node@v4
2020
with:
2121
node-version: '16'
2222

0 commit comments

Comments
 (0)