-
Notifications
You must be signed in to change notification settings - Fork 120
185 lines (175 loc) · 6.59 KB
/
main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
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 }}