mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-02-02 16:14:59 +00:00
[wip] cache more Testground resources
This commit is contained in:
parent
223b174c5b
commit
d78e737a04
71
.github/workflows/testground.yml
vendored
71
.github/workflows/testground.yml
vendored
@ -1,6 +1,8 @@
|
|||||||
# Adapted from:
|
# Adapted from:
|
||||||
# https://github.com/status-im/nim-codex/blob/main/.github/workflows/ci.yml
|
# https://github.com/status-im/nim-codex/blob/main/.github/workflows/ci.yml
|
||||||
|
|
||||||
|
# delete me... another cache-tester comment
|
||||||
|
|
||||||
name: Testground
|
name: Testground
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -14,7 +16,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
cache_nonce: [ 1 ] # Allows for easily busting actions/cache caches
|
cache_nonce: [ 2 ] # Allows for easily busting actions/cache caches
|
||||||
target:
|
target:
|
||||||
- os: linux
|
- os: linux
|
||||||
cpu: amd64
|
cpu: amd64
|
||||||
@ -60,45 +62,44 @@ jobs:
|
|||||||
- name: Calculate cache-key components
|
- name: Calculate cache-key components
|
||||||
id: calc-cache-key-components
|
id: calc-cache-key-components
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=hash::$(git rev-parse $(git branch --show-current))"
|
echo "::set-output name=testground_commit::$(git rev-parse $(git branch --show-current))"
|
||||||
echo "::set-output name=digest::$(docker manifest inspect nimlang/nim:latest | jq '.config.digest' | awk -F'"' '{ print $2}')"
|
echo "::set-output name=nim_image_digest::$(docker manifest inspect nimlang/nim:latest | jq '.config.digest' | awk -F'"' '{ print $2}')"
|
||||||
working-directory: testground
|
working-directory: testground
|
||||||
|
|
||||||
- name: Restore Testground executable from cache
|
- name: Restore Testground resources from cache
|
||||||
id: testground-exe-cache
|
id: testground-reources-cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/go/bin/testground
|
path: |
|
||||||
key: ${{ matrix.target.os }}-${{ matrix.target.cpu }}-testground_commit-${{ steps.calc-cache-key-components.outputs.hash }}-cache_nonce:${{ matrix.cache_nonce }}
|
~/go/bin
|
||||||
|
~/docker/saved-images
|
||||||
|
key: ${{ matrix.target.os }}-${{ matrix.target.cpu }}-testground_commit-${{ steps.calc-cache-key-components.outputs.testground_commit }}-nim_image_digest-${{ steps.calc-cache-key-components.outputs.nim_image_digest }}-cache_nonce:${{ matrix.cache_nonce }}
|
||||||
|
|
||||||
- name: Build Testground executable
|
- name: Build Testground resources and save to cache
|
||||||
if: steps.testground-exe-cache.outputs.cache-hit != 'true'
|
if: steps.testground-reources-cache.outputs.cache-hit != 'true'
|
||||||
run: make goinstall
|
|
||||||
working-directory: testground
|
|
||||||
|
|
||||||
- name: Start Testground executable
|
|
||||||
run: |
|
run: |
|
||||||
make docker sync-install
|
mkdir -p "${HOME}"/docker/saved-images
|
||||||
testground daemon &
|
make install
|
||||||
working-directory: testground
|
docker save iptestground/sidecar:edge | gzip > "${HOME}/docker/saved-images/iptestground_sidecar_edge.tar.gz"
|
||||||
|
docker save iptestground/sync-service:edge | gzip > "${HOME}/docker/saved-images/iptestground_sync-service_edge.tar.gz"
|
||||||
- name: Restore nimlang/nim:latest Docker image from cache
|
docker save iptestground/testground:edge | gzip > "${HOME}/docker/saved-images/iptestground_testground_edge.tar.gz"
|
||||||
id: nimlang_nim-docker-image-cache
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: ~/docker/saved-images/nimlang_nim_latest.tar.gz
|
|
||||||
key: nim_image_digest-${{ steps.calc-cache-key-components.outputs.digest }}-cache_nonce:${{ matrix.cache_nonce }}
|
|
||||||
|
|
||||||
- name: Pull nimlang/nim:latest Docker image from registry and save to cache path
|
|
||||||
if: steps.nimlang_nim-docker-image-cache.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
|
||||||
mkdir -p "${HOME}/docker/saved-images"
|
|
||||||
docker pull nimlang/nim:latest
|
docker pull nimlang/nim:latest
|
||||||
docker save nimlang/nim:latest | gzip > "${HOME}/docker/saved-images/nimlang_nim_latest.tar.gz"
|
docker save nimlang/nim:latest | gzip > "${HOME}/docker/saved-images/nimlang_nim_latest.tar.gz"
|
||||||
|
working-directory: testground
|
||||||
|
|
||||||
- name: Load nimlang/nim:latest Docker image from cache
|
- name: Restore Testground resources from cache
|
||||||
if: steps.nimlang_nim-docker-image-cache.outputs.cache-hit == 'true'
|
if: steps.testground-reources-cache.outputs.cache-hit == 'true'
|
||||||
run: docker load < "${HOME}/docker/saved-images/nimlang_nim_latest.tar.gz"
|
run: |
|
||||||
|
docker load < "${HOME}/docker/saved-images/iptestground_sidecar_edge.tar.gz"
|
||||||
|
docker load < "${HOME}/docker/saved-images/iptestground_sync-service_edge.tar.gz"
|
||||||
|
docker load < "${HOME}/docker/saved-images/iptestground_testground_edge.tar.gz"
|
||||||
|
docker load < "${HOME}/docker/saved-images/nimlang_nim_latest.tar.gz"
|
||||||
|
docker load < "${HOME}/docker/saved-images/bitnami_grafana_latest.tar.gz" || true
|
||||||
|
docker load < "${HOME}/docker/saved-images/redis_latest.tar.gz" || true
|
||||||
|
docker load < "${HOME}/docker/saved-images/influxdb_1.8.tar.gz" || true
|
||||||
|
|
||||||
|
- name: Start Testground executable
|
||||||
|
run: testground daemon &
|
||||||
|
|
||||||
- name: Build and run a Codex Testground plan with custom options
|
- name: Build and run a Codex Testground plan with custom options
|
||||||
run: |
|
run: |
|
||||||
@ -106,3 +107,11 @@ jobs:
|
|||||||
TESTGROUND_PLAN=simple_libp2p \
|
TESTGROUND_PLAN=simple_libp2p \
|
||||||
TESTGROUND_OPTIONS="--instances=10 --wait" \
|
TESTGROUND_OPTIONS="--instances=10 --wait" \
|
||||||
testground
|
testground
|
||||||
|
|
||||||
|
- name: Save additional Testground resources to cache
|
||||||
|
if: steps.testground-reources-cache.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
docker ps -a -q | xargs docker kill &>/dev/null ; docker ps -a -q | xargs docker rm
|
||||||
|
docker save bitnami/grafana:latest | gzip > "${HOME}/docker/saved-images/bitnami_grafana_latest.tar.gz"
|
||||||
|
docker save redis:latest | gzip > "${HOME}/docker/saved-images/redis_latest.tar.gz"
|
||||||
|
docker save influxdb:1.8 | gzip > "${HOME}/docker/saved-images/influxdb_1.8.tar.gz"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user