Skip to content

Merge pull request #241 from VATSIM-UK/dependabot/nuget/tests/Compile… #485

Merge pull request #241 from VATSIM-UK/dependabot/nuget/tests/Compile…

Merge pull request #241 from VATSIM-UK/dependabot/nuget/tests/Compile… #485

name: Build Test and Coverage
on:
push:
branches:
- 'main'
pull_request:
jobs:
Build_Test_Coverage:
strategy:
matrix:
platform: [ubuntu-22.04, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout Code
uses: actions/checkout@v2
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
- name: Install dependencies for dotCover
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libssl1.1 || echo "Trying alternative method"
if ! ldconfig -p | grep libssl.so.1.1; then
echo "libssl1.1 not found, attempting manual installation"
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.1/libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb
fi
- name: Restore Nuget Packages
run: dotnet restore SectorFileCompiler.sln --packages packages
- name: Run Build
run: dotnet build /p:Configuration=Release SectorFileCompiler.sln --nologo --no-restore /warnaserror;
- name: Run Compiler Tests With Coverage
if: matrix.platform == 'ubuntu-22.04'
run: |
cd tests/CompilerTest
dotnet dotcover test --dcReportType=DetailedXml --dcOutput=../../coverage/Compiler.xml
- name: Run Compiler Tests
if: matrix.platform != 'ubuntu-22.04'
run: |
cd tests/CompilerTest
dotnet test
- name: Run Compiler CLI Tests With Coverage
if: matrix.platform == 'ubuntu-22.04'
run: |
cd tests/CompilerCliTest
dotnet dotcover test --dcReportType=DetailedXml --dcOutput=../../coverage/CompilerCli.xml
- name: Run Compiler CLI Tests
if: matrix.platform != 'ubuntu-22.04'
run: |
cd tests/CompilerCliTest
dotnet test
- name: Publish Assets
if: matrix.platform == 'windows-latest'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: .\.github\workflows\publish.ps1
shell: powershell
- name: Upload Windows Assets
if: matrix.platform == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: "cli-windows-x64"
path: "publish/windows/CompilerCli.exe"
- name: Upload Linux Assets
if: matrix.platform == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: "cli-linux-x64"
path: "publish/linux/CompilerCli"
- name: Upload OSX Assets
if: matrix.platform == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: "cli-osx-x64"
path: "publish/osx/CompilerCli"
- name: Upload Code Coverage Reports
if: matrix.platform == 'ubuntu-22.04'
run: |
cd coverage
bash <(curl -s https://codecov.io/bash) -f *.xml
# If we're building on main, lets do a release
- name: Create Release
if: github.ref == 'refs/heads/main' && matrix.platform == 'windows-latest'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release@17