Use GMP and GNU parallel in GIthub Actions (#63)

* Use GMP and GNU parallel in GIthub Actions

* try gmp:i386

* Don't do GMP tests on i386
This commit is contained in:
Mamy Ratsimbazafy 2020-06-20 19:46:30 +02:00 committed by GitHub
parent e491f3b91d
commit 0400187f05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 66 additions and 11 deletions

View File

@ -60,11 +60,11 @@ jobs:
with: with:
path: constantine path: constantine
# - name: Install dependencies (Linux amd64) - name: Install dependencies (Linux amd64)
# if: runner.os == 'Linux' && matrix.target.cpu == 'amd64' if: runner.os == 'Linux' && matrix.target.cpu == 'amd64'
# run: | run: |
# sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \ sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
# --no-install-recommends -yq <packages here> --no-install-recommends -yq libgmp-dev
- name: Install dependencies (Linux i386) - name: Install dependencies (Linux i386)
if: runner.os == 'Linux' && matrix.target.cpu == 'i386' if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
@ -73,7 +73,7 @@ jobs:
sudo apt-fast update -qq sudo apt-fast update -qq
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \ sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
--no-install-recommends -yq gcc-multilib g++-multilib \ --no-install-recommends -yq gcc-multilib g++-multilib \
libssl-dev:i386 libssl-dev:i386 libgmp-dev:i386
mkdir -p external/bin mkdir -p external/bin
cat << EOF > external/bin/gcc cat << EOF > external/bin/gcc
#!/bin/bash #!/bin/bash
@ -85,9 +85,10 @@ jobs:
EOF EOF
chmod 755 external/bin/gcc external/bin/g++ chmod 755 external/bin/gcc external/bin/g++
echo '::add-path::${{ github.workspace }}/external/bin' echo '::add-path::${{ github.workspace }}/external/bin'
# - name: Install dependencies (macOS)
# if: runner.os == 'macOS' - name: Install dependencies (macOS)
# run: brew install <packages here> if: runner.os == 'macOS'
run: brew install gmp
- name: Install dependencies (Windows) - name: Install dependencies (Windows)
if: runner.os == 'Windows' if: runner.os == 'Windows'
@ -105,6 +106,10 @@ jobs:
7z x external/windeps.zip -oexternal/dlls 7z x external/windeps.zip -oexternal/dlls
echo '::add-path::${{ github.workspace }}'"/external/mingw$arch/bin" echo '::add-path::${{ github.workspace }}'"/external/mingw$arch/bin"
echo '::add-path::${{ github.workspace }}'"/external/dlls" echo '::add-path::${{ github.workspace }}'"/external/dlls"
choco install msys2
pacman -S mingw-w64-x86_64-gmp
- name: Setup environment - name: Setup environment
shell: bash shell: bash
run: echo '::add-path::${{ github.workspace }}/nim/bin' run: echo '::add-path::${{ github.workspace }}/nim/bin'
@ -192,8 +197,17 @@ jobs:
run: | run: |
nimble refresh nimble refresh
nimble install -y gmp stew nimble install -y gmp stew
- name: Run constantine tests (without GMP) - name: Run Constantine tests (with GMP)
if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.target.cpu == 'amd64'
shell: bash shell: bash
run: | run: |
export UCPU="$cpu"
cd constantine cd constantine
nimble test_no_gmp nimble test_parallel
- name: Run Constantine tests (without GMP)
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
shell: bash
run: |
export UCPU="$cpu"
cd constantine
nimble test_parallel_no_gmp

View File

@ -206,6 +206,47 @@ task test_parallel, "Run all tests in parallel (via GNU parallel)":
runBench("bench_ec_g1") runBench("bench_ec_g1")
runBench("bench_ec_g2") runBench("bench_ec_g2")
task test_parallel_no_gmp, "Run all tests in parallel (via GNU parallel)":
# -d:testingCurves is configured in a *.nim.cfg for convenience
let cmdFile = true # open(buildParallel, mode = fmWrite) # Nimscript doesn't support IO :/
exec "> " & buildParallel
for td in testDesc:
if not td.useGMP:
if td.path in useDebug:
test "-d:debugConstantine", td.path, cmdFile
else:
test "", td.path, cmdFile
# cmdFile.close()
# Execute everything in parallel with GNU parallel
exec "parallel --keep-order --group < " & buildParallel
exec "> " & buildParallel
if sizeof(int) == 8: # 32-bit tests on 64-bit arch
for td in testDesc:
if not td.useGMP:
if td.path in useDebug:
test "-d:Constantine32 -d:debugConstantine", td.path, cmdFile
else:
test "-d:Constantine32", td.path, cmdFile
# cmdFile.close()
# Execute everything in parallel with GNU parallel
exec "parallel --keep-order --group < " & buildParallel
# Now run the benchmarks
#
# Benchmarks compile and run
# ignore Windows 32-bit for the moment
# Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment
if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"):
runBench("bench_fp")
runBench("bench_fp2")
runBench("bench_fp6")
runBench("bench_fp12")
runBench("bench_ec_g1")
runBench("bench_ec_g2")
task bench_fp, "Run benchmark 𝔽p with your default compiler": task bench_fp, "Run benchmark 𝔽p with your default compiler":
runBench("bench_fp") runBench("bench_fp")