-
Notifications
You must be signed in to change notification settings - Fork 4
195 lines (158 loc) · 5.85 KB
/
ci.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
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
186
187
188
189
190
191
192
193
194
195
name: ConfigCat CLI CI
on:
schedule:
- cron: '0 0 * * *'
push:
branches: [ '*' ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Unit tests
run: dotnet test test/ConfigCat.Cli.Tests/ConfigCat.Cli.Tests.csproj -c Release
produce-executables:
runs-on: ubuntu-latest
needs: unit-tests
strategy:
matrix:
arch: [win-x64, win-x86, win-arm64, linux-x64, linux-musl-x64, linux-musl-arm64, linux-arm, linux-arm64]
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Publish ${{ matrix.arch }}
run: |
dotnet publish src/ConfigCat.Cli/ConfigCat.Cli.csproj -c Release -r ${{ matrix.arch }} --self-contained true -p:PublishSingleFile=true -o publish/${{ matrix.arch }}
cp LICENSE publish/${{ matrix.arch }}/LICENSE
cp README.md publish/${{ matrix.arch }}/README.md
- name: Archive executables
uses: actions/upload-artifact@v3
with:
name: executables
path: publish
produce-osx-executable:
runs-on: macos-latest
needs: unit-tests
strategy:
matrix:
arch: [osx-x64, osx-arm64]
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Publish ${{ matrix.arch }}
run: |
dotnet publish src/ConfigCat.Cli/ConfigCat.Cli.csproj -c Release -r ${{ matrix.arch }} --self-contained true -p:PublishSingleFile=true -o publish/${{ matrix.arch }}
cp LICENSE publish/${{ matrix.arch }}/LICENSE
cp README.md publish/${{ matrix.arch }}/README.md
- name: Archive executables
uses: actions/upload-artifact@v3
with:
name: executables
path: publish
linux-snap-tests:
needs: [produce-executables, produce-osx-executable]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download executables
uses: actions/download-artifact@v3
with:
name: executables
- name: Update version in snapcraft
run: sed -i 's/#VERSION_PLACEHOLDER#/0.0.1/g' snap/snapcraft.yaml
- name: Build snap
uses: snapcore/action-build@v1
id: build
- name: Install snap
run: sudo snap install --dangerous ${{ steps.build.outputs.snap }}
- name: Execute tests
shell: pwsh
run: ./test/integ.ps1 configcat ./test
env:
CONFIGCAT_API_HOST: ${{ secrets.CONFIGCAT_API_HOST }}
CONFIGCAT_API_USER: ${{ secrets.CONFIGCAT_API_USER }}
CONFIGCAT_API_PASS: ${{ secrets.CONFIGCAT_API_PASS }}
win-choco-tests:
needs: [produce-executables, produce-osx-executable]
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Download executables
uses: actions/download-artifact@v3
with:
name: executables
- name: Update version in nuspec
run: ((Get-Content -path choco\configcat.nuspec -Raw) -replace '#VERSION_PLACEHOLDER#','0.0.1') | Set-Content -Path choco\configcat.nuspec
shell: powershell
- name: Update version in VERIFICATION.txt
run: ((Get-Content -path choco\VERIFICATION.txt -Raw) -replace '#VERSION_PLACEHOLDER#','${{ env.VERSION }}') | Set-Content -Path choco\VERIFICATION.txt
shell: powershell
- name: Copy LICENSE to choco folder
run: Copy-Item LICENSE -destination choco\LICENSE.txt
shell: powershell
- name: Pack
run: choco pack choco\configcat.nuspec --out .\choco
- name: Install local choco package
run: choco install configcat --source .\choco
- name: Execute tests
shell: pwsh
run: ./test/integ.ps1 configcat ./test
env:
CONFIGCAT_API_HOST: ${{ secrets.CONFIGCAT_API_HOST }}
CONFIGCAT_API_USER: ${{ secrets.CONFIGCAT_API_USER }}
CONFIGCAT_API_PASS: ${{ secrets.CONFIGCAT_API_PASS }}
mac-tests:
needs: [produce-executables, produce-osx-executable]
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Download executables
uses: actions/download-artifact@v3
with:
name: executables
- name: Execute tests
shell: pwsh
run: |
chmod +x ./osx-x64/configcat
./test/integ.ps1 ./osx-x64/configcat ./test
env:
CONFIGCAT_API_HOST: ${{ secrets.CONFIGCAT_API_HOST }}
CONFIGCAT_API_USER: ${{ secrets.CONFIGCAT_API_USER }}
CONFIGCAT_API_PASS: ${{ secrets.CONFIGCAT_API_PASS }}
docker-tests:
needs: [produce-executables, produce-osx-executable]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download executables
uses: actions/download-artifact@v3
with:
name: executables
- name: Set permissions
run: chmod +x ./linux-musl-x64/configcat
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: false
tags: configcat/cli:dev
- name: Execute tests
shell: pwsh
run: ./test/integ.ps1 'docker run --rm --env CONFIGCAT_API_HOST=${{ env.CONFIGCAT_API_HOST }} --env CONFIGCAT_API_USER=${{ env.CONFIGCAT_API_USER }} --env CONFIGCAT_API_PASS=${{ env.CONFIGCAT_API_PASS }} -v $(pwd):/repo configcat/cli:dev' /repo/test
env:
CONFIGCAT_API_HOST: ${{ secrets.CONFIGCAT_API_HOST }}
CONFIGCAT_API_USER: ${{ secrets.CONFIGCAT_API_USER }}
CONFIGCAT_API_PASS: ${{ secrets.CONFIGCAT_API_PASS }}