[SSLNTV-34] Add a new GitHub workflow to trigger native builds for pu… #34
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 }} | |
defaults: | |
run: | |
working-directory: main | |
strategy: | |
matrix: | |
os: [windows-latest, macos-latest] | |
include: | |
- os: windows-latest | |
vcvars: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
path: main | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Checkout wildfly-openssl for test purposes | |
uses: actions/checkout@v2 | |
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 | |
run: | | |
export PATH="/usr/local/opt/openssl@3/bin:$PATH" | |
openssl version | |
- if: matrix.os == 'windows-latest' | |
name: Install Full OpenSSL Library | |
run: | | |
vcpkg install openssl[core,tools] --triplet x64-windows | |
- if: matrix.os == 'macos-latest' | |
name: Build WildFly OpenSSL natives | |
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 with Microsoft Visual Studio native tools command prompt and Maven | |
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 -v | |
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: ${{ 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 |