CI: refactor Nim compiler caching (#18)

This commit is contained in:
Ștefan Talpalaru 2021-06-03 02:12:09 +02:00 committed by GitHub
parent d79b5c8849
commit f7d671f877
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 43 deletions

View File

@ -1,4 +1,4 @@
name: nim-protobuf-serialization CI
name: CI
on: [push, pull_request]
jobs:
@ -7,38 +7,18 @@ jobs:
fail-fast: false
max-parallel: 20
matrix:
branch: [master]
test_lang: [c, cpp]
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 +30,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 }}-${{ matrix.test_lang }}'
runs-on: ${{ matrix.builder }}
steps:
- name: Checkout nim-protobuf-serialization
@ -145,11 +125,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 +143,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-protobuf-serialization tests
shell: bash
working-directory: nim-protobuf-serialization
run: |
nimble install -y --depsOnly
env TEST_LANG="${{ matrix.target.TEST_LANG }}" nimble test
env TEST_LANG="${{ matrix.test_lang }}" nimble test

View File

@ -5,7 +5,7 @@
[![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-blue.svg)](https://opensource.org/licenses/MIT)
![Stability: experimental](https://img.shields.io/badge/stability-experimental-orange.svg)
![Github action](https://github.com/status-im/nim-protobuf-serialization/workflows/nim-protobuf-serialization%20CI/badge.svg)
![Github action](https://github.com/status-im/nim-protobuf-serialization/workflows/CI/badge.svg)
Protobuf implementation compatible with the [nim-serialization](https://github.com/status-im/nim-serialization) framework.

View File

@ -1,4 +1,4 @@
import os
import os, strutils
mode = ScriptMode.Verbose
@ -21,7 +21,7 @@ proc test(env, path: string) =
lang = getEnv"TEST_LANG"
exec "nim " & lang & " " & env &
" -r --hints:off --warnings:off " & path
" -r --hints:off --skipParentCfg " & path
task test, "Run all tests":
#Explicitly specify the call depth limit in case the default changes in the future.