2020-06-19 20:08:15 +00:00
|
|
|
name: Constantine CI
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
max-parallel: 20
|
|
|
|
matrix:
|
2022-09-15 15:11:57 +00:00
|
|
|
nim_version: [version-1-6] # [version-1-4, devel]
|
2020-06-19 20:08:15 +00:00
|
|
|
target:
|
|
|
|
- os: linux
|
|
|
|
cpu: amd64
|
|
|
|
TEST_LANG: c
|
2021-02-10 21:21:02 +00:00
|
|
|
BACKEND: NO_ASM
|
2020-06-19 20:08:15 +00:00
|
|
|
- os: linux
|
|
|
|
cpu: i386
|
|
|
|
TEST_LANG: c
|
2021-02-10 21:21:02 +00:00
|
|
|
BACKEND: NO_ASM
|
|
|
|
- os: linux
|
|
|
|
cpu: amd64
|
|
|
|
TEST_LANG: c
|
|
|
|
BACKEND: ASM
|
2022-02-20 22:44:00 +00:00
|
|
|
- os: windows
|
2021-02-10 21:21:02 +00:00
|
|
|
cpu: amd64
|
|
|
|
TEST_LANG: c
|
2022-02-20 22:44:00 +00:00
|
|
|
BACKEND: NO_ASM
|
2021-02-10 21:21:02 +00:00
|
|
|
- os: macos
|
|
|
|
cpu: amd64
|
|
|
|
TEST_LANG: c
|
2022-02-20 22:44:00 +00:00
|
|
|
BACKEND: NO_ASM
|
2021-02-10 21:21:02 +00:00
|
|
|
- os: macos
|
|
|
|
cpu: amd64
|
2022-02-20 22:44:00 +00:00
|
|
|
TEST_LANG: c
|
2021-02-10 21:21:02 +00:00
|
|
|
BACKEND: ASM
|
2020-06-19 20:08:15 +00:00
|
|
|
include:
|
|
|
|
- target:
|
|
|
|
os: linux
|
2022-02-20 22:44:00 +00:00
|
|
|
builder: ubuntu-latest
|
2020-06-19 20:08:15 +00:00
|
|
|
- target:
|
|
|
|
os: macos
|
2022-02-20 22:44:00 +00:00
|
|
|
builder: macos-latest
|
|
|
|
- target:
|
|
|
|
os: windows
|
|
|
|
builder: windows-latest
|
|
|
|
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ matrix.target.TEST_LANG }}-${{ matrix.target.BACKEND }} (${{ matrix.nim_version }})'
|
2020-06-19 20:08:15 +00:00
|
|
|
runs-on: ${{ matrix.builder }}
|
|
|
|
steps:
|
2021-07-25 11:21:38 +00:00
|
|
|
- name: Get branch name
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
if [[ '${{ github.event_name }}' == 'pull_request' ]]; then
|
|
|
|
echo "##[set-output name=branch_name;]$(echo ${GITHUB_HEAD_REF})"
|
|
|
|
echo "Branch found (PR): ${GITHUB_HEAD_REF}"
|
|
|
|
else
|
|
|
|
echo "##[set-output name=branch_name;]$(echo ${GITHUB_REF#refs/heads/})"
|
|
|
|
echo "Branch found (not PR): ${GITHUB_REF#refs/heads/}"
|
|
|
|
fi
|
|
|
|
id: get_branch
|
|
|
|
|
|
|
|
- name: Cancel Previous Runs (except master)
|
|
|
|
if: >
|
|
|
|
steps.get_branch.outputs.branch_name != 'master'
|
2020-09-21 21:24:00 +00:00
|
|
|
uses: styfle/cancel-workflow-action@0.5.0
|
|
|
|
with:
|
|
|
|
access_token: ${{ github.token }}
|
|
|
|
|
2020-06-19 20:08:15 +00:00
|
|
|
- name: Checkout constantine
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
path: constantine
|
|
|
|
|
2022-02-20 22:44:00 +00:00
|
|
|
- name: Restore MinGW-W64 (Windows) from cache
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
id: windows-mingw-cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: external/mingw-${{ matrix.target.cpu }}
|
|
|
|
key: 'mingw-${{ matrix.target.cpu }}'
|
|
|
|
- name: Restore Nim DLLs dependencies (Windows) from cache
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
id: windows-dlls-cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: external/dlls-${{ matrix.target.cpu }}
|
|
|
|
key: 'dlls-${{ matrix.target.cpu }}'
|
|
|
|
- name: Install MinGW64 dependency (Windows)
|
|
|
|
if: >
|
|
|
|
steps.windows-mingw-cache.outputs.cache-hit != 'true' &&
|
|
|
|
runner.os == 'Windows'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mkdir -p external
|
|
|
|
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
|
|
|
|
MINGW_URL="https://github.com/brechtsanders/winlibs_mingw/releases/download/11.1.0-12.0.0-9.0.0-r2/winlibs-x86_64-posix-seh-gcc-11.1.0-mingw-w64-9.0.0-r2.7z"
|
|
|
|
ARCH=64
|
|
|
|
else
|
|
|
|
MINGW_URL="https://github.com/brechtsanders/winlibs_mingw/releases/download/11.1.0-12.0.0-9.0.0-r2/winlibs-i686-posix-dwarf-gcc-11.1.0-mingw-w64-9.0.0-r2.7z"
|
|
|
|
ARCH=32
|
|
|
|
fi
|
|
|
|
curl -L "$MINGW_URL" -o "external/mingw-${{ matrix.target.cpu }}.7z"
|
|
|
|
7z x -y "external/mingw-${{ matrix.target.cpu }}.7z" -oexternal/
|
|
|
|
mv external/mingw$ARCH external/mingw-${{ matrix.target.cpu }}
|
|
|
|
- name: Install DLLs dependencies (Windows)
|
|
|
|
if: >
|
|
|
|
steps.windows-dlls-cache.outputs.cache-hit != 'true' &&
|
|
|
|
runner.os == 'Windows'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mkdir -p external
|
|
|
|
curl -L "https://nim-lang.org/download/windeps.zip" -o external/windeps.zip
|
|
|
|
7z x -y external/windeps.zip -oexternal/dlls-${{ matrix.target.cpu }}
|
|
|
|
- name: Path to cached dependencies (Windows)
|
|
|
|
if: >
|
|
|
|
runner.os == 'Windows'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo '${{ github.workspace }}'"/external/mingw-${{ matrix.target.cpu }}/bin" >> $GITHUB_PATH
|
|
|
|
echo '${{ github.workspace }}'"/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH
|
2022-09-15 07:33:34 +00:00
|
|
|
|
2022-02-20 22:44:00 +00:00
|
|
|
- name: Restore Nim from cache
|
2022-09-15 07:33:34 +00:00
|
|
|
if: matrix.nim_version != 'devel'
|
2022-02-20 22:44:00 +00:00
|
|
|
id: nim-compiler-cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: '${{ github.workspace }}/nim-${{ matrix.nim_version }}-${{ matrix.target.cpu }}'
|
|
|
|
key: 'nim-${{ matrix.target.cpu }}-${{ matrix.nim_version }}'
|
|
|
|
|
|
|
|
- name: Setup Nim
|
2022-09-15 07:33:34 +00:00
|
|
|
if: steps.nim-compiler-cache.outputs.cache-hit != 'true'
|
2022-02-20 22:44:00 +00:00
|
|
|
uses: alaviss/setup-nim@0.1.1
|
|
|
|
with:
|
2022-09-15 07:33:34 +00:00
|
|
|
path: 'nim-${{ matrix.nim_version }}-${{ matrix.target.cpu }}'
|
2022-02-20 22:44:00 +00:00
|
|
|
version: ${{ matrix.nim_version }}
|
|
|
|
architecture: ${{ matrix.target.cpu }}
|
2022-09-15 07:33:34 +00:00
|
|
|
add-to-path: false
|
|
|
|
|
|
|
|
- name: Path to cached Nim
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo '${{ github.workspace }}'"/nim-${{ matrix.nim_version }}-${{ matrix.target.cpu }}/bin" >> $GITHUB_PATH
|
|
|
|
echo '${{ github.workspace }}'"/.nimble/bin" >> $GITHUB_PATH
|
2022-02-20 22:44:00 +00:00
|
|
|
|
2022-09-15 07:33:34 +00:00
|
|
|
- name: Install test dependencies (Linux amd64)
|
2020-06-20 17:46:30 +00:00
|
|
|
if: runner.os == 'Linux' && matrix.target.cpu == 'amd64'
|
|
|
|
run: |
|
|
|
|
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
|
2022-02-20 22:44:00 +00:00
|
|
|
--no-install-recommends -yq \
|
|
|
|
libgmp-dev
|
2020-06-19 20:08:15 +00:00
|
|
|
|
2022-09-15 07:33:34 +00:00
|
|
|
- name: Install test dependencies (Linux i386)
|
2020-06-19 20:08:15 +00:00
|
|
|
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
|
|
|
|
run: |
|
|
|
|
sudo dpkg --add-architecture i386
|
|
|
|
sudo apt-fast update -qq
|
|
|
|
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
|
2022-02-20 22:44:00 +00:00
|
|
|
--no-install-recommends -yq \
|
|
|
|
gcc-multilib g++-multilib \
|
2020-06-20 17:46:30 +00:00
|
|
|
libssl-dev:i386 libgmp-dev:i386
|
2022-02-20 22:44:00 +00:00
|
|
|
|
2020-06-19 20:08:15 +00:00
|
|
|
mkdir -p external/bin
|
|
|
|
cat << EOF > external/bin/gcc
|
|
|
|
#!/bin/bash
|
|
|
|
exec $(which gcc) -m32 "\$@"
|
|
|
|
EOF
|
|
|
|
cat << EOF > external/bin/g++
|
|
|
|
#!/bin/bash
|
|
|
|
exec $(which g++) -m32 "\$@"
|
|
|
|
EOF
|
2022-09-15 07:33:34 +00:00
|
|
|
chmod 755 external/bin/{gcc,g++}
|
2020-12-13 14:28:51 +00:00
|
|
|
echo '${{ github.workspace }}/external/bin' >> $GITHUB_PATH
|
2020-06-20 17:46:30 +00:00
|
|
|
|
2022-09-15 07:33:34 +00:00
|
|
|
- name: Install test dependencies (macOS)
|
2020-06-20 17:46:30 +00:00
|
|
|
if: runner.os == 'macOS'
|
2022-09-15 07:33:34 +00:00
|
|
|
run: brew install gmp
|
2020-06-19 20:08:15 +00:00
|
|
|
|
2022-02-20 22:44:00 +00:00
|
|
|
- name: Setup MSYS2 (Windows)
|
2020-06-19 20:08:15 +00:00
|
|
|
if: runner.os == 'Windows'
|
2022-02-20 22:44:00 +00:00
|
|
|
uses: msys2/setup-msys2@v2
|
2020-06-19 20:08:15 +00:00
|
|
|
with:
|
2022-02-20 22:44:00 +00:00
|
|
|
path-type: inherit
|
2022-09-15 07:33:34 +00:00
|
|
|
update: false
|
2022-02-20 22:44:00 +00:00
|
|
|
install: base-devel git mingw-w64-x86_64-toolchain
|
2020-06-19 20:08:15 +00:00
|
|
|
|
2022-09-15 07:33:34 +00:00
|
|
|
- name: Install test dependencies (Windows)
|
2022-02-20 22:44:00 +00:00
|
|
|
if: runner.os == 'Windows'
|
|
|
|
shell: msys2 {0}
|
2020-06-19 20:08:15 +00:00
|
|
|
run: |
|
2022-02-20 22:44:00 +00:00
|
|
|
pacman -S --needed --noconfirm mingw-w64-x86_64-gmp
|
2022-09-15 07:33:34 +00:00
|
|
|
nimble refresh --verbose -y
|
2023-01-12 19:25:57 +00:00
|
|
|
nimble install --verbose -y gmp jsony asynctools
|
2022-02-20 22:44:00 +00:00
|
|
|
|
2020-06-19 20:08:15 +00:00
|
|
|
- name: Install test dependencies
|
2022-02-20 22:44:00 +00:00
|
|
|
if: runner.os != 'Windows'
|
2020-06-19 20:08:15 +00:00
|
|
|
shell: bash
|
|
|
|
run: |
|
2022-09-15 07:33:34 +00:00
|
|
|
nimble refresh --verbose -y
|
2023-01-12 19:25:57 +00:00
|
|
|
nimble install --verbose -y gmp jsony asynctools
|
2022-02-20 22:44:00 +00:00
|
|
|
|
2022-09-15 15:11:57 +00:00
|
|
|
- name: Run Constantine tests (UNIX with Assembly)
|
2022-09-15 07:33:34 +00:00
|
|
|
if: runner.os != 'Windows' && matrix.target.BACKEND == 'ASM'
|
2020-06-19 20:08:15 +00:00
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
cd constantine
|
2022-09-15 15:11:57 +00:00
|
|
|
nimble bindings --verbose
|
|
|
|
nimble test_bindings --verbose
|
2022-09-15 07:33:34 +00:00
|
|
|
nimble test_parallel --verbose
|
2022-09-15 15:11:57 +00:00
|
|
|
- name: Run Constantine tests (UNIX no Assembly)
|
2022-09-15 07:33:34 +00:00
|
|
|
if: runner.os != 'Windows' && matrix.target.BACKEND == 'NO_ASM'
|
2020-09-21 21:24:00 +00:00
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
cd constantine
|
2022-09-15 15:11:57 +00:00
|
|
|
nimble bindings --verbose
|
|
|
|
nimble test_bindings --verbose
|
2022-09-15 07:33:34 +00:00
|
|
|
nimble test_parallel_no_asm --verbose
|
2022-09-15 15:11:57 +00:00
|
|
|
- name: Run Constantine tests (Windows no Assembly)
|
2022-09-19 00:02:04 +00:00
|
|
|
# So "test_bindings" uses C and can find GMP
|
|
|
|
# but nim-gmp cannot find GMP on Windows CI
|
2022-09-15 07:33:34 +00:00
|
|
|
if: runner.os == 'Windows' && matrix.target.BACKEND == 'NO_ASM'
|
2022-02-20 22:44:00 +00:00
|
|
|
shell: msys2 {0}
|
|
|
|
run: |
|
|
|
|
cd constantine
|
2022-09-19 00:02:04 +00:00
|
|
|
nimble bindings --verbose
|
|
|
|
nimble test_bindings --verbose
|
|
|
|
nimble test_parallel_no_gmp_no_asm --verbose
|