Github workflow build cache (#4150)
Cache intermediary build artefacts to speed up build time.
This commit is contained in:
parent
f65e58a2d2
commit
4f4ccf7649
3 changed files with 78 additions and 5 deletions
14
.github/actions/restore-git-mtimes/action.yml
vendored
Normal file
14
.github/actions/restore-git-mtimes/action.yml
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
name: "restore-git-mtimes"
|
||||||
|
description: "Restore file modification timestamps from git commit timestamps"
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
repository: "MestreLion/git-tools"
|
||||||
|
ref: a42a069bc755f0fa81316965335cb33dbf22a968 # pin latest commit
|
||||||
|
path: "git-tools"
|
||||||
|
- run: $GITHUB_WORKSPACE/git-tools/git-restore-mtime
|
||||||
|
shell: bash
|
||||||
|
- run: git submodule foreach --recursive '$GITHUB_WORKSPACE/git-tools/git-restore-mtime'
|
||||||
|
shell: bash
|
||||||
63
.github/workflows/unit_tests.yml
vendored
63
.github/workflows/unit_tests.yml
vendored
|
|
@ -26,6 +26,18 @@ jobs:
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: "recursive"
|
submodules: "recursive"
|
||||||
|
fetch-depth: 0 # full history needed for restoring file timestamps
|
||||||
|
|
||||||
|
- name: Restore Timestamps
|
||||||
|
uses: ./.github/actions/restore-git-mtimes
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Restore Build Cache
|
||||||
|
uses: actions/cache/restore@v3
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
path: build
|
||||||
|
key: ${{ runner.os }}-build-cache
|
||||||
|
|
||||||
- name: Fetch Deps
|
- name: Fetch Deps
|
||||||
run: TEST=1 ci/actions/osx/install_deps.sh
|
run: TEST=1 ci/actions/osx/install_deps.sh
|
||||||
|
|
@ -33,6 +45,15 @@ jobs:
|
||||||
- name: Build Tests
|
- name: Build Tests
|
||||||
run: ci/build-ci.sh "/tmp/qt/lib/cmake/Qt5";
|
run: ci/build-ci.sh "/tmp/qt/lib/cmake/Qt5";
|
||||||
|
|
||||||
|
- name: Save Build Cache
|
||||||
|
# only save build cache from develop to avoid polluting it by other branches / PRs
|
||||||
|
if: github.ref == 'refs/heads/develop' && success()
|
||||||
|
uses: actions/cache/save@v3
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
path: build
|
||||||
|
key: ${{ runner.os }}-build-cache
|
||||||
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: cd build && sudo TEST_USE_ROCKSDB=$TEST_USE_ROCKSDB ../ci/test.sh .
|
run: cd build && sudo TEST_USE_ROCKSDB=$TEST_USE_ROCKSDB ../ci/test.sh .
|
||||||
env:
|
env:
|
||||||
|
|
@ -60,6 +81,18 @@ jobs:
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: "recursive"
|
submodules: "recursive"
|
||||||
|
fetch-depth: 0 # full history needed for restoring file timestamps
|
||||||
|
|
||||||
|
- name: Restore Timestamps
|
||||||
|
uses: ./.github/actions/restore-git-mtimes
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Restore Build Cache
|
||||||
|
uses: actions/cache/restore@v3
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
path: build
|
||||||
|
key: ${{ runner.os }}-${{ env.COMPILER }}-build-cache
|
||||||
|
|
||||||
- name: Fetch Deps
|
- name: Fetch Deps
|
||||||
run: ci/actions/linux/install_deps.sh
|
run: ci/actions/linux/install_deps.sh
|
||||||
|
|
@ -67,6 +100,15 @@ jobs:
|
||||||
- name: Build Tests
|
- name: Build Tests
|
||||||
run: docker run -e TEST_USE_ROCKSDB -e RELEASE -v ${PWD}:/workspace nanocurrency/nano-env:${{ matrix.COMPILER }} /bin/bash -c "cd /workspace && ./ci/build-ci.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5"
|
run: docker run -e TEST_USE_ROCKSDB -e RELEASE -v ${PWD}:/workspace nanocurrency/nano-env:${{ matrix.COMPILER }} /bin/bash -c "cd /workspace && ./ci/build-ci.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5"
|
||||||
|
|
||||||
|
- name: Save Build Cache
|
||||||
|
# only save build cache from develop to avoid polluting it by other branches / PRs
|
||||||
|
if: github.ref == 'refs/heads/develop' && success()
|
||||||
|
uses: actions/cache/save@v3
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
path: build
|
||||||
|
key: ${{ runner.os }}-${{ env.COMPILER }}-build-cache
|
||||||
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: docker run -e RELEASE -e TEST_USE_ROCKSDB -e DEADLINE_SCALE_FACTOR -v ${PWD}:/workspace nanocurrency/nano-env:${{ matrix.COMPILER }} /bin/bash -c "cd /workspace/build && ../ci/test.sh ."
|
run: docker run -e RELEASE -e TEST_USE_ROCKSDB -e DEADLINE_SCALE_FACTOR -v ${PWD}:/workspace nanocurrency/nano-env:${{ matrix.COMPILER }} /bin/bash -c "cd /workspace/build && ../ci/test.sh ."
|
||||||
env:
|
env:
|
||||||
|
|
@ -92,6 +134,18 @@ jobs:
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: "recursive"
|
submodules: "recursive"
|
||||||
|
fetch-depth: 0 # full history needed for restoring file timestamps
|
||||||
|
|
||||||
|
- name: Restore Timestamps
|
||||||
|
uses: ./.github/actions/restore-git-mtimes
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Restore Build Cache
|
||||||
|
uses: actions/cache/restore@v3
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
path: build
|
||||||
|
key: ${{ runner.os }}-build-cache
|
||||||
|
|
||||||
- name: Windows Defender
|
- name: Windows Defender
|
||||||
run: ci/actions/windows/disable_windows_defender.ps1
|
run: ci/actions/windows/disable_windows_defender.ps1
|
||||||
|
|
@ -102,6 +156,15 @@ jobs:
|
||||||
- name: Build Tests
|
- name: Build Tests
|
||||||
run: ci/actions/windows/build.ps1
|
run: ci/actions/windows/build.ps1
|
||||||
|
|
||||||
|
- name: Save Build Cache
|
||||||
|
# only save build cache from develop to avoid polluting it by other branches / PRs
|
||||||
|
if: github.ref == 'refs/heads/develop' && success()
|
||||||
|
uses: actions/cache/save@v3
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
path: build
|
||||||
|
key: ${{ runner.os }}-build-cache
|
||||||
|
|
||||||
- name: Run Tests [TEST_USE_ROCKSDB=${{ env.TEST_USE_ROCKSDB }}]
|
- name: Run Tests [TEST_USE_ROCKSDB=${{ env.TEST_USE_ROCKSDB }}]
|
||||||
run: ci/actions/windows/run.ps1
|
run: ci/actions/windows/run.ps1
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,12 @@
|
||||||
qt_dir=${1}
|
qt_dir=${1}
|
||||||
build_target=${2:-all}
|
build_target=${2:-all}
|
||||||
|
|
||||||
set -o errexit
|
|
||||||
set -o nounset
|
|
||||||
set -o xtrace
|
|
||||||
OS=$(uname)
|
OS=$(uname)
|
||||||
|
|
||||||
source "$(dirname "$BASH_SOURCE")/impl/code-inspector.sh"
|
source "$(dirname "$BASH_SOURCE")/impl/code-inspector.sh"
|
||||||
code_inspect "${ROOTPATH:-.}"
|
code_inspect "${ROOTPATH:-.}"
|
||||||
|
|
||||||
mkdir build
|
mkdir -p build
|
||||||
pushd build
|
pushd build
|
||||||
|
|
||||||
if [[ "${RELEASE:-false}" == "true" ]]; then
|
if [[ "${RELEASE:-false}" == "true" ]]; then
|
||||||
|
|
@ -49,7 +46,6 @@ cmake \
|
||||||
-DPORTABLE=1 \
|
-DPORTABLE=1 \
|
||||||
-DNANO_WARN_TO_ERR=ON \
|
-DNANO_WARN_TO_ERR=ON \
|
||||||
-DCMAKE_BUILD_TYPE=${BUILD_TYPE:-Debug} \
|
-DCMAKE_BUILD_TYPE=${BUILD_TYPE:-Debug} \
|
||||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
|
||||||
-DQt5_DIR=${qt_dir} \
|
-DQt5_DIR=${qt_dir} \
|
||||||
-DCI_TEST="1" \
|
-DCI_TEST="1" \
|
||||||
${BACKTRACE:-} \
|
${BACKTRACE:-} \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue