Skip to content

Commit

Permalink
Port AppVeyor CI tests to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Sep 11, 2023
1 parent 6c98518 commit 0558f6d
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 248 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# These tests benchmark the current code against the previous release
# using both the GCC and Clang compilers. If the new code runs slower
# than the previous release then the tests fail. This helps to detect
# performance regressions.

name: benchmark

on:
push:
branches-ignore:
- backup3
- gh-pages
pull_request:
branches-ignore:
- backup3
- gh-pages

jobs:
linux_gcc_performance_test:
runs-on: ubuntu-latest
env:
CC: gcc
CXX: g++
steps:
- uses: actions/checkout@v3
with:
# Fetch all commits & tags
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt update
sudo apt install bc
- name: Benchmark latest code vs. previous release
run: scripts/./benchmark-vs-prev-release.sh

linux_clang_performance_test:
runs-on: ubuntu-latest
env:
CC: clang
CXX: clang++
steps:
- uses: actions/checkout@v3
with:
# Fetch all commits & tags
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt update
sudo apt install bc libomp-dev
- name: Benchmark latest code vs. previous release
run: scripts/./benchmark-vs-prev-release.sh
177 changes: 117 additions & 60 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ on:
jobs:
# See documentation: https://www.msys2.org/docs/ci/
windows_mingw64:
runs-on: windows-latest
strategy:
matrix:
platform: ['windows-latest']
config: ['Debug', 'Release']
runs-on: ${{ matrix.platform }}
defaults:
run:
shell: msys2 {0}
Expand All @@ -25,7 +29,7 @@ jobs:
install: base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
- name: Build primecount
run: |
cmake . -G "Unix Makefiles" -DBUILD_TESTS=ON -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror"
cmake . -G "Unix Makefiles" -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=$CONFIGURATION -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror"
grep "^OpenMP:INTERNAL=1$" CMakeCache.txt
grep "^int128.*:INTERNAL=1$" CMakeCache.txt
grep "^cpu_supports_popcnt:INTERNAL=1$" CMakeCache.txt
Expand All @@ -34,64 +38,151 @@ jobs:
run: ctest -j2
- name: primecount --test option
run: ./primecount --test
- name: primecount --test
run: ./primecount --test
- name: primecount 1e11 --legendre
run: ./primecount 1e11 --legendre
- name: primecount 1e12 --meissel
run: ./primecount 1e12 --meissel
- name: primecount 1e11 --lehmer
run: ./primecount 1e11 --lehmer
- name: primecount 1e12 --lmo
run: ./primecount 1e12 --lmo
- name: primecount 1e13 --deleglise-rivat
run: ./primecount 1e13 --deleglise-rivat
- name: primecount 1e14 --gourdon
run: ./primecount 1e14 --gourdon

windows_msvc2022:
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
- name: Build primecount
run: |
cmake . -G "Visual Studio 17 2022" -DBUILD_TESTS=ON
cmake --build . --config Release --target install
- name: CTest (unit tests)
run: ctest -j2 -C Release --output-on-failure
- name: primecount --test
run: Release\primecount.exe --test
- name: primecount 1e11 --legendre
run: Release\primecount.exe 1e11 --legendre
- name: primecount 1e12 --meissel
run: Release\primecount.exe 1e12 --meissel
- name: primecount 1e11 --lehmer
run: Release\primecount.exe 1e11 --lehmer
- name: primecount 1e12 --lmo
run: Release\primecount.exe 1e12 --lmo
- name: primecount 1e13 --deleglise-rivat
run: Release\primecount.exe 1e13 --deleglise-rivat
- name: primecount 1e14 --gourdon
run: Release\primecount.exe 1e14 --gourdon

linux_gcc:
runs-on: ubuntu-latest
strategy:
matrix:
platform: ['ubuntu-latest']
config: ['Debug', 'Release']
runs-on: ${{ matrix.platform }}
env:
CC: gcc
CXX: g++
CONFIGURATION: ${{ matrix.config }}
steps:
- uses: actions/checkout@v3
- name: Install valgrind
run: |
sudo apt update
sudo apt install valgrind
- name: Build primecount
# POPCNT disabled + Debug
run: |
cmake . -DBUILD_TESTS=ON -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror"
cmake . -DWITH_POPCNT=OFF -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=$CONFIGURATION
grep "^OpenMP:INTERNAL=1$" CMakeCache.txt
grep "^int128.*:INTERNAL=1$" CMakeCache.txt
grep "^cpu_supports_popcnt:INTERNAL=1$" CMakeCache.txt
grep "^WITH_POPCNT:BOOL=OFF$" CMakeCache.txt
make -j8 VERBOSE=1
- name: CTest (unit tests)
run: ctest -j2
- name: primecount --test
run: ./primecount --test
- name: primecount 1e11 --legendre
run: ./primecount 1e11 --legendre
- name: primecount 1e12 --meissel
run: ./primecount 1e12 --meissel
- name: primecount 1e11 --lehmer
run: ./primecount 1e11 --lehmer
- name: primecount 1e12 --lmo
run: ./primecount 1e12 --lmo
- name: primecount 1e13 --deleglise-rivat
run: ./primecount 1e13 --deleglise-rivat
- name: primecount 1e14 --gourdon
run: ./primecount 1e14 --gourdon

