-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (130 loc) · 4.47 KB
/
build_and_test.yml
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
name: Build Console application
on:
pull_request:
branches: [ "master" ]
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
version:
description: 'Version to build (major.minor.patch)'
required: true
default: '0.0.0'
env:
slnFile: 'src/ABulkCopy.sln'
consoleProjFile: 'src/ABulkCopy.Cmd/ABulkCopy.Cmd.csproj'
commonTest: 'src/Common.Test/Common.Test.csproj'
asqlserverTest: 'src/ASqlServer.Test/ASqlServer.Test.csproj'
apostgresTest: 'src/APostgres.Test/APostgres.Test.csproj'
aparserTest: 'src/AParser.Test/AParser.Test.csproj'
jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
currentVersion: v${{ steps.gitversion.outputs.SemVer }}
steps:
- name: Checkout all
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install GitVersion
if: github.event_name == 'workflow_dispatch'
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Build
run: dotnet build ${{env.slnFile}}
- name: Determine version
id: gitversion
if: github.event_name == 'workflow_dispatch'
uses: gittools/actions/gitversion/[email protected]
with:
updateAssemblyInfo: true
useConfigFile: true
overrideConfig: |
next-version=${{ github.event.inputs.version }}
- name: Publish
if: github.event_name == 'workflow_dispatch'
run: dotnet publish ${{env.consoleProjFile}} -c Release
- name: Upload program artifact
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: program
path: ./src/ABulkCopy.Cmd/bin/Release/net8.0/win-x64/publish
- name: Display structure of artifact files
run: ls -R
- name: Upload tests artifact
uses: actions/upload-artifact@v4
with:
name: tests
path: |
./src/AParser.Test/bin/Debug/net8.0
./src/APostgres.Test/bin/Debug/net8.0
./src/ASqlServer.Test/bin/Debug/net8.0
./src/Common.Test/bin/Debug/net8.0
./src/End2EndTests/bin/Debug/net8.0
test:
name: Test
runs-on: ubuntu-latest
needs: build
outputs:
currentVersion: ${{ needs.build.outputs.currentVersion }}
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: tests
- name: Display structure of artifact files
run: ls -R
- name: Test AParser
run: dotnet test ./AParser.Test/bin/Debug/net8.0/AParser.Test.dll -v m
- name: Test Common
run: dotnet test ./Common.Test/bin/Debug/net8.0/Common.Test.dll -v m
- name: Test ASqlServer
run: dotnet test ./ASqlServer.Test/bin/Debug/net8.0/ASqlServer.Test.dll -v m -e AppSettings__ConnectionString="${{secrets.MSS_ABULKCOPY_TEST_CONNECTIONSTRING}}"
- name: SqlServer to Postgres end-to-end tests
run: dotnet test ./End2EndTests/bin/Debug/net8.0/End2EndTests.dll -v m
release:
if: github.event_name == 'workflow_dispatch'
name: Release
runs-on: ubuntu-latest
needs: test
env:
currentVersion: ${{ needs.test.outputs.currentVersion }}
steps:
- name: Download program artifact
uses: actions/download-artifact@v4
with:
name: program
- name: Display structure of artifact files
run: ls -R
- name: Zip release files
uses: thedoctor0/[email protected]
with:
type: 'zip'
filename: 'release.zip'
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.currentVersion }}
release_name: Release ${{ env.currentVersion }}
body: |
You can find the release notes [here.](https://arveh.github.io/ABulkCopy.Docs/release_notes/)
draft: false
prerelease: true
- name: List files after zip and creating release
run: ls -R
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./release.zip
asset_name: release-${{ env.currentVersion }}.zip
asset_content_type: application/zip