diff --git a/.github/workflows/build-wolfprovider.yml b/.github/workflows/build-wolfprovider.yml index 2a077190..938f101c 100644 --- a/.github/workflows/build-wolfprovider.yml +++ b/.github/workflows/build-wolfprovider.yml @@ -12,21 +12,21 @@ on: outputs: cache_key: description: "Cache key for the build artifacts" - value: ${{ jobs.build_wolfprovider.outputs.cache_key }} + value: ${{ jobs.build_wolfprovider_common.outputs.cache_key }} jobs: - build_wolfprovider: + build_wolfprovider_common: name: Build wolfProvider runs-on: ubuntu-22.04 timeout-minutes: 20 outputs: - cache_key: wolfprov-${{ inputs.wolfssl_ref }}-${{ github.sha }} + cache_key: wolfprov-${{ inputs.wolfssl_ref }}-${{ inputs.openssl_ref }}-${{ github.sha }} steps: - - name: Checkout wolfProvider - uses: actions/checkout@v4 - # Check if this version of wolfssl/wolfprovider has already been built, # mark to cache these items on post if we do end up building + # On a push, the first workflow(s) will complete the build and cache it + # and any delayed workflow will be able to utilize it. + # This is not designed to cache builds across commits. - name: Checking wolfSSL/wolfProvider in cache uses: actions/cache@v4 id: wolfprov-cache @@ -35,30 +35,117 @@ jobs: wolfssl-source wolfssl-install wolfprov-install + openssl-install provider.conf - key: wolfprov-${{ inputs.wolfssl_ref }}-${{ github.sha }} + key: wolfprov-${{ inputs.wolfssl_ref }}-${{ inputs.openssl_ref }}-${{ github.sha }} lookup-only: true - # If wolfssl/wolfprovider have not yet been built, pull ossl from cache + # if cache hit, exit the workflow + - name: Exit workflow if cache hit + if: steps.wolfprov-cache.outputs.cache-hit == 'true' + run: | + echo "Found cached build, exiting workflow" + exit 0 + + - name: Checkout wolfProvider + if: steps.wolfprov-cache.outputs.cache-hit != 'true' + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + # Convert OpenSSL branch name to commit hash if needed + - name: Get OpenSSL commit hash + if: steps.wolfprov-cache.outputs.cache-hit != 'true' + id: openssl-ref + run: | + if [[ "${{ inputs.openssl_ref }}" =~ ^[0-9a-f]{40}$ ]]; then + echo "ref=${{ inputs.openssl_ref }}" >> $GITHUB_OUTPUT + else + sha=$(curl -s "https://api.github.com/repos/openssl/openssl/commits/${{ inputs.openssl_ref }}" | jq -r '.sha') + echo "ref=$sha" >> $GITHUB_OUTPUT + echo "OpenSSL ref ${{ inputs.openssl_ref }} is commit $sha" + fi + + # Look for a cached version of OpenSSL - name: Checking OpenSSL in cache if: steps.wolfprov-cache.outputs.cache-hit != 'true' - uses: actions/cache@v4 + uses: actions/cache/restore@v4 id: openssl-cache with: path: | openssl-source openssl-install - key: ossl-depends-${{ inputs.openssl_ref }}-${{ github.sha }} - lookup-only: true + key: ossl-depends-${{ steps.openssl-ref.outputs.ref }} + lookup-only: false + + # Convert WolfSSL branch name to commit hash if needed + - name: Get WolfSSL commit hash + if: steps.wolfprov-cache.outputs.cache-hit != 'true' + id: wolfssl-ref + run: | + if [[ "${{ inputs.wolfssl_ref }}" =~ ^[0-9a-f]{40}$ ]]; then + echo "ref=${{ inputs.wolfssl_ref }}" >> $GITHUB_OUTPUT + else + sha=$(curl -s "https://api.github.com/repos/wolfssl/wolfssl/commits/${{ inputs.wolfssl_ref }}" | jq -r '.sha') + echo "ref=$sha" >> $GITHUB_OUTPUT + echo "WolfSSL ref ${{ inputs.wolfssl_ref }} is commit $sha" + fi + + # Look for a cached version of WolfSSL + - name: Checking WolfSSL in cache + if: steps.wolfprov-cache.outputs.cache-hit != 'true' + uses: actions/cache/restore@v4 + id: wolfssl-cache + with: + path: | + wolfssl-source + wolfssl-install + + key: wolfssl-depends-${{ steps.wolfssl-ref.outputs.ref }} + lookup-only: false - # If not yet built this version, build it now - name: Build wolfProvider if: steps.wolfprov-cache.outputs.cache-hit != 'true' run: | OPENSSL_TAG=${{ inputs.openssl_ref }} WOLFSSL_TAG=${{ inputs.wolfssl_ref }} ./scripts/build-wolfprovider.sh + # This is potentially chewing up a lot of cache space. + # Could investigate reducing the size of this cache. + # Note that we use actions/cache/save and actions/cache/restore instead of + # actions/cache to reduce the chance of a cache lock issue. + - name: Save wolfProvider into cache + if: steps.wolfprov-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: | + wolfssl-source + wolfssl-install + wolfprov-install + openssl-install + provider.conf + key: wolfprov-${{ inputs.wolfssl_ref }}-${{ inputs.openssl_ref }}-${{ github.sha }} + + # If openssl cache miss, save it to the cache + - name: Save OpenSSL into cache + if: steps.openssl-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: | + openssl-source + openssl-install + key: ossl-depends-${{ steps.openssl-ref.outputs.ref }} + + - name: Save WolfSSL into cache + if: steps.wolfssl-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: | + wolfssl-source + wolfssl-install + key: wolfssl-depends-${{ steps.wolfssl-ref.outputs.ref }} + - name: Print errors if: ${{ failure() }} run: | diff --git a/.github/workflows/cjose.yml b/.github/workflows/cjose.yml index 26310910..fd742a64 100644 --- a/.github/workflows/cjose.yml +++ b/.github/workflows/cjose.yml @@ -35,35 +35,23 @@ jobs: openssl_ref: [ 'openssl-3.5.0' ] force_fail: [ 'WOLFPROV_FORCE_FAIL=1', '' ] steps: - # Checkout the source so we can run the check-workflow-result script - name: Checkout wolfProvider uses: actions/checkout@v4 with: - sparse-checkout: | - .github + fetch-depth: 1 - - name: Retrieving OpenSSL from cache + - name: Retrieving wolfProvider from cache uses: actions/cache/restore@v4 - id: openssl-cache - with: - path: | - openssl-source - openssl-install - - key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }} - fail-on-cache-miss: true - - - name: Retrieving wolfSSL/wolfProvider from cache - uses: actions/cache/restore@v4 - id: wolfprov-cache + id: wolfprov-cache-restore with: path: | wolfssl-source wolfssl-install wolfprov-install + openssl-install provider.conf - key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }} + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} fail-on-cache-miss: true - name: Install cjose dependencies @@ -78,12 +66,13 @@ jobs: repository: OpenIDC/cjose ref: ${{ matrix.cjose_ref }} path: cjose + fetch-depth: 1 - name: Build cjose working-directory: cjose run: | # Configure with OpenSSL - ./configure CFLAGS="-Wno-error=deprecated-declarations" --with-openssl=/git/wolfProvider/openssl-install + ./configure CFLAGS="-Wno-error=deprecated-declarations" --with-openssl=/git/wolfProvider/openssl-install # Build cjose make diff --git a/.github/workflows/curl.yml b/.github/workflows/curl.yml index 5b827a65..6479fb2c 100644 --- a/.github/workflows/curl.yml +++ b/.github/workflows/curl.yml @@ -40,18 +40,9 @@ jobs: steps: - name: Checkout wolfProvider uses: actions/checkout@v4 - - - name: Retrieving OpenSSL from cache - uses: actions/cache/restore@v4 - id: openssl-cache with: - path: | - openssl-source - openssl-install - - key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }} - fail-on-cache-miss: true - + fetch-depth: 1 + - name: Retrieving wolfSSL/wolfProvider from cache uses: actions/cache/restore@v4 id: wolfprov-cache @@ -60,9 +51,10 @@ jobs: wolfssl-source wolfssl-install wolfprov-install + openssl-install provider.conf - key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }} + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} fail-on-cache-miss: true - name: Install dependencies diff --git a/.github/workflows/grpc.yml b/.github/workflows/grpc.yml index 43e5e584..b157f017 100644 --- a/.github/workflows/grpc.yml +++ b/.github/workflows/grpc.yml @@ -44,18 +44,9 @@ jobs: steps: - name: Checkout wolfProvider uses: actions/checkout@v4 - - - name: Retrieving OpenSSL from cache - uses: actions/cache/restore@v4 - id: openssl-cache with: - path: | - openssl-source - openssl-install - - key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }} - fail-on-cache-miss: true - + fetch-depth: 1 + - name: Retrieving wolfSSL/wolfProvider from cache uses: actions/cache/restore@v4 id: wolfprov-cache @@ -64,9 +55,10 @@ jobs: wolfssl-source wolfssl-install wolfprov-install + openssl-install provider.conf - key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }} + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} fail-on-cache-miss: true - name: Confirm IPv4 and IPv6 support diff --git a/.github/workflows/iperf.yml b/.github/workflows/iperf.yml index 20bb6acb..ca00e572 100644 --- a/.github/workflows/iperf.yml +++ b/.github/workflows/iperf.yml @@ -37,17 +37,8 @@ jobs: steps: - name: Checkout wolfProvider uses: actions/checkout@v4 - - - name: Retrieving OpenSSL from cache - uses: actions/cache/restore@v4 - id: openssl-cache with: - path: | - openssl-source - openssl-install - - key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }} - fail-on-cache-miss: true + fetch-depth: 1 - name: Retrieving wolfSSL/wolfProvider from cache uses: actions/cache/restore@v4 @@ -57,9 +48,10 @@ jobs: wolfssl-source wolfssl-install wolfprov-install + openssl-install provider.conf - key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }} + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} fail-on-cache-miss: true - name: Install dependencies diff --git a/.github/workflows/ipmitool.yml b/.github/workflows/ipmitool.yml index 29529346..85237b99 100644 --- a/.github/workflows/ipmitool.yml +++ b/.github/workflows/ipmitool.yml @@ -37,17 +37,8 @@ jobs: steps: - name: Checkout wolfProvider uses: actions/checkout@v4 - - - name: Retrieving OpenSSL from cache - uses: actions/cache/restore@v4 - id: openssl-cache with: - path: | - openssl-source - openssl-install - - key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }} - fail-on-cache-miss: true + fetch-depth: 1 - name: Retrieving wolfSSL/wolfProvider from cache uses: actions/cache/restore@v4 @@ -57,9 +48,10 @@ jobs: wolfssl-source wolfssl-install wolfprov-install + openssl-install provider.conf - key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }} + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} fail-on-cache-miss: true - name: Install dependencies diff --git a/.github/workflows/liboauth2.yml b/.github/workflows/liboauth2.yml index 3aa1dd6e..1352e563 100644 --- a/.github/workflows/liboauth2.yml +++ b/.github/workflows/liboauth2.yml @@ -36,18 +36,9 @@ jobs: steps: - name: Checkout wolfProvider uses: actions/checkout@v4 - - - name: Retrieving OpenSSL from cache - uses: actions/cache/restore@v4 - id: openssl-cache with: - path: | - openssl-source - openssl-install - - key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }} - fail-on-cache-miss: true - + fetch-depth: 1 + - name: Retrieving wolfSSL/wolfProvider from cache uses: actions/cache/restore@v4 id: wolfprov-cache @@ -56,9 +47,10 @@ jobs: wolfssl-source wolfssl-install wolfprov-install + openssl-install provider.conf - key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }} + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} fail-on-cache-miss: true - name: Install liboauth2 dependencies diff --git a/.github/workflows/net-snmp.yml b/.github/workflows/net-snmp.yml index 3e8905f5..177bde3f 100644 --- a/.github/workflows/net-snmp.yml +++ b/.github/workflows/net-snmp.yml @@ -38,17 +38,8 @@ jobs: steps: - name: Checkout wolfProvider uses: actions/checkout@v4 - - - name: Retrieving OpenSSL from cache - uses: actions/cache/restore@v4 - id: openssl-cache with: - path: | - openssl-source - openssl-install - - key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }} - fail-on-cache-miss: true + fetch-depth: 1 - name: Retrieving wolfSSL/wolfProvider from cache uses: actions/cache/restore@v4 @@ -58,9 +49,10 @@ jobs: wolfssl-source wolfssl-install wolfprov-install + openssl-install provider.conf - key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }} + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} fail-on-cache-miss: true - name: Install dependencies diff --git a/.github/workflows/nginx.yml b/.github/workflows/nginx.yml index 1fba1f8e..cde0f5e1 100644 --- a/.github/workflows/nginx.yml +++ b/.github/workflows/nginx.yml @@ -40,17 +40,8 @@ jobs: steps: - name: Checkout wolfProvider uses: actions/checkout@v4 - - - name: Retrieving OpenSSL from cache - uses: actions/cache/restore@v4 - id: openssl-cache with: - path: | - openssl-source - openssl-install - - key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }} - fail-on-cache-miss: true + fetch-depth: 1 - name: Retrieving wolfSSL/wolfProvider from cache uses: actions/cache/restore@v4 @@ -60,9 +51,10 @@ jobs: wolfssl-source wolfssl-install wolfprov-install + openssl-install provider.conf - key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }} + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} fail-on-cache-miss: true - name: Install dependencies diff --git a/.github/workflows/openldap.yml b/.github/workflows/openldap.yml index 7468a3a1..5848fd08 100644 --- a/.github/workflows/openldap.yml +++ b/.github/workflows/openldap.yml @@ -37,17 +37,8 @@ jobs: steps: - name: Checkout wolfProvider uses: actions/checkout@v4 - - - name: Retrieving OpenSSL from cache - uses: actions/cache/restore@v4 - id: openssl-cache with: - path: | - openssl-source - openssl-install - - key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }} - fail-on-cache-miss: true + fetch-depth: 1 - name: Retrieving wolfSSL/wolfProvider from cache uses: actions/cache/restore@v4 @@ -57,9 +48,10 @@ jobs: wolfssl-source wolfssl-install wolfprov-install + openssl-install provider.conf - key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }} + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} fail-on-cache-miss: true - name: Install dependencies diff --git a/.github/workflows/openssh.yml b/.github/workflows/openssh.yml index 1739d60b..a29451a0 100644 --- a/.github/workflows/openssh.yml +++ b/.github/workflows/openssh.yml @@ -40,17 +40,8 @@ jobs: steps: - name: Checkout wolfProvider uses: actions/checkout@v4 - - - name: Retrieving OpenSSL from cache - uses: actions/cache/restore@v4 - id: openssl-cache with: - path: | - openssl-source - openssl-install - - key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }} - fail-on-cache-miss: true + fetch-depth: 1 - name: Retrieving wolfSSL/wolfProvider from cache uses: actions/cache/restore@v4 @@ -60,9 +51,10 @@ jobs: wolfssl-source wolfssl-install wolfprov-install + openssl-install provider.conf - key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }} + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} fail-on-cache-miss: true - name: Checkout OSP diff --git a/.github/workflows/openvpn.yml b/.github/workflows/openvpn.yml index f4663652..f61ebdb9 100644 --- a/.github/workflows/openvpn.yml +++ b/.github/workflows/openvpn.yml @@ -40,17 +40,8 @@ jobs: steps: - name: Checkout wolfProvider uses: actions/checkout@v4 - - - name: Retrieving OpenSSL from cache - uses: actions/cache/restore@v4 - id: openssl-cache with: - path: | - openssl-source - openssl-install - - key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }} - fail-on-cache-miss: true + fetch-depth: 1 - name: Retrieving wolfSSL/wolfProvider from cache uses: actions/cache/restore@v4 @@ -60,9 +51,10 @@ jobs: wolfssl-source wolfssl-install wolfprov-install + openssl-install provider.conf - key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }} + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} fail-on-cache-miss: true - name: Install test dependencies diff --git a/.github/workflows/simple.yml b/.github/workflows/simple.yml index 354a0277..14ef69eb 100644 --- a/.github/workflows/simple.yml +++ b/.github/workflows/simple.yml @@ -37,9 +37,10 @@ jobs: wolfssl-source wolfssl-install wolfprov-install + openssl-install provider.conf - key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }} + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} lookup-only: true # If wolfssl/wolfprovider have not yet been built, pull ossl from cache diff --git a/.github/workflows/socat.yml b/.github/workflows/socat.yml index 40628571..3c3ec3ef 100644 --- a/.github/workflows/socat.yml +++ b/.github/workflows/socat.yml @@ -35,17 +35,8 @@ jobs: steps: - name: Checkout wolfProvider uses: actions/checkout@v4 - - - name: Retrieving OpenSSL from cache - uses: actions/cache/restore@v4 - id: openssl-cache with: - path: | - openssl-source - openssl-install - - key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }} - fail-on-cache-miss: true + fetch-depth: 1 - name: Retrieving wolfSSL/wolfProvider from cache uses: actions/cache/restore@v4 @@ -55,9 +46,10 @@ jobs: wolfssl-source wolfssl-install wolfprov-install + openssl-install provider.conf - key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }} + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} fail-on-cache-miss: true - name: Install dependencies diff --git a/.github/workflows/sssd.yml b/.github/workflows/sssd.yml index 1c7ad756..eb9f9ea7 100644 --- a/.github/workflows/sssd.yml +++ b/.github/workflows/sssd.yml @@ -33,6 +33,8 @@ jobs: steps: - name: Checkout wolfProvider uses: actions/checkout@v4 + with: + fetch-depth: 1 # Check if this version of wolfssl/wolfprovider has already been built, # mark to cache these items on post if we do end up building @@ -44,27 +46,15 @@ jobs: wolfssl-source wolfssl-install wolfprov-install - provider.conf - - key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }} - lookup-only: true - - # If wolfssl/wolfprovider have not yet been built, pull ossl from cache - - name: Checking OpenSSL in cache - if: steps.wolfprov-${{ matrix.wolfssl_ref }}-cache.hit != 'true' - uses: actions/cache@v4 - id: openssl-cache - with: - path: | - openssl-source openssl-install + provider.conf - key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }} + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} lookup-only: true # If not yet built this version, build it now - name: Build wolfProvider - if: steps.wolfprov-${{ matrix.wolfssl_ref }}-cache.hit != 'true' + if: steps.wolfprov-cache.outputs.cache-hit != 'true' run: | OPENSSL_TAG=${{ matrix.openssl_ref }} WOLFSSL_TAG=${{ matrix.wolfssl_ref }} ./scripts/build-wolfprovider.sh diff --git a/.github/workflows/stunnel.yml b/.github/workflows/stunnel.yml index 784525ff..c343ee9d 100644 --- a/.github/workflows/stunnel.yml +++ b/.github/workflows/stunnel.yml @@ -40,17 +40,8 @@ jobs: steps: - name: Checkout wolfProvider uses: actions/checkout@v4 - - - name: Retrieving OpenSSL from cache - uses: actions/cache/restore@v4 - id: openssl-cache with: - path: | - openssl-source - openssl-install - - key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }} - fail-on-cache-miss: true + fetch-depth: 1 - name: Retrieving wolfSSL/wolfProvider from cache uses: actions/cache/restore@v4 @@ -60,9 +51,10 @@ jobs: wolfssl-source wolfssl-install wolfprov-install + openssl-install provider.conf - key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }} + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} fail-on-cache-miss: true - name: Install dependencies diff --git a/.github/workflows/tcpdump.yml b/.github/workflows/tcpdump.yml index 409b40a7..b4c9d12e 100644 --- a/.github/workflows/tcpdump.yml +++ b/.github/workflows/tcpdump.yml @@ -37,16 +37,8 @@ jobs: steps: - name: Checkout wolfProvider uses: actions/checkout@v4 - - - name: Retrieve OpenSSL from cache - uses: actions/cache/restore@v4 - id: openssl-cache with: - path: | - openssl-source - openssl-install - key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }} - fail-on-cache-miss: true + fetch-depth: 1 - name: Retrieve wolfSSL/wolfProvider from cache uses: actions/cache/restore@v4 @@ -56,8 +48,9 @@ jobs: wolfssl-source wolfssl-install wolfprov-install + openssl-install provider.conf - key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }} + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} fail-on-cache-miss: true - name: Install test dependencies