-
-
Notifications
You must be signed in to change notification settings - Fork 9
211 lines (171 loc) · 8.07 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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
jobs:
build:
if: ${{ github.event_name != 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build ./Meshtastic.Cli/Meshtastic.Cli.csproj --no-restore
test:
if: ${{ github.event_name != 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Run device simulator
run: docker run --rm --name device-simulator -d -p 4403:4403 meshtastic/device-simulator
- name: Run tests
run: dotnet test --collect:"XPlat Code Coverage" --settings ./Meshtastic.Test/coverlet.runsettings
- name: Move files up
run: mv ./Meshtastic.Test/TestResults/**/coverage.info ./Meshtastic.Test/TestResults
# For diagnostics
- name: Show test results
run: ls -lR
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./Meshtastic.Test/TestResults/coverage.info
release:
if: ${{ github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Cache python libs
uses: actions/cache@v3
id: cache-pip # needed in if test
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
- name: Upgrade python tools
shell: bash
run: |
python -m pip install --upgrade pip
- name: Get release version string
run: echo "version=$(./scripts/buildinfo.py short)" >> $GITHUB_OUTPUT
id: version
- name: Restore dependencies
run: dotnet restore
- name: Build Meshtastic.Cli and generate NuGet package
run: |
dotnet build -c Release -p:AssemblyVersion=${{ steps.version.outputs.version }} -p:Version=${{ steps.version.outputs.version }} ./Meshtastic.Cli/Meshtastic.Cli.csproj
dotnet pack -c Release -p:AssemblyVersion=${{ steps.version.outputs.version }} -p:Version=${{ steps.version.outputs.version }} ./Meshtastic.Cli/Meshtastic.Cli.csproj
- name: Publish Meshtastic.Cli package to nuget
run: dotnet nuget push ./**/Meshtastic.Cli.*.nupkg --skip-duplicate -k ${{secrets.NUGET_TOKEN}} --source https://api.nuget.org/v3/index.json
- name: Build Meshtastic and generate NuGet package
run: |
dotnet build -c Release -p:AssemblyVersion=${{ steps.version.outputs.version }} -p:Version=${{ steps.version.outputs.version }} ./Meshtastic/Meshtastic.csproj
dotnet pack -c Release -p:AssemblyVersion=${{ steps.version.outputs.version }} -p:Version=${{ steps.version.outputs.version }} ./Meshtastic/Meshtastic.csproj
- name: Publish Meshtastic library package to nuget
run: dotnet nuget push ./Meshtastic/**/Meshtastic.*.nupkg --skip-duplicate -k ${{secrets.NUGET_TOKEN}} --source https://api.nuget.org/v3/index.json
- name: Publish self-contained win-x64
run: dotnet publish ./Meshtastic.Cli/Meshtastic.Cli.csproj -c Release -r win-x64 -o win-x64 --self-contained true -p:IncludeAllContentForSelfExtract=True -p:PublishSingleFile=True -p:AssemblyVersion=${{ steps.version.outputs.version }} -p:Version=${{ steps.version.outputs.version }}
- name: Publish self-contained osx-x64
run: dotnet publish ./Meshtastic.Cli/Meshtastic.Cli.csproj -c Release -r osx-x64 -o osx-x64 --self-contained true -p:IncludeAllContentForSelfExtract=True -p:PublishSingleFile=True -p:AssemblyVersion=${{ steps.version.outputs.version }} -p:Version=${{ steps.version.outputs.version }}
- name: Publish self-contained osx-arm64
run: dotnet publish ./Meshtastic.Cli/Meshtastic.Cli.csproj -c Release -r osx-arm64 -o osx-arm64 --self-contained true -p:IncludeAllContentForSelfExtract=True -p:PublishSingleFile=True -p:AssemblyVersion=${{ steps.version.outputs.version }} -p:Version=${{ steps.version.outputs.version }}
- name: Publish self-contained linux-x64
run: dotnet publish ./Meshtastic.Cli/Meshtastic.Cli.csproj -c Release -r linux-x64 -o linux-x64 --self-contained true -p:IncludeAllContentForSelfExtract=True -p:PublishSingleFile=True -p:AssemblyVersion=${{ steps.version.outputs.version }} -p:Version=${{ steps.version.outputs.version }}
- name: Publish self-contained linux-arm64
run: dotnet publish ./Meshtastic.Cli/Meshtastic.Cli.csproj -c Release -r linux-arm64 -o linux-arm64 --self-contained true -p:IncludeAllContentForSelfExtract=True -p:PublishSingleFile=True -p:AssemblyVersion=${{ steps.version.outputs.version }} -p:Version=${{ steps.version.outputs.version }}
- name: Zip bins
run: |
zip -r win-x64 win-x64
zip -r osx-x64 osx-x64
zip -r osx-arm64 osx-arm64
zip -r linux-x64 linux-x64
zip -r linux-arm64 linux-arm64
# For diagnostics
- name: Show artifacts
run: ls -lR
- name: Create release
uses: actions/create-release@v1
id: create_release
with:
draft: true
prerelease: true
release_name: Meshtastic CLI ${{ steps.version.outputs.version }}
tag_name: v${{ steps.version.outputs.version }}
body: |
Autogenerated by github action, developer should edit as required before publishing...
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Add win-x64 bins to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./win-x64.zip
asset_name: Meshtastic.Cli-win-x64-${{ steps.version.outputs.version }}.zip
asset_content_type: application/zip
- name: Add osx-arm64 bins to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./osx-arm64.zip
asset_name: Meshtastic.Cli-osx-arm64-${{ steps.version.outputs.version }}.zip
asset_content_type: application/zip
- name: Add osx-x64 bins to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./osx-x64.zip
asset_name: Meshtastic.Cli-osx-x64-${{ steps.version.outputs.version }}.zip
asset_content_type: application/zip
- name: Add linux-arm64 bins to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./linux-arm64.zip
asset_name: Meshtastic.Cli-linux-arm64-${{ steps.version.outputs.version }}.zip
asset_content_type: application/zip
- name: Add linux-x64 bins to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./linux-x64.zip
asset_name: Meshtastic.Cli-linux-x64-${{ steps.version.outputs.version }}.zip
asset_content_type: application/zip
- name: Bump version.properties
run: >-
scripts/bump_version.py
- name: Create version.properties pull request
uses: peter-evans/create-pull-request@v3
with:
add-paths: |
version.properties