Skip to content

Main and Release CI Build #281

Main and Release CI Build

Main and Release CI Build #281

Workflow file for this run

name: Main and Release CI Build
on:
workflow_dispatch:
push:
branches: [ master, main ]
create:
tags:
- 'v*.*'
pull_request:
branches: [ master, main ]
jobs:
build:
permissions: write-all
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: windows-latest
windows: true
runs-on: ${{ matrix.os }}
steps:
- run: |
mkdir artifacts
mkdir artifacts/build
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Mandatory to use the extract version from tag action
- name: Extract version from tag
uses: damienaicheh/[email protected]
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build Docker Image TAR file
run: |
mkdir -p artifacts/build/images
DOCKER_BUILDKIT=1 docker build . --build-arg "REVISION=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}" --build-arg "VERSION=${{ env.MAJOR }}.${{ env.MINOR }}" -t azbridge:${{ env.MAJOR }}.${{ env.MINOR }} -t azbridge
docker save azbridge:${{ env.MAJOR }}.${{ env.MINOR }} > artifacts/build/images/azbridge-oci-image-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.tar
if: matrix.os == 'ubuntu-latest'
- name: Build for Windows-x64
run: dotnet msbuild /t:Package /p:WindowsOnly=true /p:RuntimeIdentifier=win-x64 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'windows-latest'
- name: Build for Windows-arm64
run: dotnet msbuild /t:Restore,Package /p:WindowsOnly=false /p:RuntimeIdentifier=win-arm64 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'windows-latest'
- name: Build for Windows-x86
run: dotnet msbuild /t:Restore,Package /p:WindowsOnly=false /p:RuntimeIdentifier=win-x86 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'windows-latest'
- name: Build for macOS-x64
run: dotnet msbuild /t:Package /p:WindowsOnly=false /p:RuntimeIdentifier=osx-x64 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'macos-latest'
- name: Build for macOS-arm64
run: dotnet msbuild /t:Package /p:WindowsOnly=false /p:RuntimeIdentifier=osx-arm64 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'macos-latest'
- name: Build for Linux-x64
run: dotnet msbuild /t:Package /p:WindowsOnly=false /p:RuntimeIdentifier=linux-x64 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'ubuntu-latest'
- name: Build for Linux-arm64
run: dotnet msbuild /t:Restore,Package /p:WindowsOnly=false /p:RuntimeIdentifier=linux-arm64 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'ubuntu-latest'
- name: Unit Test Windows x64
env:
AZBRIDGE_TEST_CXNSTRING: ${{ secrets.AZBRIDGE_TEST_CXNSTRING }}
run: dotnet test /p:TargetFramework=net8.0 /p:RuntimeIdentifier=win-x64 /p:Configuration=Debug
if: matrix.os == 'windows-latest'
- name: Unit Test Linux x64
env:
AZBRIDGE_TEST_CXNSTRING: ${{ secrets.AZBRIDGE_TEST_CXNSTRING }}
run: dotnet test /p:TargetFramework=net8.0 /p:RuntimeIdentifier=linux-x64 /p:Configuration=Debug
if: matrix.os == 'ubuntu-latest'
- name: Unit Test macOS arm64
env:
AZBRIDGE_TEST_CXNSTRING: ${{ secrets.AZBRIDGE_TEST_CXNSTRING }}
# W/A for Dns.GetHostEntry(Dns.GetHostName()) exception https://github.com/actions/runner-images/issues/8649
run: |
echo -e "$(ipconfig getifaddr en0) $(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts
./test/unit/macos_unblock_testip.sh
dotnet test /p:TargetFramework=net8.0 /p:RuntimeIdentifier=osx-arm64 /p:Configuration=Debug
if: matrix.os == 'macos-latest'
- uses: actions/upload-artifact@v3
with:
name: XBuild
path: artifacts/build/net8.0
- uses: actions/upload-artifact@v3
with:
name: XBuild
path: artifacts/build/images
if: matrix.os == 'ubuntu-latest'
#- name: Integration Tests Docker/Linux
# env:
# AZBRIDGE_TEST_CXNSTRING: ${{ secrets.AZBRIDGE_TEST_CXNSTRING }}
# run: bash ./verify-build.sh
# if: matrix.os == 'ubuntu-latest'
#- name: Integration Tests Windows
# env:
# AZBRIDGE_TEST_CXNSTRING: ${{ secrets.AZBRIDGE_TEST_CXNSTRING }}
# run: ./verify-build.cmd
# if: matrix.os == 'windows-latest'
# create a release if a tag has been pushed
- name: Generate Release
uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
artifacts: "artifacts/build/net8.0/*,artifacts/build/images/*"
generateReleaseNotes: true
allowUpdates: true