linux_gcc_sanitizers:
runs-on: ubuntu-latest
env:
CC: gcc
CXX: g++
steps:
- uses: actions/checkout@v3
- name: Build primecount
run: |
cmake . -DBUILD_TESTS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror -Wno-long-long -O1 -g -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer"
make -j2 VERBOSE=1
- name: CTest (unit tests)
run: ctest -j2
- name: primecount --test option
- name: primecount --test
run: ./primecount --test
- name: Valgrind legendre test
run: valgrind --error-exitcode=1 ./primecount 1e11 --legendre
- name: Valgrind meissel test
run: valgrind --error-exitcode=1 ./primecount 1e12 --meissel
- name: Valgrind lehmer test
run: valgrind --error-exitcode=1 ./primecount 1e11 --lehmer
- name: Valgrind lmo test
run: valgrind --error-exitcode=1 ./primecount 1e12 --lmo
- name: Valgrind deleglise-rivat test
run: valgrind --error-exitcode=1 ./primecount 1e13 --deleglise-rivat
- name: Valgrind gourdon test
run: valgrind --error-exitcode=1 ./primecount 1e14 --gourdon
- name: primecount 1e11 --legendre
run: ./primecount 1e11 --legendre
- name: primecount 1e12 --meissel
run: ./primecount 1e12 --meissel
- name: primecount 1e11 --lehmer
run: ./primecount 1e11 --lehmer
- name: primecount 1e12 --lmo
run: ./primecount 1e12 --lmo
- name: primecount 1e13 --deleglise-rivat
run: ./primecount 1e13 --deleglise-rivat
- name: primecount 1e14 --gourdon
run: ./primecount 1e14 --gourdon

linux_clang:
runs-on: ubuntu-latest
strategy:
matrix:
platform: ['ubuntu-latest']
config: ['Debug', 'Release']
runs-on: ${{ matrix.platform }}
env:
CC: clang
CXX: clang++
CONFIGURATION: ${{ matrix.config }}
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt update
sudo apt install libomp-dev
sudo apt install libomp-dev asciidoc libxml2-utils xmlto
- name: Build primecount
# POPCNT disabled + Debug
run: |
cmake . -DBUILD_TESTS=ON -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror"
cmake . -DBUILD_TESTS=ON -DBUILD_MANPAGE=ON -DCMAKE_BUILD_TYPE=$CONFIGURATION -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror"
grep "^OpenMP.*:INTERNAL=1$" CMakeCache.txt
grep "^int128.*:INTERNAL=1$" CMakeCache.txt
grep "^cpu_supports_popcnt:INTERNAL=1$" CMakeCache.txt
make -j2 VERBOSE=1
- name: CTest (unit tests)
run: ctest -j2
- name: primecount --test option
- name: primecount --test
run: ./primecount --test
- name: primecount 1e11 --legendre
run: ./primecount 1e11 --legendre
- name: primecount 1e12 --meissel
run: ./primecount 1e12 --meissel
- name: primecount 1e11 --lehmer
run: ./primecount 1e11 --lehmer
- name: primecount 1e12 --lmo
run: ./primecount 1e12 --lmo
- name: primecount 1e13 --deleglise-rivat
run: ./primecount 1e13 --deleglise-rivat
- name: primecount 1e14 --gourdon
run: ./primecount 1e14 --gourdon

linux_128bit:
runs-on: ubuntu-latest
Expand All @@ -110,37 +201,3 @@ jobs:
run: |
./primecount 1e20 -s | tee primecount-1e20.log
grep 2220819602560918840 primecount-1e20.log
linux_gcc_performance_test:
runs-on: ubuntu-latest
env:
CC: gcc
CXX: g++
steps:
- uses: actions/checkout@v3
with:
# Fetch all commits & tags
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt update
sudo apt install bc
- name: Benchmark latest code vs. previous release
run: scripts/./benchmark-vs-prev-release.sh

linux_clang_performance_test:
runs-on: ubuntu-latest
env:
CC: clang
CXX: clang++
steps:
- uses: actions/checkout@v3
with:
# Fetch all commits & tags
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt update
sudo apt install bc libomp-dev
- name: Benchmark latest code vs. previous release
run: scripts/./benchmark-vs-prev-release.sh
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# primecount

[![Build status](https://github.com/kimwalisch/primecount/actions/workflows/ci.yml/badge.svg)](https://github.com/kimwalisch/primecount/actions/workflows/ci.yml) [![Build Status](https://ci.appveyor.com/api/projects/status/github/kimwalisch/primecount?branch=master&svg=true)](https://ci.appveyor.com/project/kimwalisch/primecount)
[![Build status](https://github.com/kimwalisch/primecount/actions/workflows/ci.yml/badge.svg)](https://github.com/kimwalisch/primecount/actions/workflows/ci.yml) [![Build status](https://github.com/kimwalisch/primecount/actions/workflows/benchmark.yml/badge.svg)](https://github.com/kimwalisch/primecount/actions/workflows/benchmark.yml)
[![Github Releases](https://img.shields.io/github/release/kimwalisch/primecount.svg)](https://github.com/kimwalisch/primecount/releases)

primecount is a command-line program and [C/C++ library](doc/libprimecount.md)
Expand Down
Loading

0 comments on commit 0558f6d

Please sign in to comment.