name: Constantine CI on: [push, pull_request] jobs: build: strategy: fail-fast: false max-parallel: 20 matrix: nim_version: [version-1-4, version-1-6] # [version-1-4, devel] target: - os: linux cpu: amd64 TEST_LANG: c BACKEND: NO_ASM - os: linux cpu: i386 TEST_LANG: c BACKEND: NO_ASM - os: linux cpu: amd64 TEST_LANG: c BACKEND: ASM - os: windows cpu: amd64 TEST_LANG: c BACKEND: NO_ASM - os: macos cpu: amd64 TEST_LANG: c BACKEND: NO_ASM - os: macos cpu: amd64 TEST_LANG: c BACKEND: ASM include: - target: os: linux builder: ubuntu-latest - target: os: macos 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 }})' runs-on: ${{ matrix.builder }} steps: - 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' uses: styfle/cancel-workflow-action@0.5.0 with: access_token: ${{ github.token }} - name: Checkout constantine uses: actions/checkout@v2 with: path: constantine - 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 - name: Restore Nim from cache if: > steps.nim-compiler-cache.outputs.cache-hit != 'true' && matrix.nim_version != 'devel' 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 uses: alaviss/setup-nim@0.1.1 with: path: 'nim' version: ${{ matrix.nim_version }} architecture: ${{ matrix.target.cpu }} - name: Install dependencies (Linux amd64) if: runner.os == 'Linux' && matrix.target.cpu == 'amd64' run: | sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \ --no-install-recommends -yq \ libgmp-dev - name: Install dependencies (Linux i386) 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 \ --no-install-recommends -yq \ gcc-multilib g++-multilib \ libssl-dev:i386 libgmp-dev:i386 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 chmod 755 external/bin/gcc external/bin/g++ echo '${{ github.workspace }}/external/bin' >> $GITHUB_PATH - name: Install dependencies (macOS) if: runner.os == 'macOS' run: brew install gmp parallel - name: Setup MSYS2 (Windows) if: runner.os == 'Windows' uses: msys2/setup-msys2@v2 with: path-type: inherit update: true install: base-devel git mingw-w64-x86_64-toolchain - name: Install dependencies (Windows) if: runner.os == 'Windows' shell: msys2 {0} run: | pacman -S --needed --noconfirm mingw-w64-x86_64-gmp pacman -S --needed --noconfirm parallel nimble refresh -y nimble install -y gmp stew jsony - name: Install test dependencies if: runner.os != 'Windows' shell: bash run: | nimble refresh -y nimble install -y gmp stew jsony - name: Run Constantine tests (with Assembler & with GMP) if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.target.BACKEND == 'ASM' && matrix.target.cpu != 'i386' shell: bash run: | export UCPU="$cpu" cd constantine nimble test_parallel - name: Run Constantine tests (no Assembler & with GMP) if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.target.BACKEND == 'NO_ASM' && matrix.target.cpu != 'i386' shell: bash run: | export UCPU="$cpu" cd constantine nimble test_parallel_no_assembler - name: Run Constantine tests (without GMP) if: runner.os == 'Linux' && matrix.target.BACKEND == 'ASM' && matrix.target.cpu == 'i386' shell: bash run: | export UCPU="$cpu" cd constantine nimble test_parallel_no_gmp - name: Run Constantine tests (without Assembler or GMP) if: runner.os == 'Linux' && matrix.target.BACKEND == 'NO_ASM' && matrix.target.cpu == 'i386' shell: bash run: | export UCPU="$cpu" cd constantine nimble test_parallel_no_gmp_no_assembler - name: Run Constantine tests (Windows - without Assembler or GMP) # TODO, why aren't GMP or parallel in path? if: runner.os == 'Windows' shell: msys2 {0} run: | export UCPU="$cpu" cd constantine nimble test_no_gmp_no_assembler