|
6 | 6 | pull_request: |
7 | 7 | branches: [ '*' ] |
8 | 8 |
|
| 9 | +env: |
| 10 | + WOLFSSL_VERSION: master # Can be changed to specific tag like v5.6.4 |
| 11 | + |
9 | 12 | jobs: |
10 | 13 | libwolfprov-standalone: |
11 | 14 | runs-on: ubuntu-22.04 |
@@ -60,16 +63,50 @@ jobs: |
60 | 63 | # List all tags |
61 | 64 | git tag -l |
62 | 65 |
|
| 66 | + # Cache wolfSSL to speed up builds: |
| 67 | + # - Git repository cache: Avoids re-cloning wolfSSL repo |
| 68 | + # - Complete build cache: Includes source, built packages, and artifacts |
| 69 | + # Cache keys include script hash to invalidate when install script changes |
| 70 | + - name: Cache wolfSSL git repository |
| 71 | + uses: actions/cache@v4 |
| 72 | + with: |
| 73 | + path: /tmp/wolfssl-pkg/wolfssl/.git |
| 74 | + key: wolfssl-git-${{ env.WOLFSSL_VERSION }}-${{ hashFiles('wolfProvider/debian/install-wolfssl.sh') }}-${{ github.sha }} |
| 75 | + restore-keys: | |
| 76 | + wolfssl-git-${{ env.WOLFSSL_VERSION }}-${{ hashFiles('wolfProvider/debian/install-wolfssl.sh') }}- |
| 77 | + wolfssl-git-${{ env.WOLFSSL_VERSION }}- |
| 78 | +
|
| 79 | + - name: Cache wolfSSL source and build |
| 80 | + uses: actions/cache@v4 |
| 81 | + with: |
| 82 | + path: | |
| 83 | + /tmp/wolfssl-pkg/wolfssl |
| 84 | + /tmp/wolfssl-pkg/*.deb |
| 85 | + /tmp/wolfssl-pkg/*.dsc |
| 86 | + /tmp/wolfssl-pkg/*.tar.gz |
| 87 | + key: wolfssl-complete-${{ env.WOLFSSL_VERSION }}-${{ hashFiles('wolfProvider/debian/install-wolfssl.sh') }}-${{ github.sha }} |
| 88 | + restore-keys: | |
| 89 | + wolfssl-complete-${{ env.WOLFSSL_VERSION }}-${{ hashFiles('wolfProvider/debian/install-wolfssl.sh') }}- |
| 90 | +
|
63 | 91 | - name: Install wolfssl debian package |
64 | 92 | run: | |
65 | 93 | mkdir -p "/tmp/wolfssl-pkg" |
66 | 94 | cd "/tmp/wolfssl-pkg" |
67 | 95 | |
68 | | - # Install wolfssl packages |
69 | | - chmod +x $GITHUB_WORKSPACE/debian/install-wolfssl.sh |
70 | | - $GITHUB_WORKSPACE/debian/install-wolfssl.sh \ |
71 | | - $GITHUB_WORKSPACE/.github/packages/debian-wolfssl.tar.gz \ |
72 | | - "/tmp/wolfssl-pkg" |
| 96 | + # Check if cached packages exist |
| 97 | + if ls *.deb 1> /dev/null 2>&1; then |
| 98 | + echo "Found cached wolfSSL packages, installing them..." |
| 99 | + dpkg -i *.deb || apt-get install -f -y |
| 100 | + else |
| 101 | + echo "No cached packages found, building from source..." |
| 102 | + # Install wolfssl packages with specified version |
| 103 | + chmod +x $GITHUB_WORKSPACE/debian/install-wolfssl.sh |
| 104 | + if [ "$WOLFSSL_VERSION" != "master" ]; then |
| 105 | + $GITHUB_WORKSPACE/debian/install-wolfssl.sh --tag "$WOLFSSL_VERSION" "/tmp/wolfssl-pkg" |
| 106 | + else |
| 107 | + $GITHUB_WORKSPACE/debian/install-wolfssl.sh "/tmp/wolfssl-pkg" |
| 108 | + fi |
| 109 | + fi |
73 | 110 |
|
74 | 111 | # Create wolfprov-packages directory and move wolfssl files there |
75 | 112 | mkdir -p "/tmp/wolfprov-packages" |
|
0 commit comments