From b803b54179c1cea9091d9331cc8085fc235e1be4 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Wed, 11 Aug 2021 20:59:27 -0400 Subject: [PATCH] Use Github Actions for some CI (#1069) * Disable other CI's on ghactionsonly- branches * Stylecheck in Github Actions * Add runs-on * Add buildcheck in Github Actions * Typo * Debugging * Debugging environment variables * More debugging * Add alpine job in Github Actions * Debugging * Debugging * More debugging * Add alpine-noopenssl job in Github Actions * Alpine as a strategy matrix * Debugging strategy matrix * Reorganize strategy matrix * Add ARM emulated job in Github Actions * Finalize initial move to Github Actions * Skip alg info test on ARM emulated --- .circleci/config.yml | 101 ++---------------------------- .github/workflows/linux.yml | 121 ++++++++++++++++++++++++++++++++++++ .travis.yml | 1 + appveyor.yml | 1 + 4 files changed, 128 insertions(+), 96 deletions(-) create mode 100644 .github/workflows/linux.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index 615f5f54b1..5051a4f895 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -118,56 +118,6 @@ jobs: - store_artifacts: path: build/test-results - arm_emulated: - description: A template for running liboqs tests on emulated ARM Docker VMs - parameters: - ARCH: - description: "The desired ARM architecture to be emulated." - type: string - CMAKE_ARGS: - description: "Arguments to pass to CMake." - type: string - PYTEST_ARGS: - description: "Arguments to pass to pytest." - type: string - machine: - image: ubuntu-1604:201903-01 - steps: - - checkout - - run: - name: Install the emulation handlers - command: docker run --rm --privileged multiarch/qemu-user-static:register --reset - - run: - name: Build in an x86_64 container - command: |2 - docker run --rm \ - -v `pwd`:`pwd` \ - -w `pwd` \ - openquantumsafe/ci-debian-buster-amd64:latest /bin/bash \ - -c "mkdir build && \ - (cd build && \ - cmake .. -GNinja << parameters.CMAKE_ARGS >> \ - -DCMAKE_TOOLCHAIN_FILE=../.CMake/toolchain_<< parameters.ARCH >>.cmake && \ - cmake -LA .. && \ - ninja)" - - run: - name: Run the tests in an << parameters.ARCH >> container - command: |2 - docker run --rm -e SKIP_TESTS=style,mem_kem,mem_sig \ - -v `pwd`:`pwd` \ - -w `pwd` \ - openquantumsafe/ci-debian-buster-<< parameters.ARCH >>:latest /bin/bash \ - -c "mkdir -p tmp && \ - python3 -m pytest --verbose \ - --numprocesses=auto \ - << parameters.PYTEST_ARGS >> \ - --ignore=tests/test_code_conventions.py \ - --junitxml=build/test-results/pytest/test-results.xml" - - store_test_results: - path: build/test-results - - store_artifacts: - path: build/test-results - arm_machine: description: A template for running liboqs tests on ARM(presently only 64) machines parameters: @@ -322,8 +272,11 @@ workflows: version: 2.1 build: when: - not: - equal: [ main, << pipeline.git.branch >> ] + and: + - not: + equal: [ main, << pipeline.git.branch >> ] + - not: + matches: { pattern: "^ghactionsonly-.*", value: << pipeline.git.branch >> } jobs: - stylecheck - buildcheck: @@ -336,20 +289,6 @@ workflows: #- testapproval: # <<: *require_buildcheck # type: approval - - linux_oqs: - <<: *require_buildcheck - name: alpine-noopenssl - context: openquantumsafe - CONTAINER: openquantumsafe/ci-alpine-amd64:latest - CMAKE_ARGS: -DOQS_USE_OPENSSL=OFF - PYTEST_ARGS: --ignore=tests/test_alg_info.py - - linux_oqs: - <<: *require_buildcheck - name: alpine - context: openquantumsafe - CONTAINER: openquantumsafe/ci-alpine-amd64:latest - CMAKE_ARGS: -DOQS_USE_OPENSSL=ON -DBUILD_SHARED_LIBS=ON - PYTEST_ARGS: --ignore=tests/test_alg_info.py # Disabling centos-8 and debian-buster. # Re-enable if specific configurations (package versions etc) that need to be tested are identified. #- linux_oqs: @@ -382,17 +321,6 @@ workflows: context: openquantumsafe CONTAINER: openquantumsafe/ci-ubuntu-focal-x86_64:latest CMAKE_ARGS: -DCMAKE_C_COMPILER=clang-9 - - linux_oqs: - <<: *require_buildcheck - name: address-sanitizer - context: openquantumsafe - filters: - branches: - only: - - /^audit.*/ - CONTAINER: openquantumsafe/ci-ubuntu-focal-x86_64:latest - CMAKE_ARGS: -DCMAKE_C_COMPILER=clang-9 -DCMAKE_BUILD_TYPE=Debug -DUSE_SANITIZER=Address - PYTEST_ARGS: --ignore=tests/test_portability.py --numprocesses=auto --maxprocesses=10 - linux_oqs: <<: *require_buildcheck name: ubuntu-bionic-i386 @@ -433,30 +361,11 @@ workflows: # PYTEST_ARGS: --numprocesses=1 # SPHINCS exhausts memory on CircleCI servers # for these configurations. - # don't run ARM64 emulated any more: - #- arm_emulated: - # <<: *require_buildcheck - # name: arm64 - # ARCH: arm64 - # CMAKE_ARGS: -DOQS_ENABLE_SIG_SPHINCS=OFF -DOQS_DIST_BUILD=ON - arm_machine: <<: *require_buildcheck name: arm64 PYTEST_ARGS: --numprocesses=auto --maxprocesses=10 CMAKE_ARGS: -DOQS_DIST_BUILD=ON - - arm_emulated: - <<: *require_buildcheck - name: armhf - ARCH: armhf - CMAKE_ARGS: -DOQS_ENABLE_SIG_SPHINCS=OFF -DOQS_USE_OPENSSL=OFF -DOQS_OPT_TARGET=generic - PYTEST_ARGS: --ignore=tests/test_alg_info.py - # Disabling armel - #- arm_emulated: - # <<: *require_buildcheck - # name: armel - # ARCH: armel - # CMAKE_ARGS: -DOQS_ENABLE_SIG_SPHINCS=OFF -DOQS_USE_OPENSSL=OFF -DOQS_OPT_TARGET=generic - - macOS: <<: *require_buildcheck name: macOS-noopenssl diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000000..0db6e00802 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,121 @@ +name: Linux tests + +on: [push] + +jobs: + + stylecheck: + name: Check code formatting + container: openquantumsafe/ci-ubuntu-focal-x86_64:latest + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Ensure code conventions are upheld + run: python3 -m pytest --verbose tests/test_code_conventions.py + - name: Check that doxygen can parse the documentation + run: mkdir -p build/docs && doxygen docs/.Doxyfile + + buildcheck: + name: Check that code passes a basic build before starting heavier tests + container: openquantumsafe/ci-ubuntu-focal-x86_64:latest + needs: stylecheck + runs-on: ubuntu-latest + env: + KEM_NAME: kyber_768 + SIG_NAME: dilithium_3 + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Configure + run: | + mkdir build && \ + cd build && \ + cmake .. --warn-uninitialized \ + -GNinja \ + -DOQS_MINIMAL_BUILD="OQS_ENABLE_KEM_$KEM_NAME;OQS_ENABLE_SIG_$SIG_NAME" \ + > config.log 2>&1 && \ + cat config.log && \ + cmake -LA .. && \ + ! (grep "uninitialized variable" config.log) + - name: Build + run: ninja + working-directory: build + + linux_intel: + needs: [stylecheck, buildcheck] + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - name: alpine + container: openquantumsafe/ci-alpine-amd64:latest + CMAKE_ARGS: -DOQS_USE_OPENSSL=ON -DBUILD_SHARED_LIBS=ON + PYTEST_ARGS: --ignore=tests/test_alg_info.py + - name: alpine-noopenssl + container: openquantumsafe/ci-alpine-amd64:latest + CMAKE_ARGS: -DOQS_USE_OPENSSL=OFF + PYTEST_ARGS: --ignore=tests/test_alg_info.py + # disabled until #1067 lands + # - name: address-sanitizer + # container: openquantumsafe/ci-ubuntu-focal-x86_64:latest + # CMAKE_ARGS: -DCMAKE_C_COMPILER=clang-9 -DCMAKE_BUILD_TYPE=Debug -DUSE_SANITIZER=Address + # PYTEST_ARGS: --ignore=tests/test_portability.py --numprocesses=auto --maxprocesses=10 + container: + image: ${{ matrix.container }} + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Configure + run: mkdir build && cd build && cmake -GNinja ${{ matrix.CMAKE_ARGS }} .. && cmake -LA .. + - name: Build + run: ninja + working-directory: build + - name: Run tests + timeout-minutes: 60 + run: mkdir -p tmp && python3 -m pytest --verbose --ignore=tests/test_code_conventions.py ${{ matrix.PYTEST_ARGS }} + + linux_arm_emulated: + needs: [stylecheck, buildcheck] + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - name: armhf + ARCH: armhf + CMAKE_ARGS: -DOQS_ENABLE_SIG_SPHINCS=OFF -DOQS_USE_OPENSSL=OFF -DOQS_OPT_TARGET=generic + PYTEST_ARGS: --ignore=tests/test_alg_info.py + # no longer supporting armel + # - name: armel + # ARCH: armel + # CMAKE_ARGS: -DOQS_ENABLE_SIG_SPHINCS=OFF -DOQS_USE_OPENSSL=OFF -DOQS_OPT_TARGET=generic + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Install the emulation handlers + run: docker run --rm --privileged multiarch/qemu-user-static:register --reset + - name: Build in an x86_64 container + run: | + docker run --rm \ + -v `pwd`:`pwd` \ + -w `pwd` \ + openquantumsafe/ci-debian-buster-amd64:latest /bin/bash \ + -c "mkdir build && \ + (cd build && \ + cmake .. -GNinja ${{ matrix.CMAKE_ARGS }} \ + -DCMAKE_TOOLCHAIN_FILE=../.CMake/toolchain_${{ matrix.ARCH }}.cmake && \ + cmake -LA .. && \ + ninja)" + - name: Run the tests in an ${{ matrix.ARCH }} container + timeout-minutes: 60 + run: | + docker run --rm -e SKIP_TESTS=style,mem_kem,mem_sig \ + -v `pwd`:`pwd` \ + -w `pwd` \ + openquantumsafe/ci-debian-buster-${{ matrix.ARCH }}:latest /bin/bash \ + -c "mkdir -p tmp && \ + python3 -m pytest --verbose \ + --numprocesses=auto \ + --ignore=tests/test_code_conventions.py ${{ matrix.PYTEST_ARGS }}" diff --git a/.travis.yml b/.travis.yml index da1053d3b9..e7b4c5da7b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ jobs: os: linux # required for arch different than amd64 dist: focal # or bionic | xenial with xenial as default compiler: gcc + if: NOT branch =~ /^ghactionsonly-/ script: - mkdir build && cd build && cmake -GNinja .. && cmake -LA .. && ninja - cd build & ninja run_tests diff --git a/appveyor.yml b/appveyor.yml index f00bcc563d..04ef0ba15f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,6 +8,7 @@ platform: x64 branches: except: - /main-new-.*/ + - /ghactionsonly-.*/ environment: matrix: