From 5213d397f9d85c69279961256e19a859cd32df30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Thu, 3 Jun 2021 01:59:50 +0200 Subject: [PATCH] CI: refactor Nim compiler caching (#35) --- .github/workflows/ci.yml | 46 ++++++---------------------------------- README.md | 2 +- serialization.nimble | 5 +++-- 3 files changed, 10 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d869fa9..2f413e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: nim-serialization CI +name: CI on: [push, pull_request] jobs: @@ -7,38 +7,17 @@ jobs: fail-fast: false max-parallel: 20 matrix: - branch: [master] target: - os: linux cpu: amd64 - TEST_LANG: c - - os: linux - cpu: amd64 - TEST_LANG: cpp - os: linux cpu: i386 - TEST_LANG: c - - os: linux - cpu: i386 - TEST_LANG: cpp - os: macos cpu: amd64 - TEST_LANG: c - - os: macos - cpu: amd64 - TEST_LANG: cpp - os: windows cpu: amd64 - TEST_LANG: c - - os: windows - cpu: amd64 - TEST_LANG: cpp - os: windows cpu: i386 - TEST_LANG: c - - os: windows - cpu: i386 - TEST_LANG: cpp include: - target: os: linux @@ -50,7 +29,7 @@ jobs: os: windows builder: windows-2019 - name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ matrix.target.TEST_LANG }} (${{ matrix.branch }})' + name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}' runs-on: ${{ matrix.builder }} steps: - name: Checkout nim-serialization @@ -145,11 +124,10 @@ jobs: id: nim-cache uses: actions/cache@v2 with: - path: nim - key: 'nim-${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ steps.versions.outputs.nimbus_build_system }}' + path: NimBinaries + key: 'NimBinaries-${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ steps.versions.outputs.nimbus_build_system }}' - 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 @@ -164,23 +142,11 @@ jobs: MAKE_CMD="make" fi env MAKE="$MAKE_CMD -j2" ARCH_OVERRIDE=$PLATFORM CC=gcc bash build_nim.sh nim csources dist/nimble NimBinaries - - # clean up to save cache space - cd nim - rm koch - rm -rf nimcache - rm -rf csources - rm -rf tests - rm -rf dist - rm -rf .git - - - name: Setup environment - shell: bash - run: echo '${{ github.workspace }}/nim/bin' >> $GITHUB_PATH + echo '${{ github.workspace }}/nim/bin' >> $GITHUB_PATH - name: Run nim-serialization tests shell: bash working-directory: nim-serialization run: | nimble install -y --depsOnly - env TEST_LANG="${{ matrix.target.TEST_LANG }}" nimble test + nimble test diff --git a/README.md b/README.md index 265a1eb..f136140 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ nim-serialization [![Build status](https://ci.appveyor.com/api/projects/status/muejuk735c11brjd/branch/master?svg=true)](https://ci.appveyor.com/project/nimbus/nim-serialization/branch/master) [![License: Apache](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -![Github action](https://github.com/status-im/nim-serialization/workflows/nim-serialization%20CI/badge.svg) +![Github action](https://github.com/status-im/nim-serialization/workflows/CI/badge.svg) ## Introduction diff --git a/serialization.nimble b/serialization.nimble index 75c39fa..38c5ae0 100644 --- a/serialization.nimble +++ b/serialization.nimble @@ -12,5 +12,6 @@ requires "nim >= 1.2.0", "stew" task test, "Run all tests": - exec "nim c -r --threads:off tests/test_all" - exec "nim c -r --threads:on tests/test_all" + let common_args = "c -r -f --hints:off --skipParentCfg" + exec "nim " & common_args & " --threads:off tests/test_all" + exec "nim " & common_args & " --threads:on tests/test_all"