Merge pull request #262 from cconlon/fenrirAug19 #270
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Linux 32-bit Build and Test | |
| on: | |
| push: | |
| branches: [ 'master', 'main', 'release/**' ] | |
| pull_request: | |
| branches: [ 'master' ] | |
| # Cancel superseded in-progress runs for the same PR. In-progress | |
| # push runs are never cancelled, though a still-queued push run may | |
| # be superseded by a newer queued one. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| # Linux 32-bit build using Zulu x86 JDK | |
| # Tests JNI pointer handling and 32-bit specific code paths | |
| linux-32bit: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| jdk_version: [ '17' ] | |
| wolfssl_configure: [ '--enable-jni --disable-asm', '--enable-jni --enable-all --disable-asm' ] | |
| name: Linux x86 32-bit (Zulu JDK ${{ matrix.jdk_version }}, ${{ matrix.wolfssl_configure }}) | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Install 32-bit library support for running x86 binaries on x64 runner | |
| - name: Install 32-bit library support | |
| run: | | |
| sudo dpkg --add-architecture i386 | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| gcc-multilib \ | |
| g++-multilib \ | |
| libc6:i386 \ | |
| libstdc++6:i386 \ | |
| zlib1g:i386 | |
| - name: Setup Java (Zulu 32-bit) | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' | |
| java-version: ${{ matrix.jdk_version }} | |
| architecture: x86 | |
| - name: Verify Java installation | |
| run: | | |
| java -version | |
| file $(which java) | |
| - name: Setup JUnit | |
| uses: ./.github/actions/setup-junit | |
| # Cache the installed wolfSSL build. The m32 key segment keeps | |
| # these 32-bit builds separate from the 64-bit cache entries. | |
| - name: Resolve wolfSSL cache key | |
| id: wolfssl-key | |
| env: | |
| WOLFSSL_CONFIGURE: ${{ matrix.wolfssl_configure }} | |
| run: | | |
| SHA=$(git ls-remote https://github.com/wolfSSL/wolfssl.git \ | |
| refs/heads/master | cut -f1) | |
| if [ -z "$SHA" ]; then | |
| echo "Failed to resolve wolfSSL master SHA" >&2 | |
| exit 1 | |
| fi | |
| CFG_HASH=$(printf '%s' "$WOLFSSL_CONFIGURE" | \ | |
| shasum -a 256 | cut -c1-16) | |
| CC_HASH=$(cc --version 2>/dev/null | head -n1 | \ | |
| shasum -a 256 | cut -c1-8) | |
| KEY="wolfssl-m32-${{ runner.os }}-${{ runner.arch }}" | |
| KEY="$KEY-cc$CC_HASH-$SHA-$CFG_HASH" | |
| echo "sha=$SHA" >> "$GITHUB_OUTPUT" | |
| echo "key=$KEY" >> "$GITHUB_OUTPUT" | |
| - name: Restore cached wolfSSL install | |
| id: cache-wolfssl | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: wolfssl-install | |
| key: ${{ steps.wolfssl-key.outputs.key }} | |
| # Fetch the exact commit the cache key was computed from so the | |
| # key and contents cannot drift if master advances mid-run. | |
| - name: Clone and build wolfSSL (32-bit) | |
| if: steps.cache-wolfssl.outputs.cache-hit != 'true' | |
| run: | | |
| git init /tmp/wolfssl | |
| cd /tmp/wolfssl | |
| git fetch --depth 1 https://github.com/wolfSSL/wolfssl.git \ | |
| ${{ steps.wolfssl-key.outputs.sha }} | |
| git checkout FETCH_HEAD | |
| ./autogen.sh | |
| ./configure ${{ matrix.wolfssl_configure }} \ | |
| --prefix=$GITHUB_WORKSPACE/wolfssl-install \ | |
| CFLAGS="-m32" LDFLAGS="-m32" | |
| make | |
| make install | |
| # Save right after building (not at job end) so a later test | |
| # failure does not prevent the cache from being populated. | |
| - name: Save wolfSSL install to cache | |
| if: steps.cache-wolfssl.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: wolfssl-install | |
| key: ${{ steps.wolfssl-key.outputs.key }} | |
| - name: Set environment variables | |
| run: | | |
| echo "LD_LIBRARY_PATH=$GITHUB_WORKSPACE/wolfssl-install/lib" >> $GITHUB_ENV | |
| - name: Copy makefile | |
| run: cp makefile.linux makefile | |
| - name: Build JNI library (32-bit) | |
| run: CCFLAGS="-m32" LDFLAGS="-m32" PREFIX=$GITHUB_WORKSPACE/wolfssl-install make | |
| # ant build-jni-debug | |
| - name: Build JAR (ant build-jni-debug) | |
| run: ant build-jni-debug | |
| - name: Run Java tests (ant test) | |
| run: ant test | |
| - name: Clean JAR | |
| run: ant clean | |
| # ant build-jni-release | |
| - name: Build JAR (ant build-jni-release) | |
| run: ant build-jni-release | |
| - name: Run Java tests (ant test) | |
| run: ant test | |
| - name: Clean JAR | |
| run: ant clean | |
| # ant build-jce-debug | |
| - name: Build JAR (ant build-jce-debug) | |
| run: ant build-jce-debug | |
| - name: Run Java tests (ant test) | |
| run: ant test | |
| - name: Clean JAR | |
| run: ant clean | |
| # ant build-jce-release | |
| - name: Build JAR (ant build-jce-release) | |
| run: ant build-jce-release | |
| - name: Run Java tests (ant test) | |
| run: ant test | |
| - name: Clean JAR | |
| run: ant clean | |
| - name: Show logs on failure | |
| if: failure() || cancelled() | |
| run: | | |
| cat build/reports/*.txt 2>/dev/null || true | |