Add example ballot file with 100k ballots. #264
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: [push, pull_request] | |
name: Integration tests | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
RUSTFLAGS: "-D warnings" | |
CARGO_UNSTABLE_SPARSE_REGISTRY: true | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@nightly | |
- name: Create Cargo.lock file | |
run: cargo generate-lockfile | |
- name: Cache Cargo registry | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/registry | |
key: cargo-registry-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('Cargo.lock') }} | |
restore-keys: | | |
cargo-registry-${{ hashFiles('Cargo.toml') }} | |
cargo-registry | |
- name: Check Cargo version | |
run: cargo -V > cargo.version.txt | |
- name: Cache Cargo target | |
uses: actions/cache@v3 | |
with: | |
path: target | |
key: cargo-target-release-${{ hashFiles('cargo.version.txt') }}-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('Cargo.lock') }} | |
restore-keys: | | |
cargo-target-release-${{ hashFiles('cargo.version.txt') }}-${{ hashFiles('Cargo.toml') }} | |
cargo-target-release-${{ hashFiles('cargo.version.txt') }} | |
- name: Build STV-rs | |
run: cargo build --release | |
- name: Build histogram | |
run: cargo build --release --example histogram | |
- name: Build remove_nicknames | |
run: cargo build --release --example remove_nicknames | |
- name: Build shuffle_ballots | |
run: cargo build --release --example shuffle_ballots | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: build-artifacts | |
path: | | |
target/release/stv-rs | |
target/release/examples/histogram | |
target/release/examples/remove_nicknames | |
target/release/examples/shuffle_ballots | |
if-no-files-found: error | |
help_tests: | |
needs: build | |
strategy: | |
matrix: | |
file: | |
- short_help | |
- help | |
- meek_help | |
- plurality_help | |
- version | |
include: | |
- file: short_help | |
flags: "-h" | |
- file: help | |
flags: "--help" | |
- file: meek_help | |
flags: "meek --help" | |
- file: plurality_help | |
flags: "plurality --help" | |
- file: version | |
flags: "--version" | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build-artifacts | |
path: target/release/ | |
- name: Prepare STV-rs binary | |
run: chmod +x target/release/stv-rs | |
- name: Check output | |
run: | | |
target/release/stv-rs ${{ matrix.flags }} | diff -s man/${{ matrix.file }}.txt - | |
meek_tests: | |
needs: build | |
strategy: | |
matrix: | |
file: | |
- equal_preference/equal_preference | |
- equal_preference/equal_preference_droop | |
- equal_preference/equal_preference_equalize | |
- negative_surplus/below_quota | |
- random/rand_2x10 | |
- random/rand_5x4 | |
- random/rand_hypergeometric | |
- random/rand_hypergeometric_10k | |
- random/rand_hypergeometric_100k | |
- recursive_descent/transfer | |
- recursive_descent/transfer_is_blocked | |
- ties/tie_break_explicit | |
- ties/tie_break_implicit | |
- vegetables | |
parallel: | |
- false | |
- true | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build-artifacts | |
path: target/release/ | |
- name: Install Droop | |
if: ${{ matrix.parallel == true }} | |
run: git clone https://github.com/jklundell/droop | |
- name: Prepare STV-rs binary | |
run: chmod +x target/release/stv-rs | |
- name: Check STV-rs output (ballot from stdin) | |
run: | | |
target/release/stv-rs --arithmetic fixed9 meek --parallel=${{ matrix.parallel }} < testdata/ballots/${{ matrix.file }}.blt | diff -s testdata/meek/${{ matrix.file }}.fixed9.log - | |
- name: Check STV-rs output (ballot from CLI) | |
run: | | |
target/release/stv-rs --arithmetic fixed9 --input testdata/ballots/${{ matrix.file }}.blt meek --parallel=${{ matrix.parallel }} | diff -s testdata/meek/${{ matrix.file }}.fixed9.log - | |
- name: Check STV-rs output (equalized counting) | |
run: | | |
target/release/stv-rs --arithmetic fixed9 --input testdata/ballots/${{ matrix.file }}.blt meek --parallel=${{ matrix.parallel }} --equalize | diff -s testdata/meek/${{ matrix.file }}.equalize.fixed9.log - | |
- name: Check Droop output | |
if: ${{ matrix.parallel == true }} | |
run: | | |
sed -i "s/Implementation: STV-rs/Droop package: droop v0.14/g" testdata/meek/${{ matrix.file }}.fixed9.log | |
python3 droop/Droop.py meek fixed precision=9 omega=6 defeat_batch=none testdata/ballots/${{ matrix.file }}.blt 2> droop.err | diff -s testdata/meek/${{ matrix.file }}.fixed9.log - | |
echo -n "" | diff -s - droop.err | |
plurality_tests: | |
needs: build | |
strategy: | |
matrix: | |
file: | |
- random/rand_2x10 | |
- random/rand_5x4 | |
- random/rand_hypergeometric | |
- random/rand_hypergeometric_10k | |
- random/rand_hypergeometric_100k | |
- vegetables | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build-artifacts | |
path: target/release/ | |
- name: Prepare STV-rs binary | |
run: chmod +x target/release/stv-rs | |
- name: Check STV-rs output | |
run: | | |
target/release/stv-rs --arithmetic fixed9 plurality < testdata/ballots/${{ matrix.file }}.blt | diff -s testdata/plurality_block_voting/${{ matrix.file }}.fixed9.log - | |
histogram_tests: | |
needs: build | |
strategy: | |
matrix: | |
file: | |
- equal_preference/equal_preference | |
- random/rand_2x10 | |
- random/rand_5x4 | |
- random/rand_hypergeometric | |
- random/rand_hypergeometric_10k | |
- random/rand_hypergeometric_100k | |
- vegetables | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build-artifacts | |
path: target/release/ | |
- name: Prepare histogram binary | |
run: chmod +x target/release/examples/histogram | |
- name: Check histogram output | |
run: | | |
target/release/examples/histogram < testdata/ballots/${{ matrix.file }}.blt | diff -s testdata/histogram/${{ matrix.file }}.csv - | |
surplus_tests: | |
needs: build | |
strategy: | |
matrix: | |
file: | |
- negative_surplus/below_quota | |
parallel: | |
- false | |
- true | |
include: | |
- file: negative_surplus/below_quota | |
output: negative_surplus/force_positive_surplus | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build-artifacts | |
path: target/release/ | |
- name: Prepare STV-rs binary | |
run: chmod +x target/release/stv-rs | |
- name: Check STV-rs output | |
run: | | |
target/release/stv-rs --arithmetic fixed9 --input testdata/ballots/${{ matrix.file }}.blt meek --parallel=${{ matrix.parallel }} --force-positive-surplus | diff -s testdata/meek/${{ matrix.output }}.fixed9.log - | |
numeric_tests: | |
needs: build | |
strategy: | |
matrix: | |
file: | |
- equal_preference | |
- vegetables.keep_withdrawn | |
- vegetables.remove_withdrawn | |
include: | |
- file: equal_preference | |
src: equal_preference/equal_preference | |
flags: "" | |
- file: vegetables.keep_withdrawn | |
src: vegetables | |
flags: "" | |
- file: vegetables.remove_withdrawn | |
src: vegetables | |
flags: "--remove-withdrawn-candidates" | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build-artifacts | |
path: target/release/ | |
- name: Install Droop | |
if: ${{ matrix.flags == '' }} | |
run: git clone https://github.com/jklundell/droop | |
- name: Prepare remove_nicknames binary | |
run: chmod +x target/release/examples/remove_nicknames | |
- name: Check numeric ballot | |
run: | | |
target/release/examples/remove_nicknames ${{ matrix.flags }} < testdata/ballots/${{ matrix.src }}.blt | diff -s testdata/numeric/${{ matrix.file }}.blt - | |
- name: Check Droop output | |
if: ${{ matrix.flags == '' }} | |
run: | | |
sed -i "s/Implementation: STV-rs/Droop package: droop v0.14/g" testdata/meek/${{ matrix.src }}.fixed9.log | |
python3 droop/Droop.py meek fixed precision=9 omega=6 defeat_batch=none testdata/numeric/${{ matrix.file }}.blt 2> droop.err | diff -s testdata/meek/${{ matrix.src }}.fixed9.log - | |
echo -n "" | diff -s - droop.err | |
shuffle_tests: | |
needs: build | |
strategy: | |
matrix: | |
file: | |
- rand_sorted_by_product | |
- rand_sorted_lexicographically | |
- rand_sorted_by_lexico_product | |
- rand_10k_sorted_by_product | |
- rand_10k_sorted_lexicographically | |
- rand_10k_sorted_by_lexico_product | |
- rand_100k_sorted_by_product | |
- rand_100k_sorted_lexicographically | |
- rand_100k_sorted_by_lexico_product | |
include: | |
- file: rand_sorted_by_product | |
src: random/rand_hypergeometric | |
strategy: "product" | |
- file: rand_sorted_lexicographically | |
src: random/rand_hypergeometric | |
strategy: "lexicographic" | |
- file: rand_sorted_by_lexico_product | |
src: random/rand_hypergeometric | |
strategy: "lexico-product" | |
- file: rand_10k_sorted_by_product | |
src: random/rand_hypergeometric_10k | |
strategy: "product" | |
- file: rand_10k_sorted_lexicographically | |
src: random/rand_hypergeometric_10k | |
strategy: "lexicographic" | |
- file: rand_10k_sorted_by_lexico_product | |
src: random/rand_hypergeometric_10k | |
strategy: "lexico-product" | |
- file: rand_100k_sorted_by_product | |
src: random/rand_hypergeometric_100k | |
strategy: "product" | |
- file: rand_100k_sorted_lexicographically | |
src: random/rand_hypergeometric_100k | |
strategy: "lexicographic" | |
- file: rand_100k_sorted_by_lexico_product | |
src: random/rand_hypergeometric_100k | |
strategy: "lexico-product" | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build-artifacts | |
path: target/release/ | |
- name: Prepare shuffle_ballots binary | |
run: chmod +x target/release/examples/shuffle_ballots | |
- name: Check shuffled ballot | |
run: | | |
target/release/examples/shuffle_ballots --strategy=${{ matrix.strategy }} < testdata/ballots/${{ matrix.src }}.blt | diff -s testdata/shuffle_ballots/${{ matrix.file }}.blt - | |
crash_fixed9_tests: | |
needs: build | |
strategy: | |
matrix: | |
file: | |
- crashes/crash | |
- crashes/minimal | |
- crashes/minimal10 | |
- crashes/rand_geometric | |
parallel: | |
- false | |
- true | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build-artifacts | |
path: target/release/ | |
- name: Prepare STV-rs binary | |
run: chmod +x target/release/stv-rs | |
- name: Check STV-rs output | |
run: | | |
target/release/stv-rs --arithmetic fixed9 --input testdata/ballots/${{ matrix.file }}.blt meek --parallel=${{ matrix.parallel }} --force-positive-surplus | diff -s testdata/meek/${{ matrix.file }}.fixed9.log - | |
- name: Check STV-rs output (equalized counting) | |
run: | | |
target/release/stv-rs --arithmetic fixed9 --input testdata/ballots/${{ matrix.file }}.blt meek --parallel=${{ matrix.parallel }} --force-positive-surplus --equalize | diff -s testdata/meek/${{ matrix.file }}.equalize.fixed9.log - | |
crash_approx_tests: | |
needs: build | |
strategy: | |
matrix: | |
file: | |
- crashes/elect_too_many | |
parallel: | |
- false | |
- true | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build-artifacts | |
path: target/release/ | |
- name: Prepare STV-rs binary | |
run: chmod +x target/release/stv-rs | |
- name: Check STV-rs output | |
run: | | |
target/release/stv-rs --arithmetic approx --input testdata/ballots/${{ matrix.file }}.blt meek --parallel=${{ matrix.parallel }} | diff -s testdata/meek/${{ matrix.file }}.approx.log - | |
- name: Check STV-rs output (equalized counting) | |
run: | | |
target/release/stv-rs --arithmetic approx --input testdata/ballots/${{ matrix.file }}.blt meek --parallel=${{ matrix.parallel }} --equalize | diff -s testdata/meek/${{ matrix.file }}.equalize.approx.log - | |
crash_droop_tests: | |
strategy: | |
matrix: | |
file: | |
- crashes/crash | |
- crashes/elect_too_many | |
- crashes/minimal | |
- crashes/minimal10 | |
- crashes/rand_geometric | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Droop | |
run: git clone https://github.com/jklundell/droop | |
- name: Check that Droop fails | |
run: | | |
python3 droop/Droop.py meek fixed precision=9 omega=6 defeat_batch=none testdata/ballots/${{ matrix.file }}.blt > droop.log 2> droop.err || true | |
diff -s testdata/meek/${{ matrix.file }}.droop.err droop.err | |
echo -n "" | diff -s - droop.log |