-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! Migrate device provisioning service
- Loading branch information
1 parent
f7dac75
commit f9b0d8e
Showing
31 changed files
with
4,634 additions
and
103 deletions.
There are no files selected for viewing
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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
name: Run plgd/dps tests with dps_cloud_server and a single configuration | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
build_args: | ||
description: build arguments forwarded to CMake in docker/apps/Dockerfile.cloud-server-debug | ||
type: string | ||
required: true | ||
build_type: | ||
type: string | ||
required: false | ||
default: Debug | ||
skip: | ||
description: Skip this run of the job | ||
type: boolean | ||
required: false | ||
default: false | ||
env: | ||
TEST_DPS_IMAGE: ghcr.io/plgd-dev/hub/test-device-provisioning-service:latest | ||
DPS_DOCKER_TAG: dbg | ||
|
||
jobs: | ||
plgd-hub-test-with-cfg: | ||
if: ${{ !inputs.skip }} | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: "true" | ||
|
||
- name: Configure vm.mmap_rnd_bits for sanitizers | ||
if: contains(inputs.build_args, 'OC_ASAN_ENABLED') || contains(inputs.build_args, 'OC_LSAN_ENABLED') || contains(inputs.build_args, 'OC_TSAN_ENABLED') || contains(inputs.build_args, 'OC_UBSAN_ENABLED') | ||
run: | | ||
sudo sysctl vm.mmap_rnd_bits | ||
sudo sysctl -w vm.mmap_rnd_bits=28 | ||
- name: Build dps-cloudserver docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: false | ||
build-args: | | ||
BUILD_ARGS=${{ inputs.build_args }} | ||
BUILD_TYPE=${{ inputs.build_type }} | ||
file: docker/apps/Dockerfile.dps-cloud-server | ||
tags: ${{ env.DPS_DOCKER_TAG }} | ||
|
||
- name: Pull device-provisioning-service tests image | ||
run: docker pull ${{ env.TEST_DPS_IMAGE }} | ||
|
||
- name: Prepare test environment | ||
run: > | ||
docker run --rm --log-driver local --network=host | ||
-e PREPARE_ENV=true | ||
-e RUN=false | ||
-v /tmp/data:/data | ||
-v /var/run/docker.sock:/var/run/docker.sock | ||
${{ env.TEST_DPS_IMAGE }} | ||
- name: Run dps cloud server docker image | ||
run: > | ||
mkdir -p "/tmp/data/coverage"; | ||
chmod -R 0777 "/tmp/data/coverage"; | ||
docker run --privileged -d --network=host --log-driver local | ||
-v /tmp/data/certs/device:/device-provisioning-client/build/apps/pki_certs | ||
-v /tmp/data/coverage:/data/coverage | ||
--name dps-devsim | ||
dps-dbg:latest | ||
--create-conf-resource | ||
--no-verify-ca | ||
--cloud-observer-max-retry 10 | ||
--expiration-limit 10 | ||
--retry-configuration 5 | ||
--log-level="debug" | ||
--wait-for-reset | ||
dps-devsim-$(hostname) | ||
- name: Run dps cloud server docker image for onboarding | ||
run: > | ||
docker run --privileged -d --network=host --log-driver local | ||
-v /tmp/data/certs/device:/device-provisioning-client/build/apps/pki_certs | ||
-v /tmp/data/coverage:/data/coverage | ||
--name dps-devsim-obt | ||
dps-dbg:latest | ||
--create-conf-resource | ||
--cloud-observer-max-retry 10 | ||
--expiration-limit 10 | ||
--retry-configuration 5 | ||
--log-level="debug" | ||
dps-devsim-obt-$(hostname) "" | ||
- name: Run device-provisioning-service tests image | ||
run: > | ||
docker run --rm --log-driver local --network=host --hostname=$(hostname) | ||
-e PREPARE_ENV=false | ||
-e RUN=true | ||
-v /tmp/data:/data | ||
-v /var/run/docker.sock:/var/run/docker.sock | ||
--name dps-tests | ||
${{ env.TEST_DPS_IMAGE }} | ||
- name: Gather coverage data | ||
run: | | ||
# stop to generate .gcda files | ||
docker stop dps-devsim | ||
# restart to generate report from the .gcda files | ||
docker start dps-devsim | ||
docker exec --workdir "/device-provisioning-client/tools" dps-devsim /bin/bash -c "./collect-coverage.sh --output /data/coverage/coverage.json" | ||
docker stop dps-devsim | ||
# stop to generate .gcda files | ||
docker stop dps-devsim-obt | ||
# restart to generate report from the .gcda files | ||
docker start dps-devsim-obt | ||
docker exec --workdir "/device-provisioning-client/tools" dps-devsim-obt /bin/bash -c "./collect-coverage.sh --output /data/coverage/coverage-obt.json" | ||
docker exec --workdir "/data/coverage" dps-devsim-obt /bin/bash -c 'gcovr --add-tracefile "./*json" --sonarqube --output "/data/coverage/coverage.xml" --verbose' | ||
docker stop dps-devsim-obt | ||
- name: Upload coverage data | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dps-client-coverage | ||
path: /tmp/data/coverage/coverage.xml | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
- name: Collect dps cloud server logs when the test fails | ||
if: ${{ failure() }} | ||
run: | | ||
docker stop dps-devsim | ||
docker logs dps-devsim | ||
- name: Collect dps cloud server (obt) logs when the test fails | ||
if: ${{ failure() }} | ||
run: | | ||
docker stop dps-devsim-obt | ||
docker logs dps-devsim-obt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
name: Run plgd/hub tests with dps_cloud_server | ||
|
||
on: | ||
# Triggers the workflow on push or pull request events but only for the master branch | ||
push: | ||
# branches: [master] | ||
# pull_request: | ||
# branches: [master] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
inputs: | ||
build_type: | ||
description: "Type of the build" | ||
type: string | ||
default: "Debug" | ||
|
||
jobs: | ||
plgd-hub-test: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- build_args: "" | ||
uses: ./.github/workflows/plgd-dps-test-with-cfg.yml | ||
with: | ||
build_args: ${{ matrix.build_args }} | ||
build_type: ${{ (github.event_name == 'workflow_dispatch' && inputs.build_type) || (matrix.build_type || 'Debug') }} | ||
skip: ${{ matrix.skip || false }} |
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 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 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 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 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 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
Oops, something went wrong.