77 pull_request :
88 types : [opened, synchronize, reopened, ready_for_review]
99 branches : [ '*' ]
10+ # Daily run on master reseeds the shared cache (see save steps below).
11+ schedule :
12+ - cron : ' 20 4 * * *'
1013
1114concurrency :
1215 group : ${{ github.workflow }}-${{ github.ref }}
2528 timeout-minutes : 10
2629 steps :
2730 - name : Checking if we have mbed in cache
28- uses : actions/cache@v5
31+ uses : actions/cache/restore @v5
2932 id : cache
3033 with :
3134 path : mbedtls
5457 openssl pkey -in framework/data_files/cli-rsa-sha256.key.der -text > framework/data_files/cli-rsa-sha256.key.pem
5558 openssl pkey -in framework/data_files/server2.key.der -text > framework/data_files/server2.key.pem
5659
60+ # Only master (the daily schedule) saves, so all PRs share one entry.
61+ - name : Save mbedtls cache
62+ if : github.ref == 'refs/heads/master' && steps.cache.outputs.cache-hit != 'true'
63+ uses : actions/cache/save@v5
64+ with :
65+ path : mbedtls
66+ key : mbedtls-${{ env.MBED_REF }}
67+
68+ # On a cache miss, hand the freshly built mbedtls to mbedtls_test via an
69+ # artifact so it is not compiled a second time in the same run.
70+ - name : tar mbedtls
71+ if : steps.cache.outputs.cache-hit != 'true'
72+ run : tar -zcf mbedtls.tgz mbedtls
73+
74+ - name : Upload mbedtls build
75+ if : steps.cache.outputs.cache-hit != 'true'
76+ uses : actions/upload-artifact@v6
77+ with :
78+ name : mbedtls-build
79+ path : mbedtls.tgz
80+ retention-days : 1
81+
5782 mbedtls_test :
5883 name : Test interop with mbedtls
5984 if : ${{ (github.repository_owner == 'wolfssl') && (github.event_name != 'pull_request' || github.event.pull_request.draft == false) }}
@@ -64,33 +89,25 @@ jobs:
6489 - name : Disable IPv6 (IMPORTANT, OTHERWISE DTLS MBEDTLS CLIENT WON'T CONNECT)
6590 run : echo 1 | sudo tee /proc/sys/net/ipv6/conf/lo/disable_ipv6
6691
92+ # Restore only: the build_mbedtls job (master/schedule) owns the save.
6793 - name : Checking if we have mbed in cache
68- uses : actions/cache@v5
94+ uses : actions/cache/restore @v5
6995 id : cache
7096 with :
7197 path : mbedtls
7298 key : mbedtls-${{ env.MBED_REF }}
7399
74- - name : Checkout mbedtls (fallback on cache miss)
100+ # On a cache miss, reuse the build_mbedtls artifact instead of
101+ # recompiling. master restores from the cache above instead.
102+ - name : Download mbedtls build (fallback on cache miss)
75103 if : steps.cache.outputs.cache-hit != 'true'
76- uses : actions/checkout@v5
104+ uses : actions/download-artifact@v7
77105 with :
78- repository : Mbed-TLS/mbedtls
79- ref : ${{ env.MBED_REF }}
80- path : mbedtls
81- fetch-depth : 1
106+ name : mbedtls-build
82107
83- - name : Compile mbedtls (fallback on cache miss)
108+ - name : untar mbedtls (fallback on cache miss)
84109 if : steps.cache.outputs.cache-hit != 'true'
85- working-directory : mbedtls
86- run : |
87- git submodule update --init
88- mkdir build
89- cd build
90- cmake ..
91- make -j$(nproc)
92- openssl pkey -in framework/data_files/cli-rsa-sha256.key.der -text > framework/data_files/cli-rsa-sha256.key.pem
93- openssl pkey -in framework/data_files/server2.key.der -text > framework/data_files/server2.key.pem
110+ run : tar -xf mbedtls.tgz
94111
95112 - name : Build wolfSSL
96113 uses : wolfSSL/actions-build-autotools-project@v1
0 commit comments