Build Octopus Clients #826
This file contains 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: "Build Octopus Clients" | |
# Controls when the action will run. | |
on: | |
push: | |
# Triggers the workflow on pull request events and merges/pushes to master | |
branches: | |
- master | |
- release/* | |
tags-ignore: | |
- '**' | |
pull_request: | |
types: [opened, synchronize, reopened] | |
schedule: | |
# Daily 5am australian/brisbane time | |
- cron: '0 19 * * *' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Pass branch and patch number to Nuke OctoVersion | |
# (for pull_request events we override the /refs/pull/xx/merge branch to the PR's head branch) | |
env: | |
OCTOVERSION_CurrentBranch: ${{ github.head_ref || github.ref }} | |
OCTOVERSION_Patch: ${{ github.run_number }} | |
AssentNonInteractive: true | |
jobs: | |
build: | |
name: Build Octopus Clients | |
runs-on: windows-latest | |
outputs: | |
octoversion_fullsemver: ${{ steps.build.outputs.octoversion_fullsemver }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # all | |
- name: Setup .NET 6.0 | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
# Adjustment is done prior to Nuke build as OCTOVERSION information is included in the result package. | |
- name: Append OCTOVERSION_CurrentBranch with -nightly (for scheduled) | |
if: github.event_name == 'schedule' | |
run: echo "OCTOVERSION_CurrentBranch=${{ env.OCTOVERSION_CurrentBranch }}-nightly" >> $env:GITHUB_ENV | |
- name: Nuke Build 🏗 | |
id: build | |
shell: bash | |
run: ./build.cmd | |
- name: Windows .Net 4.62 unit test report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: Windows.Net 4.62 unit test results | |
path: ./TestResults/Win_net462_*.trx | |
reporter: dotnet-trx | |
fail-on-error: true | |
- name: Windows .Net 6.0 unit test report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: Windows .Net 6.0 unit test results | |
path: ./TestResults/Win_net6.0_*.trx | |
reporter: dotnet-trx | |
fail-on-error: true | |
- name: Windows .Net 4.62 E2E test report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: Windows .Net 4.62 E2E test results | |
path: ./TestResults/Win-E2E_net462_*.trx | |
reporter: dotnet-trx | |
fail-on-error: true | |
- name: Windows .Net 6.0 E2E test report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: Windows .Net 6.0 E2E test results | |
path: ./TestResults/Win-E2E_net6.0_*.trx | |
reporter: dotnet-trx | |
fail-on-error: true | |
- name: Upload NuGet package artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OctoClientsNuget | |
path: ./artifacts/*.nupkg | |
- name: Tag release (when not pre-release) 🏷️ | |
id: github-tag | |
if: ${{ github.event_name != 'schedule' && !contains( steps.build.outputs.octoversion_fullsemver, '-' ) }} | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "refs/tags/${{ steps.build.outputs.octoversion_fullsemver }}", | |
sha: context.sha | |
}) | |
test-linux-distrubtions: | |
strategy: | |
matrix: | |
os: [ubuntu16, ubuntu18, ubuntu20, debian-buster, fedora35, centos7, rhel9, rocky9, amazon2, opensuse-leap15, opensuse-tumbleweed ] | |
needs: build | |
runs-on: ubuntu-latest | |
env: | |
LOCAL_TEST_DIR: ./results/ | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build testing docker image | |
run: docker-compose -f ./docker-compose.build.yml build test-base-${{ matrix.os }} | |
- name: Run unit tests in docker | |
run: docker-compose -f ./docker-compose.test.yml up test-${{ matrix.os }} | |
- name: ${{ matrix.os }} unit test report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: ${{ matrix.os }} unit tests results | |
path: results/*.trx | |
reporter: dotnet-trx | |
fail-on-error: true | |
test-macos: | |
name: Unit test on Mac OS | |
needs: build | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Run unit tests 🏗 | |
id: test-mac | |
shell: bash | |
run: dotnet test ./source/Octopus.Client.Tests/Octopus.Client.Tests.csproj --configuration:Release --logger:"trx;LogFilePrefix=Mac" --results-directory ./TestResults | |
- name: Mac OS unit test report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: Mac OS unit test results | |
path: ./TestResults/*.trx | |
reporter: dotnet-trx | |
fail-on-error: true | |
deplopy_nuget: | |
name: Upload nuget packages to Octopus Deploy | |
runs-on: ubuntu-latest | |
needs: [ | |
build, | |
test-linux-distrubtions, | |
test-macos ] | |
steps: | |
- name: Download nuget package artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: OctoClientsNuget | |
path: ./artifacts/ | |
- name: Install Octopus CLI 🐙 | |
uses: OctopusDeploy/install-octopus-cli-action@v1 | |
with: | |
version: latest | |
- name: Push to Octopus 🐙 | |
uses: OctopusDeploy/push-package-action@v3 | |
with: | |
server: ${{ secrets.DEPLOY_URL }} | |
space: Core Platform | |
api_key: ${{ secrets.DEPLOY_API_KEY }} | |
packages: | | |
./artifacts/Octopus.Client.${{ needs.build.outputs.octoversion_fullsemver }}.nupkg | |
./artifacts/Octopus.Server.Client.${{ needs.build.outputs.octoversion_fullsemver }}.nupkg | |
- name: Create Release in Octopus 🐙 | |
uses: OctopusDeploy/create-release-action@v3 | |
with: | |
server: ${{ secrets.DEPLOY_URL }} | |
space: Core Platform | |
api_key: ${{ secrets.DEPLOY_API_KEY }} | |
project: "Octopus.Client" | |
packages: | | |
Octopus.Client:${{ needs.build.outputs.octoversion_fullsemver }} | |
Octopus.Server.Client:${{ needs.build.outputs.octoversion_fullsemver }} |