Release trigger tag #89
Workflow file for this run
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: 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@v4 | |
| - name: Setup dotnet | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 8.x | |
| 10.x | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.x' | |
| - name: Generate Go Test Data | |
| run: | | |
| go get -u all | |
| go mod tidy | |
| go run main.go > NATS.NKeys.Tests/test_data.json | |
| - name: Build | |
| run: dotnet build -c Debug | |
| - name: Test Core | |
| run: dotnet test -c Debug --no-build --logger:"console;verbosity=normal" | |
| - name: Test Compare Go Impl | |
| run: | | |
| cd nkTestGen | |
| dotnet run > test_data.json | |
| go test | |
| - 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 | |
| echo "Skipping macOS: this check isn't stable on macOS" | |
| exit 0 | |
| 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." |