Skip to content

Main and Release CI Build #223

Main and Release CI Build

Main and Release CI Build #223

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:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
include:
- os: windows-latest
windows: true
runs-on: ${{ matrix.os }}
steps:
- run: |
mkdir artifacts
mkdir artifacts/build
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Mandatory to use the extract version from tag action
- name: Extract version from tag
uses: damienaicheh/[email protected]
- name: Export version
run: |
echo "VERSIONSUFFIX=${{ env.PRE_RELEASE }}" >> $GITHUB_ENV
echo "PRODVERSION=${{ env.MAJOR }}.${{ env.MINOR }}" >> $GITHUB_ENV
echo "PATCHVERSION=${{ env.PATCH }}" >> $GITHUB_ENV
- name: Setup .NET SDK
uses: actions/setup-dotnet@v1
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.PRODVERSION }}.${{ env.PATCHVERSION }}" --build-arg "VERSION=${{ env.PRODVERSION }}" -t azbridge:${{ env.PRODVERSION }} -t azbridge
docker save azbridge:${{ env.PRODVERSION }} > artifacts/build/images/azbridge-oci-image-${{ env.PRODVERSION }}.${{ env.PATCHVERSION }}.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
if: matrix.os == 'windows-latest'
#- name: Build for Windows-arm64
# run: dotnet msbuild /t:Restore,Package /p:WindowsOnly=false /p:RuntimeIdentifier=win-arm /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel
# 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
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
if: matrix.os == 'ubuntu-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
if: matrix.os == 'ubuntu-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
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
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'
- uses: actions/upload-artifact@v2
with:
name: XBuild
path: artifacts/build/net8.0
- uses: actions/upload-artifact@v2
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