-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
1,301 additions
and
320 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Producer C SDK Codecov | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- master | ||
pull_request: | ||
branches: | ||
- develop | ||
- master | ||
|
||
jobs: | ||
linux-gcc-code-coverage: | ||
runs-on: ubuntu-20.04 | ||
env: | ||
AWS_KVS_LOG_LEVEL: 2 | ||
permissions: | ||
id-token: write | ||
contents: read | ||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v3 | ||
- name: Build repository | ||
run: | | ||
sudo apt install lcov | ||
mkdir build && cd build | ||
cmake .. -DCODE_COVERAGE=TRUE -DBUILD_TEST=TRUE -DBUILD_COMMON_LWS=TRUE | ||
make | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1-node16 | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | ||
role-session-name: ${{ secrets.AWS_ROLE_SESSION_NAME }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
role-duration-seconds: 10800 | ||
- name: Run tests | ||
run: | | ||
cd build | ||
ulimit -c unlimited -S | ||
source ../scripts/get-iot-certs.sh ci | ||
timeout --signal=SIGABRT 150m ./tst/producer_test --gtest_break_on_failure | ||
- name: Generate and process coverage data with lcov | ||
run: | | ||
cd build | ||
lcov --capture --directory CMakeFiles/cproducer.dir --directory CMakeFiles/kvsCommonCurl.dir --directory CMakeFiles/kvsCommonLws.dir --output-file coverage.info | ||
lcov --list coverage.info | ||
lcov --remove coverage.info '*jsmn*' -o coverage_filtered.info | ||
lcov --list coverage_filtered.info | ||
rm coverage.info | ||
bash <(curl -s https://codecov.io/bash) -f ./coverage_filtered.info -t ${{ secrets.CODECOV_TOKEN }} -Z |
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,42 @@ | ||
name: Check Version Mismatch between PR branch and master. | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
check-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout PR branch | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get version from PR | ||
id: pr_version | ||
run: | | ||
PR_VERSION=$(grep -Po 'KinesisVideoProducerC VERSION \K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt) | ||
echo "PR_VERSION=$PR_VERSION" >> "$GITHUB_ENV" | ||
echo "PR Version: $PR_VERSION" | ||
- name: Checkout master branch | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: master | ||
|
||
- name: Get version from master | ||
id: master_version | ||
run: | | ||
MASTER_VERSION=$(grep -Po 'KinesisVideoProducerC VERSION \K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt) | ||
echo "MASTER_VERSION=$MASTER_VERSION" >> "$GITHUB_ENV" | ||
echo "Master version: $MASTER_VERSION" | ||
- name: Compare versions | ||
run: | | ||
echo "Comparing PR Version: $PR_VERSION with Master Version: $MASTER_VERSION" | ||
if [ "$MASTER_VERSION" == "$PR_VERSION" ]; then | ||
echo "Please update the version in CMakeLists.txt file (project(KinesisVideoProducerC VERSION <ver-string> LANGUAGES C). Any PR getting merged to master requires a version update" | ||
exit 1 | ||
else | ||
echo "Version update detected." | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
prefix=$1 | ||
thingName="${prefix}_thing" | ||
thingTypeName="${prefix}_thing_type" | ||
iotPolicyName="${prefix}_policy" | ||
iotRoleName="${prefix}_role" | ||
iotRoleAlias="${prefix}_role_alias" | ||
iotCert="${prefix}_certificate.pem" | ||
iotPublicKey="${prefix}_public.key" | ||
iotPrivateKey="${prefix}_private.key" | ||
|
||
# Create the certificate to which you must attach the policy for IoT that you created above. | ||
aws iot create-keys-and-certificate --set-as-active --certificate-pem-outfile $iotCert --public-key-outfile $iotPublicKey --private-key-outfile $iotPrivateKey > certificate | ||
# Attach the policy for IoT (KvsCameraIoTPolicy created above) to this certificate. | ||
aws iot attach-policy --policy-name $iotPolicyName --target $(jq --raw-output '.certificateArn' certificate) | ||
# Attach your IoT thing (kvs_example_camera_stream) to the certificate you just created: | ||
aws iot attach-thing-principal --thing-name $thingName --principal $(jq --raw-output '.certificateArn' certificate) | ||
# In order to authorize requests through the IoT credentials provider, you need the IoT credentials endpoint which is unique to your AWS account ID. You can use the following command to get the IoT credentials endpoint. | ||
aws iot describe-endpoint --endpoint-type iot:CredentialProvider --output text > iot-credential-provider.txt | ||
# In addition to the X.509 cerficiate created above, you must also have a CA certificate to establish trust with the back-end service through TLS. You can get the CA certificate using the following command: | ||
curl 'https://www.amazontrust.com/repository/SFSRootCAG2.pem' --output cacert.pem | ||
|
||
export AWS_IOT_CORE_CREDENTIAL_ENDPOINT=$(cat iot-credential-provider.txt) | ||
export AWS_IOT_CORE_CERT=$(pwd)"/"$iotCert | ||
export AWS_IOT_CORE_PRIVATE_KEY=$(pwd)"/"$iotPrivateKey | ||
export AWS_IOT_CORE_ROLE_ALIAS=$iotRoleAlias | ||
export AWS_IOT_CORE_THING_NAME=$thingName |
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.