Remove creation of Template folder. (#2112) #4539
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
name: LoRa Build & Test CI | |
on: # rebuild any PRs and main branch changes | |
pull_request: | |
branches: | |
- master | |
- dev | |
paths-ignore: | |
- 'Docs/**' | |
- 'Arduino/**' | |
- 'Samples/**' | |
push: | |
branches: | |
- master | |
- dev | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
env: | |
buildConfiguration: 'Release' | |
AZURE_FUNCTIONAPP_NAME: loramoduleintegrationtest | |
TESTS_FOLDER: Tests | |
TESTS_RESULTS_FOLDER: Tests/TestResults | |
jobs: | |
build_and_test: | |
name: Build and Test Solution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout current branch | |
- uses: actions/setup-dotnet@v3.2.0 | |
with: | |
global-json-file: global.json | |
- name: .NET SDK Information | |
run: dotnet --info | |
- name: Restore Tools | |
run: dotnet tool restore | |
- name: Refresh T4 Generated Code | |
# Re-run all T4 templates to refresh them. | |
run: git ls-files *.tt | xargs -t -n 1 dotnet t4 | |
- name: Check for Modifications | |
# "git diff" with "--exit-code" makes the program exit with codes similar to diff. | |
# That is, it exits with 1 if there were differences and 0 means no differences. | |
# This is to ensure that the last step did not introduce any changes to the working | |
# tree, which would mean that the tracked generated code is not up to date with the | |
# template. The templates should be executed on a local clone (either using VS or | |
# via "dotnet t4") and the (refreshed) generated code committed. | |
run: git diff --exit-code | |
# build LoRa Engine | |
- name: Build LoRa Engine | |
run: dotnet build --configuration ${{ env.buildConfiguration }} | |
# build C# Samples/DecoderSample | |
- name: Build C# Samples/DecoderSample | |
run: dotnet build --configuration ${{ env.buildConfiguration }} Samples/DecoderSample | |
# Run unit tests | |
- name: Run unit tests | |
run: | | |
dotnet test --configuration ${{ env.buildConfiguration }} --no-build \ | |
--logger trx -r ${{ env.TESTS_RESULTS_FOLDER }}/Unit \ | |
/p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:ExcludeByFile="**/${{ env.TESTS_FOLDER }}/" \ | |
${{ env.TESTS_FOLDER }}/Unit/LoRaWan.Tests.Unit.csproj | |
# Pull Redis Cache docker image | |
- name: Pulling Redis Cache image | |
run: docker pull redis:6.0-alpine | |
# Run integration tests | |
- name: Run integration tests | |
run: | | |
dotnet test --configuration ${{ env.buildConfiguration }} --no-build \ | |
--logger trx -r ${{ env.TESTS_RESULTS_FOLDER }}/Integration \ | |
/p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:ExcludeByFile="**/${{ env.TESTS_FOLDER }}/" \ | |
${{ env.TESTS_FOLDER }}/Integration/LoRaWan.Tests.Integration.csproj | |
# Run cli tests | |
- name: Run cli unit tests | |
run: | | |
dotnet test --configuration ${{ env.buildConfiguration }} \ | |
--logger trx -r ${{ env.TESTS_RESULTS_FOLDER }}/Cli.Unit \ | |
/p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:ExcludeByFile="**/${{ env.TESTS_FOLDER }}/" \ | |
./Tools/Cli-LoRa-Device-Provisioning/Tests/LoRaWan.Tools.CLI.Tests.Unit/LoRaWan.Tools.CLI.Tests.Unit.csproj | |
# Upload test results as artifact | |
- uses: actions/upload-artifact@v3 | |
if: success() || failure() | |
with: | |
name: test-results | |
path: | | |
${{ env.TESTS_RESULTS_FOLDER }}/Unit | |
${{ env.TESTS_RESULTS_FOLDER }}/Integration | |
${{ env.TESTS_RESULTS_FOLDER }}/Cli.Unit | |
- name: Upload to Codecov test reports | |
uses: codecov/codecov-action@v3 | |
with: | |
directory: Tests/ | |
build_docker_images: | |
name: Build Docker Images | |
runs-on: ubuntu-latest | |
environment: | |
name: CI | |
steps: | |
- name: Az CLI login | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- uses: actions/checkout@v4 | |
name: Checkout current branch | |
- name: Read Secrets from keyvault | |
uses: ./.github/actions/read_keyvault | |
with: | |
KEY_ARRAY: ('CI-ACR-NAME', 'CI-ACR-CREDENTIALS') | |
KEYVAULT_NAME: ${{ secrets.KEYVAULT_NAME }} | |
- uses: docker/setup-buildx-action@v3 | |
id: buildx | |
with: | |
install: true | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Build docker images | |
run: | | |
echo $CI_ACR_CREDENTIALS | docker login "$CI_ACR_NAME.azurecr.io" --username "$CI_ACR_NAME" --password-stdin | |
CONTAINER_REGISTRY_ADDRESS=$CI_ACR_NAME.azurecr.io docker buildx bake --set *.args.CONTAINER_REGISTRY_ADDRESS=${{ env.CI_ACR_NAME }}.azurecr.io | |
working-directory: LoRaEngine |