-
Notifications
You must be signed in to change notification settings - Fork 1
156 lines (156 loc) · 7 KB
/
github-actions.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
154
155
156
on:
push:
branches:
- '*'
paths-ignore:
- README.md
tags:
- '*'
schedule:
- cron: '0 18 * * 0'
env:
solution: './DBTestCompareGenerator.sln'
buildPlatform: Any CPU
buildConfiguration: Release
dBTestCompareGeneratorVersion: 0.1.0
SQL_SERVER: localhost
SQL_SERVERINSTANCE: SQLEXPRESS
SQL_SERVERDBNAME: AdventureWorks2008R2
SQL_SERVER_USERNAME: sa
SQL_SERVER_PASSWORD: yourStrong22Password
jobs:
BuildOnLinux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- shell: pwsh
run: |
$tags = git tag --sort=-creatordate
$tag = $tags[0]
Write-Host "##vso[task.setvariable variable=dBTestCompareGeneratorVersion]$tag"
if: startsWith(github.ref, 'refs/tags/')
- uses: nuget/setup-nuget@v1
- run: nuget restore ${{ env.solution }}
- run: dotnet build --configuration ${{ env.buildConfiguration }} /p:Version=${{ env.dBTestCompareGeneratorVersion }}
- run: docker-compose -f "./DBTestCompareGenerator/docker-compose.yml" up -d
- name: download backup and jdbc driverss
shell: pwsh
run: |
cd .\DBTestCompareGenerator\bin\${{ env.buildConfiguration }}\net6.0
./download-backup-and-jdbc-drivers.ps1
- name: download latest release
shell: pwsh
run: |
cd .\DBTestCompareGenerator\bin\${{ env.buildConfiguration }}\net6.0
echo ${{ github.run_number }}
./download-latest-release.ps1
- name: restore backup
shell: pwsh
run: |
cd .\DBTestCompareGenerator\bin\${{ env.buildConfiguration }}\net6.0
rm -rfv test-definitions
rm -rfv README.md
rm -rfv LICENSE-3RD-PARTY
rm -rfv LICENSE
./restore-backup.ps1
- name: set chmod run DBTestCompareGeneratorr
shell: bash
run: |
cd ./DBTestCompareGenerator/bin/${{ env.buildConfiguration }}/net6.0/
find . -name '*-SNAPSHOT-jar-with-dependencies.jar' -exec mv {} ./ \;
chmod 777 ./DBTestCompareGenerator
chmod 777 "DBTestCompare-"*"-SNAPSHOT-jar-with-dependencies.jar"
ls -alR
./DBTestCompareGenerator
- name: run DBTestCompare
shell: pwsh
run: |
cd .\DBTestCompareGenerator\bin\${{ env.buildConfiguration }}\net6.0
.\set-tokens-for-tests.ps1 -OutDir ".\test-definitions\" -FileType "cmpSqlResults-config.xml" -token "\$\{SQL_SERVER\}|\$\{SQL_SERVERDBNAME\}|\$\{SQL_SERVER_USERNAME\}|\$\{SQL_SERVER_PASSWORD\}" -Value "${{ env.SQL_SERVER }}|${{ env.SQL_SERVERDBNAME }}|${{ env.SQL_SERVER_USERNAME }}|${{ env.SQL_SERVER_PASSWORD }}"
$DBTestCompare = (Resolve-Path ".\DBTestCompare-*-SNAPSHOT-jar-with-dependencies.jar").ToString()
/usr/bin/java -jar $DBTestCompare
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure()
with:
report_paths: '**/TEST-*.xml'
- name: run DBTestCompare
shell: pwsh
run: |
cd .\DBTestCompareGenerator\bin\${{ env.buildConfiguration }}\net6.0
./set-appsettings.ps1 "./" "appsettings.json" "appSettings" "ReadExcelFile|DacpacFolder|Folder|UnpackDacpac" "true|${{ github.workspace }}/Dacpac|${{ github.workspace }}/Current|true" $true
./DBTestCompareGenerator
.\set-tokens-for-tests.ps1 -OutDir ".\test-definitions\" -FileType "cmpSqlResults-config.xml" -token "\$\{SQL_SERVER\}|\$\{SQL_SERVERDBNAME\}|\$\{SQL_SERVER_USERNAME\}|\$\{SQL_SERVER_PASSWORD\}" -Value "${{ env.SQL_SERVER }}|${{ env.SQL_SERVERDBNAME }}|${{ env.SQL_SERVER_USERNAME }}|${{ env.SQL_SERVER_PASSWORD }}"
$DBTestCompare = (Resolve-Path ".\DBTestCompare-*-SNAPSHOT-jar-with-dependencies.jar").ToString()
/usr/bin/java -jar $DBTestCompare
- name: Zip generated objects definition
uses: montudor/[email protected]
with:
args: zip -r ./DBTestCompareGenerator/${{ github.run_id }}.zip ./Current
- name: Publish sql files
uses: actions/upload-artifact@v2
with:
path: ./DBTestCompareGenerator/${{ github.run_id }}.zip
name: definitions
- name: Publish dacpack files
uses: actions/upload-artifact@v2
with:
path: ./Dacpac/${{ env.SQL_SERVERDBNAME }}.dacpac
name: ${{ env.SQL_SERVERDBNAME }}
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure()
with:
report_paths: '**/TEST-*.xml'
- shell: pwsh
run: |
cd .\DBTestCompareGenerator\bin\${{ env.buildConfiguration }}\net6.0
rm -rfv test-definitions zip deploy jdbc_drivers target test-output
rm -f *.bak *.jar *.log
- uses: actions/upload-artifact@v2
with:
path: ./DBTestCompareGenerator/bin/${{ env.buildConfiguration }}/net6.0
name: DBTestCompareGeneratorLinux${{ env.dBTestCompareGeneratorVersion }}
- shell: pwsh
run: compress-archive -path ./DBTestCompareGenerator/bin/${{ env.buildConfiguration }}/net6.0 ./DBTestCompareGenerator/DBTestCompareGeneratorLinux${{ env.dBTestCompareGeneratorVersion }}.zip
- name: check files
shell: bash
run: |
ls -alR
- name: Create Release Linux
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: ./DBTestCompareGenerator/DBTestCompareGeneratorLinux${{ env.dBTestCompareGeneratorVersion }}.zip
tag: DBTestCompareGeneratorLinux_${{ env.dBTestCompareGeneratorVersion }}
name: "DBTestCompareGeneratorLinux Version ${{ env.dBTestCompareGeneratorVersion }}"
skipIfReleaseExists: true
if: success() && startsWith(github.ref, 'refs/tags/')
BuildOnWindows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- shell: powershell
run: |
$tags = git tag --sort=-creatordate
$tag = $tags[0]
Write-Host "##vso[task.setvariable variable=dBTestCompareGeneratorVersion]$tag"
if: startsWith(github.ref, 'refs/tags/')
- uses: nuget/setup-nuget@v1
- run: nuget restore ${{ env.solution }}
- run: dotnet build --configuration ${{ env.buildConfiguration }} /p:Version=${{ env.dBTestCompareGeneratorVersion }}
- uses: actions/upload-artifact@v2
with:
name: DBTestCompareGeneratorWindows${{ env.dBTestCompareGeneratorVersion }}
path: ./DBTestCompareGenerator/bin/${{ env.buildConfiguration }}/net6.0
- shell: powershell
run: compress-archive -path ./DBTestCompareGenerator/bin/${{ env.buildConfiguration }}/net6.0 ./DBTestCompareGenerator/DBTestCompareGeneratorWindows${{ env.dBTestCompareGeneratorVersion }}.zip
- name: Create Release Windows
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: ../DBTestCompareGenerator/DBTestCompareGeneratorWindows${{ env.dBTestCompareGeneratorVersion }}.zip
tag: DBTestCompareGeneratorWindows_${{ env.dBTestCompareGeneratorVersion }}
name: "DBTestCompareGeneratorWindows Version ${{ env.dBTestCompareGeneratorVersion }}"
skipIfReleaseExists: true
if: success() && startsWith(github.ref, 'refs/tags/')