ci: improve GitHub actions build times

Splitting builds and tests into more stages for clarity.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2021-06-23 19:14:37 +02:00 committed by Jakub
parent 52b741ac11
commit 8f7a800b41
2 changed files with 44 additions and 21 deletions

View File

@ -11,7 +11,9 @@ jobs:
strategy: strategy:
matrix: matrix:
env: env:
- { NPROC: 2 } - NPROC: 2
MAKEFLAGS: "-j${NPROC}"
NIMFLAGS: "--parallelBuild:${NPROC}"
platform: [ubuntu-latest, macos-latest] platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }} runs-on: ${{ matrix.platform }}
env: ${{ matrix.env }} env: ${{ matrix.env }}
@ -28,8 +30,7 @@ jobs:
# make update breaks because the cached compiler is there where the submodules # make update breaks because the cached compiler is there where the submodules
# are meant to go. # are meant to go.
- name: Submodules - name: Submodules
run: | run: git submodule update --init --recursive
git submodule update --init --recursive
- name: Cache nim - name: Cache nim
uses: actions/cache@v1 uses: actions/cache@v1
@ -37,20 +38,28 @@ jobs:
path: vendor/nimbus-build-system/vendor/Nim/bin path: vendor/nimbus-build-system/vendor/Nim/bin
key: ${{ runner.os }}-${{ matrix.env.NPROC }}-nim-${{ hashFiles('.gitmodules') }} key: ${{ runner.os }}-${{ matrix.env.NPROC }}-nim-${{ hashFiles('.gitmodules') }}
- name: Install dependencies - name: Update dependencies
run: | run: make V=1 update
make -j${NPROC} NIMFLAGS="--parallelBuild:${NPROC}" V=1 update
make -j${NPROC} NIMFLAGS="--parallelBuild:${NPROC}" LOG_LEVEL=TRACE
- name: Run Tests - name: Build V1 binaries
run: | run: make LOG_LEVEL=TRACE v1
make -j${NPROC} NIMFLAGS="--parallelBuild:${NPROC}" test
- name: Build V2 binaries
run: make LOG_LEVEL=TRACE v2
- name: Run V1 Tests
run: make test1
- name: Run V2 Tests
run: make test2
windows: windows:
strategy: strategy:
matrix: matrix:
env: env:
- { NPROC: 2 } - NPROC: 2
MAKEFLAGS: "-j${NPROC}"
ARCH_OVERRIDE: "%PLATFORM%"
runs-on: windows-latest runs-on: windows-latest
env: ${{ matrix.env }} env: ${{ matrix.env }}
timeout-minutes: 90 timeout-minutes: 90
@ -71,8 +80,7 @@ jobs:
# make update breaks because the cached compiler is there where the submodules # make update breaks because the cached compiler is there where the submodules
# are meant to go. # are meant to go.
- name: Submodules - name: Submodules
run: | run: git submodule update --init --recursive
git submodule update --init --recursive
- name: Cache nim - name: Cache nim
uses: actions/cache@v1 uses: actions/cache@v1
@ -80,13 +88,25 @@ jobs:
path: vendor/nimbus-build-system/vendor/Nim/bin path: vendor/nimbus-build-system/vendor/Nim/bin
key: ${{ runner.os }}-${{ matrix.env.NPROC }}-nim-${{ hashFiles('.gitmodules') }} key: ${{ runner.os }}-${{ matrix.env.NPROC }}-nim-${{ hashFiles('.gitmodules') }}
- name: Build - name: Update dependencies
run: | run: mingw32-make CI_CACHE=NimBinaries update
mingw32-make -j2 ARCH_OVERRIDE=%PLATFORM% CI_CACHE=NimBinaries update
mingw32-make -j2 ARCH_OVERRIDE=%PLATFORM% fetch-dlls
- name: Run Tests - name: Fetch DLLs
run: mingw32-make fetch-dlls
- name: Build V1 Binaries
run: mingw32-make LOG_LEVEL=TRACE v1
- name: Build V2 Binaries
run: mingw32-make LOG_LEVEL=TRACE v2
- name: Test Binaries
run: | run: |
mingw32-make -j2 ARCH_OVERRIDE=%PLATFORM% LOG_LEVEL=TRACE
build\wakunode1.exe --help build\wakunode1.exe --help
mingw32-make -j2 ARCH_OVERRIDE=%PLATFORM% test build\wakunode2.exe --help
- name: Run V1 Tests
run: mingw32-make test1
- name: Run V2 Tests
run: mingw32-make test2

View File

@ -51,7 +51,10 @@ GIT_SUBMODULE_UPDATE := git submodule update --init --recursive
else # "variables.mk" was included. Business as usual until the end of this file. else # "variables.mk" was included. Business as usual until the end of this file.
# default target, because it's the first one that doesn't start with '.' # default target, because it's the first one that doesn't start with '.'
all: | wakunode1 sim1 example1 wakunode2 sim2 example2 chat2 bridge chat2bridge all: | v1 v2
v1: | wakunode1 sim1 example1
v2: | wakunode2 sim2 example2 chat2 bridge chat2bridge
# must be included after the default target # must be included after the default target
-include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk -include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk