From d6347e8a579a13fe9225378a9ed43fb37c3c22f7 Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Fri, 29 Oct 2021 12:46:19 -0600 Subject: [PATCH] reverting to 1.4.6 as otherwise it fails on amd64 --- .github/workflows/ci.yml | 91 +++++++++++++++++++++++++++++++--------- 1 file changed, 72 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 048167ee..151fb9d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,42 +7,45 @@ jobs: fail-fast: false max-parallel: 20 matrix: + branch: [v1.4.6] target: # Unit tests - os: linux cpu: amd64 + TEST_KIND: unit-tests - os: linux cpu: i386 + TEST_KIND: unit-tests - os: macos cpu: amd64 + TEST_KIND: unit-tests - os: windows cpu: i386 + TEST_KIND: unit-tests - os: windows cpu: amd64 + TEST_KIND: unit-tests include: - target: os: linux - builder: ubuntu-20.04 + builder: ubuntu-18.04 - target: os: macos builder: macos-10.15 - target: os: windows builder: windows-2019 - - defaults: - run: - shell: bash - - name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}' + name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (${{ matrix.branch }})' runs-on: ${{ matrix.builder }} steps: - name: Checkout nim-dagger uses: actions/checkout@v2 with: + path: nim-dagger submodules: true - name: Derive environment variables + shell: bash run: | if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then ARCH=64 @@ -53,10 +56,8 @@ jobs: fi echo "ARCH=$ARCH" >> $GITHUB_ENV echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV - ncpu= ext= - MAKE_CMD="make" case '${{ runner.os }}' in 'Linux') ncpu=$(nproc) @@ -67,13 +68,11 @@ jobs: 'Windows') ncpu=$NUMBER_OF_PROCESSORS ext=.exe - MAKE_CMD="mingw32-make" ;; esac [[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1 echo "ncpu=$ncpu" >> $GITHUB_ENV echo "ext=$ext" >> $GITHUB_ENV - echo "MAKE_CMD=${MAKE_CMD}" >> $GITHUB_ENV - name: Install build dependencies (Linux i386) if: runner.os == 'Linux' && matrix.target.cpu == 'i386' @@ -115,6 +114,7 @@ jobs: if: > steps.windows-mingw-cache.outputs.cache-hit != 'true' && runner.os == 'Windows' + shell: bash run: | mkdir -p external curl -L "https://nim-lang.org/download/mingw$ARCH.7z" -o "external/mingw-${{ matrix.target.cpu }}.7z" @@ -125,6 +125,7 @@ jobs: 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 @@ -133,33 +134,85 @@ jobs: - 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: Setup environment + shell: bash + run: echo '${{ github.workspace }}/nim/bin' >> $GITHUB_PATH + - name: Get latest Nim commit hash id: versions + shell: bash run: | getHash() { git ls-remote "https://github.com/$1" "${2:-HEAD}" | cut -f 1 } - nbsHash=$(getHash status-im/nimbus-build-system) - echo "::set-output name=nimbus_build_system::$nbsHash" + nimHash=$(getHash nim-lang/Nim '${{ matrix.branch }}') + csourcesHash=$(getHash nim-lang/csources) + echo "::set-output name=nim::$nimHash" + echo "::set-output name=csources::$csourcesHash" - name: Restore prebuilt Nim from cache id: nim-cache - uses: actions/cache@v2 + uses: actions/cache@v1 with: - path: NimBinaries - key: 'NimBinaries-${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ steps.versions.outputs.nimbus_build_system }}' + path: nim + key: "nim-${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ steps.versions.outputs.nim }}" + + - name: Restore prebuilt csources from cache + if: steps.nim-cache.outputs.cache-hit != 'true' + id: csources-cache + uses: actions/cache@v1 + with: + path: csources/bin + key: "csources-${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ steps.versions.outputs.csources }}" + + - name: Checkout Nim csources + if: > + steps.csources-cache.outputs.cache-hit != 'true' && + steps.nim-cache.outputs.cache-hit != 'true' + uses: actions/checkout@v2 + with: + repository: nim-lang/csources + path: csources + ref: ${{ steps.versions.outputs.csources }} + + - name: Checkout Nim + if: steps.nim-cache.outputs.cache-hit != 'true' + uses: actions/checkout@v2 + with: + repository: nim-lang/Nim + path: nim + ref: ${{ steps.versions.outputs.nim }} - name: Build Nim and associated tools + if: steps.nim-cache.outputs.cache-hit != 'true' + shell: bash run: | - curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh - env MAKE="${MAKE_CMD} -j${ncpu}" ARCH_OVERRIDE=${PLATFORM} CC=gcc bash build_nim.sh nim csources dist/nimble NimBinaries - echo '${{ github.workspace }}/nim/bin' >> $GITHUB_PATH + [[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1 + if [[ ! -e csources/bin/nim$ext ]]; then + make -C csources -j $ncpu CC=gcc ucpu='${{ matrix.target.cpu }}' + else + echo 'Using prebuilt csources' + fi + cp -v csources/bin/nim$ext nim/bin + cd nim + nim c koch + ./koch boot -d:release + ./koch tools -d:release + # clean up to save cache space + rm koch + rm -rf nimcache + rm -rf dist + rm -rf .git - name: Run nim-dagger tests + shell: bash run: | + export UCPU="$cpu" + cd nim-dagger nimble install -y --depsOnly nimble test