Skip to content

Commit ade7cc1

Browse files
committed
re-using dependencies installed in conan
1 parent 27ffd58 commit ade7cc1

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

.github/workflows/tests.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,55 @@ jobs:
3737
- name: "Check C/C++ formatting changes"
3838
run: git diff --exit-code
3939

40+
conan-cache:
41+
if: github.event.pull_request.draft == false
42+
runs-on: ubuntu-latest
43+
env:
44+
HOST_TYPE: ci
45+
REDIS_QUEUE_HOST: redis
46+
REDIS_STATE_HOST: redis
47+
container:
48+
image: faasm/faabric:0.2.2
49+
defaults:
50+
run:
51+
working-directory: /code/faabric
52+
services:
53+
redis:
54+
image: redis
55+
steps:
56+
# --- Code update ---
57+
- name: "Fetch ref"
58+
run: git fetch origin ${GITHUB_REF}:ci-branch
59+
- name: "Check out branch"
60+
run: git checkout --force ci-branch
61+
# --- Set-up ---
62+
- name: "Ping redis"
63+
run: redis-cli -h redis ping
64+
# --- Cache based on Conan version and ExternalProjects cmake source
65+
- name: Get Conan version
66+
id: get-conan-version
67+
run: |
68+
echo "::set-output name=conan-version::$(conan --version | tr -d '[:alpha:] ')"
69+
shell: bash
70+
- name: Hash ExternalProjects
71+
id: hash-external
72+
run: |
73+
echo "::set-output name=hash-external::$(sha256sum cmake/ExternalProjects.cmake | cut '-d ' -f 1)"
74+
shell: bash
75+
- uses: actions/cache@v2
76+
with:
77+
path: '~/.conan'
78+
key: ${{ runner.os }}-${{ steps.get-conan-version.outputs.conan-version }}-${{ steps.hash-external.outputs.hash-external }}
79+
restore-keys: |
80+
${{ runner.os }}-${{ steps.get-conan-version.outputs.conan-version }}-
81+
${{ runner.os }}-
82+
# --- Build dependencies
83+
- name: "Build dependencies to be shared by all sanitiser runs"
84+
run: inv dev.cmake -b Debug
85+
4086
tests:
4187
if: github.event.pull_request.draft == false
88+
needs: [conan-cache]
4289
runs-on: ubuntu-latest
4390
env:
4491
HOST_TYPE: ci
@@ -61,6 +108,24 @@ jobs:
61108
# --- Set-up ---
62109
- name: "Ping redis"
63110
run: redis-cli -h redis ping
111+
# --- Cache based on Conan version and ExternalProjects cmake source
112+
- name: Get Conan version
113+
id: get-conan-version
114+
run: |
115+
echo "::set-output name=conan-version::$(conan --version | tr -d '[:alpha:] ')"
116+
shell: bash
117+
- name: Hash ExternalProjects
118+
id: hash-external
119+
run: |
120+
echo "::set-output name=hash-external::$(sha256sum cmake/ExternalProjects.cmake | cut '-d ' -f 1)"
121+
shell: bash
122+
- uses: actions/cache@v2
123+
with:
124+
path: '~/.conan'
125+
key: ${{ runner.os }}-${{ steps.get-conan-version.outputs.conan-version }}-${{ steps.hash-external.outputs.hash-external }}
126+
restore-keys: |
127+
${{ runner.os }}-${{ steps.get-conan-version.outputs.conan-version }}-
128+
${{ runner.os }}-
64129
# --- Tests build - need a debug build for actually running tests ---
65130
- name: "Run cmake for tests"
66131
run: inv dev.cmake --build=Debug
@@ -78,6 +143,16 @@ jobs:
78143
# --- Code update ---
79144
- name: "Check out code"
80145
uses: actions/checkout@v2
146+
# # --- Cache based on Conan version and ExternalProjects cmake source
147+
# - name: "Get Conan version"
148+
# id: get-conan-version
149+
# run: |
150+
# echo "::set-output name=conan-version::$(conan --version | tr -d '[:alpha:] ')"
151+
# shell: bash
152+
# - uses: actions/cache@v2
153+
# with:
154+
# path: '~/.conan'
155+
# key: ${{ runner.os }}-${{ steps.get-conan-version.outputs.conan-version }}-${{ hashFiles('cmake/ExternalProjects.cmake') }}
81156
# --- Build and test ---
82157
- name: "Build distributed tests"
83158
run: ./dist-test/build.sh
@@ -105,6 +180,24 @@ jobs:
105180
run: git fetch origin ${GITHUB_REF}:ci-branch
106181
- name: "Check out branch"
107182
run: git checkout --force ci-branch
183+
# --- Cache based on Conan version and ExternalProjects cmake source
184+
- name: Get Conan version
185+
id: get-conan-version
186+
run: |
187+
echo "::set-output name=conan-version::$(conan --version | tr -d '[:alpha:] ')"
188+
shell: bash
189+
- name: Hash ExternalProjects
190+
id: hash-external
191+
run: |
192+
echo "::set-output name=hash-external::$(sha256sum cmake/ExternalProjects.cmake | cut '-d ' -f 1)"
193+
shell: bash
194+
- uses: actions/cache@v2
195+
with:
196+
path: '~/.conan'
197+
key: ${{ runner.os }}-${{ steps.get-conan-version.outputs.conan-version }}-${{ steps.hash-external.outputs.hash-external }}
198+
restore-keys: |
199+
${{ runner.os }}-${{ steps.get-conan-version.outputs.conan-version }}-
200+
${{ runner.os }}-
108201
# --- Examples ---
109202
- name: "Run cmake shared"
110203
run: inv dev.cmake --shared --build=Release

0 commit comments

Comments
 (0)