From 341996179748ae44492f106c2064f9b354696e96 Mon Sep 17 00:00:00 2001 From: vdovhanych Date: Wed, 24 Nov 2021 13:24:10 +0100 Subject: [PATCH] ci: introduce gitlab cache for vnev --- ci/build.yml | 24 ++++++++++++++++++++++++ ci/posttest.yml | 9 +++++++++ ci/prebuild.yml | 12 ++++++++++++ ci/test-hw.yml | 7 +++++++ ci/test.yml | 24 ++++++++++++++++++++++++ 5 files changed, 76 insertions(+) diff --git a/ci/build.yml b/ci/build.yml index 8e4dfa033..72d8e5fda 100644 --- a/ci/build.yml +++ b/ci/build.yml @@ -1,5 +1,12 @@ image: registry.gitlab.com/satoshilabs/trezor/trezor-firmware/trezor-firmware-env.nix +# Caching +.gitlab_caching: &gitlab_caching + cache: + key: "$CI_COMMIT_REF_SLUG" + paths: + - .venv/ + variables: SDL_VIDEODRIVER: "dummy" XDG_RUNTIME_DIR: "/var/tmp" @@ -8,6 +15,7 @@ variables: core fw regular build: stage: build + <<: *gitlab_caching needs: [] script: - nix-shell --run "poetry run make -C core build_boardloader" @@ -25,6 +33,7 @@ core fw regular build: core fw regular debug build: stage: build + <<: *gitlab_caching needs: [] script: - nix-shell --run "PYOPT=0 poetry run make -C core build_firmware" @@ -37,6 +46,7 @@ core fw regular debug build: core fw btconly build: stage: build + <<: *gitlab_caching needs: [] variables: BITCOIN_ONLY: "1" @@ -53,6 +63,7 @@ core fw btconly build: core fw btconly debug build: stage: build + <<: *gitlab_caching needs: [] variables: BITCOIN_ONLY: "1" @@ -75,6 +86,7 @@ core fw btconly debug build: core fw btconly t1 build: stage: build + <<: *gitlab_caching needs: [] variables: BITCOIN_ONLY: "1" @@ -90,6 +102,7 @@ core fw btconly t1 build: core unix regular build: stage: build + <<: *gitlab_caching needs: [] script: - nix-shell --run "poetry run make -C core build_unix" @@ -101,6 +114,7 @@ core unix regular build: core unix frozen regular build: stage: build + <<: *gitlab_caching needs: [] script: - nix-shell --run "poetry run make -C core build_unix_frozen" @@ -112,6 +126,7 @@ core unix frozen regular build: core unix frozen btconly debug build: stage: build + <<: *gitlab_caching needs: [] variables: PYOPT: "0" @@ -127,6 +142,7 @@ core unix frozen btconly debug build: core unix frozen debug build: stage: build + <<: *gitlab_caching needs: [] variables: PYOPT: "0" @@ -154,6 +170,7 @@ core unix frozen btconly debug t1 build: core macos frozen regular build: stage: build + <<: *gitlab_caching needs: [] when: manual tags: @@ -177,6 +194,7 @@ core macos frozen regular build: crypto build: stage: build + <<: *gitlab_caching needs: [] only: changes: @@ -199,6 +217,7 @@ crypto build: legacy fw regular build: stage: build + <<: *gitlab_caching needs: [] script: - nix-shell --run "export MEMORY_PROTECT=1 && poetry run legacy/script/cibuild" @@ -214,6 +233,7 @@ legacy fw regular build: legacy fw regular debug build: stage: build + <<: *gitlab_caching needs: [] variables: DEBUG_LINK: "1" @@ -230,6 +250,7 @@ legacy fw regular debug build: legacy fw btconly build: stage: build + <<: *gitlab_caching needs: [] variables: BITCOIN_ONLY: "1" @@ -248,6 +269,7 @@ legacy fw btconly build: legacy fw btconly debug build: stage: build + <<: *gitlab_caching needs: [] variables: BITCOIN_ONLY: "1" @@ -266,6 +288,7 @@ legacy fw btconly debug build: legacy emu regular debug build: stage: build + <<: *gitlab_caching needs: [] variables: DEBUG_LINK: "1" @@ -280,6 +303,7 @@ legacy emu regular debug build: legacy emu btconly debug build: stage: build + <<: *gitlab_caching needs: [] variables: BITCOIN_ONLY: "1" diff --git a/ci/posttest.yml b/ci/posttest.yml index b5e6d97a8..dca9423d7 100644 --- a/ci/posttest.yml +++ b/ci/posttest.yml @@ -1,9 +1,17 @@ image: registry.gitlab.com/satoshilabs/trezor/trezor-firmware/trezor-firmware-env.nix +# Caching +.gitlab_caching: &gitlab_caching + cache: + key: "$CI_COMMIT_REF_SLUG" + paths: + - .venv/ + core unix coverage posttest: stage: posttest variables: COVERAGE_THRESHOLD: "78" + <<: *gitlab_caching needs: - core device test - core monero test @@ -24,6 +32,7 @@ core unix ui changes: stage: posttest except: - master + <<: *gitlab_caching needs: - core device ui test script: diff --git a/ci/prebuild.yml b/ci/prebuild.yml index 11ba42bba..c4f204b8f 100644 --- a/ci/prebuild.yml +++ b/ci/prebuild.yml @@ -1,29 +1,41 @@ image: registry.gitlab.com/satoshilabs/trezor/trezor-firmware/trezor-firmware-env.nix +# Caching +.gitlab_caching: &gitlab_caching + cache: + key: "$CI_COMMIT_REF_SLUG" + paths: + - .venv/ + style prebuild: stage: prebuild variables: GIT_SUBMODULE_STRATEGY: "none" + <<: *gitlab_caching script: - nix-shell --run "poetry run make style_check" common prebuild: stage: prebuild + <<: *gitlab_caching script: - nix-shell --run "poetry run make defs_check" gen prebuild: stage: prebuild + <<: *gitlab_caching script: - nix-shell --run "poetry run make gen_check" editor prebuild: stage: prebuild + <<: *gitlab_caching script: - nix-shell --run "make editor_check" yaml prebuild: stage: prebuild + <<: *gitlab_caching script: - nix-shell --run "poetry run make yaml_check" diff --git a/ci/test-hw.yml b/ci/test-hw.yml index ec1925959..075a98a90 100644 --- a/ci/test-hw.yml +++ b/ci/test-hw.yml @@ -1,5 +1,12 @@ image: registry.gitlab.com/satoshilabs/trezor/trezor-firmware/trezor-firmware-env.nix +# Caching +.gitlab_caching: &gitlab_caching + cache: + key: "$CI_COMMIT_REF_SLUG" + paths: + - .venv/ + # Hardware # Currently it's not possible to run all regular TT tests without getting into diff --git a/ci/test.yml b/ci/test.yml index 79957a7d6..43e161b94 100644 --- a/ci/test.yml +++ b/ci/test.yml @@ -1,9 +1,17 @@ image: registry.gitlab.com/satoshilabs/trezor/trezor-firmware/trezor-firmware-env.nix +# Caching +.gitlab_caching: &gitlab_caching + cache: + key: "$CI_COMMIT_REF_SLUG" + paths: + - .venv/ + # Core core unit test: stage: test + <<: *gitlab_caching needs: - core unix regular build script: @@ -23,6 +31,7 @@ core unit test t1: core device ui test: stage: test + <<: *gitlab_caching needs: - core unix frozen debug build script: @@ -47,6 +56,7 @@ core device ui test: core device test: stage: test + <<: *gitlab_caching needs: - core unix frozen debug build variables: @@ -67,6 +77,7 @@ core device test: core btconly device test: stage: test + <<: *gitlab_caching needs: - core unix frozen btconly debug build variables: @@ -86,6 +97,7 @@ core btconly device test: core monero test: stage: test + <<: *gitlab_caching needs: - core unix frozen debug build variables: @@ -104,6 +116,7 @@ core monero test: core u2f test: stage: test + <<: *gitlab_caching needs: - core unix frozen debug build variables: @@ -122,6 +135,7 @@ core u2f test: core fido2 test: stage: test + <<: *gitlab_caching needs: - core unix frozen debug build variables: @@ -144,6 +158,7 @@ core fido2 test: core click test: stage: test + <<: *gitlab_caching needs: - core unix frozen debug build script: @@ -160,6 +175,7 @@ core click test: core upgrade test: stage: test + <<: *gitlab_caching needs: - core unix frozen debug build variables: @@ -178,6 +194,7 @@ core upgrade test: core persistence test: stage: test + <<: *gitlab_caching needs: - core unix frozen debug build script: @@ -201,6 +218,7 @@ crypto test: - .gitlab-ci.yml - ci/**/* - crypto/**/* + <<: *gitlab_caching needs: - crypto build script: @@ -223,6 +241,7 @@ crypto test: legacy test: stage: test + <<: *gitlab_caching needs: - legacy emu regular debug build variables: @@ -240,6 +259,7 @@ legacy test: legacy btconly test: stage: test + <<: *gitlab_caching needs: - legacy emu btconly debug build variables: @@ -260,6 +280,7 @@ legacy btconly test: legacy upgrade test: stage: test + <<: *gitlab_caching needs: - legacy emu regular debug build variables: @@ -281,6 +302,7 @@ legacy upgrade test: python test: stage: test + <<: *gitlab_caching needs: [] variables: LC_ALL: "C.UTF-8" @@ -314,6 +336,7 @@ storage test: - .gitlab-ci.yml - ci/**/* - storage/**/* + <<: *gitlab_caching needs: [] script: - nix-shell --run "poetry run make -C storage/tests build | ts -s" @@ -332,6 +355,7 @@ storage test: core unix memory profiler: stage: test when: manual + <<: *gitlab_caching needs: [] variables: PYOPT: "0"