Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/generate_sample_data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Generate Sample Data

on:
workflow_dispatch:
pull_request:
paths:
- ".github/workflows/generate_sample_data.yml"
- "Makefile"
- "scripts/generate_sample_data.py"
- "data/sample/manifests/**"

env:
SAMPLE_DATA_PYTHON_VERSION: 3.9

jobs:
generate:
name: Generate Sample Data
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v5
- name: Set up Python ${{ env.SAMPLE_DATA_PYTHON_VERSION }}
uses: actions/setup-python@v6
with:
python-version: ${{ env.SAMPLE_DATA_PYTHON_VERSION }}
- name: Install sample data generator dependencies
run: python -m pip install electionguard==1.4.0 dacite==1.6.0 hypothesis
- name: Package Sample Data
run: make release-package-sample-data PYTHON=python
- name: Publish Sample Data
uses: actions/upload-artifact@v4
with:
name: sample-data
path: |
sample-data.zip
sample-data.tar.gz
overwrite: true
15 changes: 12 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

env:
PYTHON_VERSION: 3.14.0
SAMPLE_DATA_PYTHON_VERSION: 3.9

jobs:
publish:
Expand All @@ -28,11 +29,19 @@ jobs:
run: pipenv install
- name: Deploy
run: pipenv run make deploy
- name: Zip Sample Data
run: pipenv run make release-zip-sample-data
- name: Set up Python ${{ env.SAMPLE_DATA_PYTHON_VERSION }} for sample data
uses: actions/setup-python@v6
with:
python-version: ${{ env.SAMPLE_DATA_PYTHON_VERSION }}
- name: Install sample data generator dependencies
run: python -m pip install electionguard==1.4.0 dacite==1.6.0 hypothesis
- name: Package Sample Data
run: make release-package-sample-data PYTHON=python
- name: Publish Sample Data
uses: actions/upload-artifact@v4
with:
name: sample-data
path: sample-data.zip
path: |
sample-data.zip
sample-data.tar.gz
overwrite: true
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
node_modules/
.DS_Store
site/
site/
data/sample/generated/
sample-data.zip
sample-data.tar.gz
20 changes: 18 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
.PHONY: all install lint serve build deploy
.PHONY: all install lint serve build deploy generate-sample-data release-package-sample-data release-zip-sample-data release-tar-sample-data

PYTHON ?= python3
SAMPLE_DATA_VERSION ?= 0.95.0
SAMPLE_DATA_OUTPUT ?= data/sample/generated
SAMPLE_BALLOT_COUNT ?= 5
SAMPLE_BALLOT_SPOIL_RATE ?= 50

all: install serve

Expand All @@ -23,6 +29,16 @@ labels:
github-label-sync --labels .github/labels.yml Election-Tech-Initiative/electionguard-api-python
github-label-sync --labels .github/labels.yml Election-Tech-Initiative/electionguard-ui

generate-sample-data:
@echo 🔁 GENERATE SAMPLE DATA
$(PYTHON) scripts/generate_sample_data.py --clean --private-data --version $(SAMPLE_DATA_VERSION) --output-dir $(SAMPLE_DATA_OUTPUT) --number-of-ballots $(SAMPLE_BALLOT_COUNT) --spoil-rate $(SAMPLE_BALLOT_SPOIL_RATE)

release-package-sample-data: generate-sample-data release-zip-sample-data release-tar-sample-data

release-zip-sample-data:
@echo 📁 ZIP SAMPLE DATA
zip -r sample-data.zip data
zip -r sample-data.zip $(SAMPLE_DATA_OUTPUT)

release-tar-sample-data:
@echo 📁 TAR SAMPLE DATA
tar -czf sample-data.tar.gz $(SAMPLE_DATA_OUTPUT)
Loading