Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added sample github workflow for NativeBlinkTest #135

Merged
merged 1 commit into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NativeBlink/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM vsdockercontainerregistry.azurecr.io/internal/azurespheresdk-int:latest
FROM mcr.microsoft.com/azurespheresdk:latest

RUN apt update && \
apt install -y libncurses5 gdb && \
Expand Down
43 changes: 43 additions & 0 deletions NativeBlink/.github/workflows/NativeBlinkTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Run NativeBlink Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- name: Build the container image
run: |
docker build -t container-image-demo -f $GITHUB_WORKSPACE/NativeBlink/.devcontainer/Dockerfile .

- name: Create and start a container
run: |
docker create -it --name container-demo --mount src="$GITHUB_WORKSPACE",target=/azure-sphere-gallery,type=bind container-image-demo
docker start container-demo

- name: Build the app and run tests in container
run: |
docker exec container-demo bash -c "cd /azure-sphere-gallery/NativeBlink && cmake --preset x86-Debug && cmake --build --preset x86-Debug && ctest --preset x86-Debug --output-junit /azure-sphere-gallery/NativeBlink/TestResults.xml"

- name: Copy test results
run: |
docker cp container-demo:/azure-sphere-gallery/NativeBlink/TestResults.xml $GITHUB_WORKSPACE/NativeBlink/TestResults.xml

- name: Upload test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: ${{ github.workspace }}/NativeBlink/TestResults.xml
36 changes: 36 additions & 0 deletions NativeBlink/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,41 @@
"CMAKE_BUILD_TYPE": "Release"
}
}
],
"buildPresets": [
{
"name": "ARM-Debug",
"configurePreset": "ARM-Debug"
},
{
"name": "ARM-Release",
"configurePreset": "ARM-Release"
},
{
"name": "x86-Debug",
"configurePreset": "x86-Debug"
},
{
"name": "x86-Release",
"configurePreset": "x86-Release"
}
],
"testPresets": [
{
"name": "ARM-Debug",
"configurePreset": "ARM-Debug"
},
{
"name": "ARM-Release",
"configurePreset": "ARM-Release"
},
{
"name": "x86-Debug",
"configurePreset": "x86-Debug"
},
{
"name": "x86-Release",
"configurePreset": "x86-Release"
}
]
}