Skip to content

Release 1.0.0-preview.1 (#1) #36

Release 1.0.0-preview.1 (#1)

Release 1.0.0-preview.1 (#1) #36

Workflow file for this run

name: Test
on:
pull_request: {}
push:
branches:
- main
jobs:
dotnet:
name: dotnet
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.x
8.x
- name: Build
run: dotnet build -c Debug
- name: Test Core
run: dotnet test -c Debug --no-build --logger:"console;verbosity=normal"
- name: Check Native AOT
shell: bash
run: |
echo ">> Set up for AOT compilation..."
export exe_file=NATS.NKeys.CheckNativeAot
export exe_type=ELF
export dotnet_runtime_id=linux-x64
echo ">> Checking OS..."
if [ "${{ matrix.os }}" = "windows-latest" ]; then
export exe_file=NATS.NKeys.CheckNativeAot.exe
export exe_type=PE32
export dotnet_runtime_id=win-x64
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
export dotnet_runtime_id=osx-x64
export exe_type=Mach-O
fi
echo ">> Publishing..."
cd NATS.NKeys.CheckNativeAot
rm -rf bin obj
dotnet publish -r $dotnet_runtime_id -c Release -o dist | tee output.txt
echo ">> Checking for warnings..."
grep -i warning output.txt && exit 1
echo ">> Executable sanity checks..."
cd dist
ls -lh
echo ">> Executable is of type $exe_type..."
file $exe_file
file $exe_file | grep $exe_type || exit 1
echo ">> Executable size checks..."
# Can't be less than a meg and not more than 10 megs.
# Fairly arbitrary, but we want to make sure executable size
# is reasonable so we can be somewhat sure AOT compilation
# happened correctly.
export filesize=0
if [ "${{ matrix.os }}" = "windows-latest" ]; then
export filesize=$(stat -c %s $exe_file)
elif [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
export filesize=$(stat -c %s $exe_file)
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
export filesize=$(stat -f %z $exe_file)
fi
echo ">> File size: $filesize bytes"
if [ $filesize -lt 1048576 ]; then
echo ">> Error: File is less than 1MB."
exit 1
fi
if [ $filesize -gt 10485760 ]; then
echo ">> Error: File is more than 10MB."
exit 1
fi
echo ">> File size is within acceptable range."
echo ">> Running executable..."
./$exe_file | tee | grep PASS || exit 1
echo ">> Run complete."