[SSLNTV-39] Update CI to also run with JDK 21 #40
Workflow file for this run
This file contains 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: Build Natives | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
tags: | |
- '*' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }}-jdk${{ matrix.java }} | |
defaults: | |
run: | |
working-directory: main | |
strategy: | |
matrix: | |
os: [windows-latest, macos-latest, ubuntu-latest] | |
java: ['11', '21'] | |
include: | |
- os: windows-latest | |
vcvars: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: main | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ matrix.java }} | |
- name: Checkout wildfly-openssl for test purposes | |
uses: actions/checkout@v3 | |
with: | |
repository: wildfly-security/wildfly-openssl | |
path: wildfly-openssl | |
- name: Cache Maven packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Maven Version Info | |
run: mvn -version | |
- if: matrix.os == 'macos-latest' | |
name: OpenSSL Library Version Info on MacOS | |
run: | | |
export PATH="/usr/local/opt/openssl@3/bin:$PATH" | |
openssl version | |
- if: matrix.os == 'windows-latest' | |
name: Install OpenSSL Library on Windows | |
run: | | |
vcpkg install openssl[core,tools] --triplet x64-windows | |
- if: matrix.os == 'macos-latest' | |
name: Build WildFly OpenSSL natives on MacOS | |
id: build-wildfly-openssl-natives | |
run: | | |
export PATH="/usr/local/opt/openssl@3/bin:$PATH" | |
echo "OpenSSL version used is:" | |
openssl version | |
mvn -B install --file pom.xml | |
echo "WILDFLY_OPENSSL_NATIVES_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT | |
- if: matrix.os == 'windows-latest' | |
name: Build WildFly OpenSSL natives on Windows with Microsoft Visual Studio native tools command prompt and Maven on Windows | |
env: | |
VCVARS: ${{ matrix.vcvars }} | |
shell: cmd | |
run: | | |
call "%VCVARS%" x64 | |
set PATH=C:\vcpkg\installed\x64-windows\tools\openssl;%PATH% | |
openssl version -v | |
mvn -B install --file pom.xml | |
- if: matrix.os == 'windows-latest' | |
name: Run tests with the built Windows native | |
env: | |
VCVARS: ${{ matrix.vcvars }} | |
working-directory: wildfly-openssl | |
shell: cmd | |
run: | | |
call "%VCVARS%" x64 | |
set PATH=C:\vcpkg\installed\x64-windows\tools\openssl;%PATH% | |
openssl version | |
for /f "tokens=3 delims=<> skip=1" %%v in ('findstr "<version>" ..\main\pom.xml') do set WILDFLY_OPENSSL_NATIVES_VERSION=%%v | |
echo Running tests with WildFly OpenSSL Natives %WILDFLY_OPENSSL_NATIVES_VERSION% | |
mvn -B verify --file pom.xml -Dorg.wildfly.openssl.path="C:\vcpkg\installed\x64-windows\tools\openssl" -Dversion.org.wildfly.openssl.natives=%WILDFLY_OPENSSL_NATIVES_VERSION% | |
- if: matrix.os == 'macos-latest' | |
name: Run tests with the built MacOS native | |
working-directory: wildfly-openssl | |
run: | | |
export PATH="/usr/local/opt/openssl@3/bin:$PATH" | |
openssl version | |
export WILDFLY_OPENSSL_NATIVES_VERSION=${{ steps.build-wildfly-openssl-natives.outputs.WILDFLY_OPENSSL_NATIVES_VERSION }} | |
echo Running tests with WildFly OpenSSL Natives $WILDFLY_OPENSSL_NATIVES_VERSION | |
mvn -B verify --file pom.xml -Dorg.wildfly.openssl.path="/usr/local/opt/openssl@3/lib" -Dversion.org.wildfly.openssl.natives=$WILDFLY_OPENSSL_NATIVES_VERSION | |
- if: matrix.os == 'ubuntu-latest' | |
name: Install latest version of OpenSSL in Ubuntu | |
run: | | |
cd /usr/local/src/ | |
sudo wget https://www.openssl.org/source/openssl-3.1.2.tar.gz | |
sudo tar -xf openssl-3.1.2.tar.gz | |
cd openssl-3.1.2 | |
sudo ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib | |
sudo make | |
sudo make test | |
sudo make install | |
cd /etc/ld.so.conf.d/ | |
echo "/usr/local/ssl/lib64" | sudo tee openssl-3.1.2.conf | |
sudo ldconfig -v | |
- if: matrix.os == 'ubuntu-latest' | |
name: Build WildFly OpenSSL natives on Ubuntu with OpenSSL 3 | |
id: build-wildfly-openssl-natives-on-ubuntu | |
run: | | |
export PATH=/usr/local/ssl/bin:$PATH | |
echo "OpenSSL version used is:" | |
openssl version | |
mvn -B install --file pom.xml | |
echo "WILDFLY_OPENSSL_NATIVES_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT | |
- if: matrix.os == 'ubuntu-latest' | |
name: Run tests with the built Linux native | |
working-directory: wildfly-openssl | |
run: | | |
export PATH=/usr/local/ssl/bin:$PATH | |
openssl version | |
export WILDFLY_OPENSSL_NATIVES_VERSION=${{ steps.build-wildfly-openssl-natives-on-ubuntu.outputs.WILDFLY_OPENSSL_NATIVES_VERSION }} | |
echo Running tests with WildFly OpenSSL Natives $WILDFLY_OPENSSL_NATIVES_VERSION | |
mvn -B verify --file pom.xml -Dorg.wildfly.openssl.path="/usr/local/src/openssl-3.1.2" -Dversion.org.wildfly.openssl.natives=$WILDFLY_OPENSSL_NATIVES_VERSION | |
- if: ${{ github.event_name == 'push' }} | |
name: Archive the built native artifacts if this is a tag | |
uses: actions/upload-artifact@v2 | |
with: | |
name: built-natives | |
path: | | |
**/target/**.jar |