Protobuf #335
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |