Skip to content

CI Adjustment #357

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

Merged
merged 28 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
65e2d4b
Initial commit for using new CI workflow
TwistedTwigleg Sep 29, 2022
efcdea2
Remove running DeviceAdvisor using builder and instead run via GitHub…
TwistedTwigleg Sep 29, 2022
992abfb
Use correct file paths
TwistedTwigleg Sep 29, 2022
8ddcdf2
Fix DeviceAdvisor not running in CI due to expected file path, add Li…
TwistedTwigleg Sep 29, 2022
7cc0820
Add missing DeviceAdvisor environment variables
TwistedTwigleg Sep 29, 2022
71f8359
Update DeviceAdvisor config
TwistedTwigleg Sep 29, 2022
563944b
Increase keep alive and ping timeout to prevent timeout errors
TwistedTwigleg Sep 29, 2022
3b9fd84
Add Linux Smoke test to CI, adjust Shadows and Jobs samples to allow …
TwistedTwigleg Sep 29, 2022
c3b23d0
Fix PKCS11 library path issue
TwistedTwigleg Sep 29, 2022
65c1d84
Increase TCP timeout for DeviceAdvisor to prevent exceptions, fix Sha…
TwistedTwigleg Sep 29, 2022
94685f5
Adjust all samples not to print endpoint or client ID when running in…
TwistedTwigleg Sep 29, 2022
a378550
Fix fleet provisioning sample not running in CI, only print certifica…
TwistedTwigleg Sep 29, 2022
fdf50d3
Enclose JSON being sent to fleet provisioning sample in double qoutes
TwistedTwigleg Sep 29, 2022
533dbf0
Third time is a charm with JSON formatting fixes
TwistedTwigleg Sep 29, 2022
c577e7e
Remove all Codebuild samples except PubSub since we are now testing i…
TwistedTwigleg Sep 29, 2022
1ea1e2c
Make sure each ClientID is unique in DA run to see if that fixes unex…
TwistedTwigleg Sep 29, 2022
360453d
Fix typo in mqtt_subscribe, generate a unique client ID for each sample
TwistedTwigleg Sep 29, 2022
d40a96d
Fix generate_client_id function
TwistedTwigleg Sep 29, 2022
9016040
More fixes
TwistedTwigleg Sep 29, 2022
4f1941f
Use environment variables for path to utils folder and samples folder…
TwistedTwigleg Sep 29, 2022
8dde1c1
Reduce timeouts to 1 minute for DeviceAdvisor to see if that changes …
TwistedTwigleg Sep 29, 2022
6193f60
Fix S3 logging and attach policy to certificate
TwistedTwigleg Sep 29, 2022
c129714
Add job description step to Python Jobs sample, making it like the ot…
TwistedTwigleg Sep 29, 2022
3b12388
Sync run_sample_ci
TwistedTwigleg Sep 30, 2022
5fe925f
Run Windows Cert Connect sample in CI
TwistedTwigleg Oct 3, 2022
82f1dab
Add missing arguments to Windows Cert Connect sample
TwistedTwigleg Oct 3, 2022
affee78
Move installing Boto3 to independent step
TwistedTwigleg Oct 4, 2022
7a885ab
Merge branch 'main' into NewCIWorkflow
TwistedTwigleg Oct 4, 2022
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
175 changes: 172 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,206 @@ env:
PACKAGE_NAME: aws-iot-device-sdk-python-v2
LINUX_BASE_IMAGE: ubuntu-16-x64
RUN: ${{ github.run_id }}-${{ github.run_number }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_DATEST_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_DATEST_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
DA_TOPIC: test/da
DA_SHADOW_PROPERTY: datest
DA_SHADOW_VALUE_SET: ON
DA_SHADOW_VALUE_DEFAULT: OFF
CI_UTILS_FOLDER: "./aws-iot-device-sdk-python-v2/utils"
CI_SAMPLES_FOLDER: "./aws-iot-device-sdk-python-v2/samples"
CI_IOT_CONTAINERS: ${{ secrets.AWS_CI_IOT_CONTAINERS }}
CI_PUBSUB_ROLE: ${{ secrets.AWS_CI_PUBSUB_ROLE }}
CI_CUSTOM_AUTHORIZER_ROLE: ${{ secrets.AWS_CI_CUSTOM_AUTHORIZER_ROLE }}
CI_SHADOW_ROLE: ${{ secrets.AWS_CI_SHADOW_ROLE }}
CI_JOBS_ROLE: ${{ secrets.AWS_CI_JOBS_ROLE }}
CI_FLEET_PROVISIONING_ROLE: ${{ secrets.AWS_CI_FLEET_PROVISIONING_ROLE }}
CI_DEVICE_ADVISOR: ${{ secrets.AWS_CI_DEVICE_ADVISOR_ROLE }}

jobs:

al2:
runs-on: ubuntu-latest
permissions:
id-token: write # This is required for requesting the JWT
steps:
# We can't use the `uses: docker://image` version yet, GitHub lacks authentication for actions -> packages
- name: configure AWS credentials (containers)
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ env.CI_IOT_CONTAINERS }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
# We can't use the `uses: docker://image` version yet, GitHub lacks authentication for actions -> packages
- name: Build ${{ env.PACKAGE_NAME }}
run: |
aws s3 cp s3://aws-crt-test-stuff/ci/${{ env.BUILDER_VERSION }}/linux-container-ci.sh ./linux-container-ci.sh && chmod a+x ./linux-container-ci.sh
./linux-container-ci.sh ${{ env.BUILDER_VERSION }} aws-crt-al2-x64 build -p ${{ env.PACKAGE_NAME }}

windows:
runs-on: windows-latest
permissions:
id-token: write # This is required for requesting the JWT
steps:
- name: Build ${{ env.PACKAGE_NAME }}
run: |
python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
python builder.pyz build -p ${{ env.PACKAGE_NAME }}
- name: Running samples in CI setup
run: |
python -m pip install boto3
- name: configure AWS credentials (PubSub)
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ env.CI_PUBSUB_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run PubSub sample
run: |
python ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --language Python --sample_file "${{ env.CI_SAMPLES_FOLDER }}/pubsub.py" --sample_region ${{ env.AWS_DEFAULT_REGION }} --sample_secret_endpoint 'ci/endpoint' --sample_secret_certificate 'ci/PubSub/cert' --sample_secret_private_key 'ci/PubSub/key'
- name: run Windows Certificate Connect sample
run: |
python ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --language Python --sample_file "${{ env.CI_SAMPLES_FOLDER }}/windows_cert_connect.py" --sample_region ${{ env.AWS_DEFAULT_REGION }} --sample_secret_endpoint 'ci/endpoint' --sample_secret_certificate 'ci/PubSub/cert' --sample_secret_private_key 'ci/PubSub/key' --sample_run_certutil true
- name: configure AWS credentials (Device Advisor)
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ env.CI_DEVICE_ADVISOR }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run DeviceAdvisor
run: |
cd ./aws-iot-device-sdk-python-v2
python ./deviceadvisor/script/DATestRun.py

osx:
runs-on: macos-latest
permissions:
id-token: write # This is required for requesting the JWT
steps:
- name: Build ${{ env.PACKAGE_NAME }}
run: |
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')"
chmod a+x builder
./builder build -p ${{ env.PACKAGE_NAME }}
- name: Running samples in CI setup
run: |
python3 -m pip install boto3
- name: configure AWS credentials (PubSub)
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ env.CI_PUBSUB_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run PubSub sample
run: |
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --language Python --sample_file "${{ env.CI_SAMPLES_FOLDER }}/pubsub.py" --sample_region ${{ env.AWS_DEFAULT_REGION }} --sample_secret_endpoint 'ci/endpoint' --sample_secret_certificate 'ci/PubSub/cert' --sample_secret_private_key 'ci/PubSub/key'
- name: configure AWS credentials (Device Advisor)
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ env.CI_DEVICE_ADVISOR }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run DeviceAdvisor
run: |
cd ./aws-iot-device-sdk-python-v2
python3 ./deviceadvisor/script/DATestRun.py

linux:
runs-on: ubuntu-20.04 # latest
permissions:
id-token: write # This is required for requesting the JWT
steps:
- name: Build ${{ env.PACKAGE_NAME }}
run: |
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')"
chmod a+x builder
./builder build -p ${{ env.PACKAGE_NAME }}
- name: Running samples in CI setup
run: |
python3 -m pip install boto3
- name: configure AWS credentials (PubSub)
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ env.CI_PUBSUB_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run PubSub sample
run: |
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --language Python --sample_file "${{ env.CI_SAMPLES_FOLDER }}/pubsub.py" --sample_region ${{ env.AWS_DEFAULT_REGION }} --sample_secret_endpoint 'ci/endpoint' --sample_secret_certificate 'ci/PubSub/cert' --sample_secret_private_key 'ci/PubSub/key'
- name: configure AWS credentials (Device Advisor)
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ env.CI_DEVICE_ADVISOR }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run DeviceAdvisor
run: |
cd ./aws-iot-device-sdk-python-v2
python3 ./deviceadvisor/script/DATestRun.py

# Runs the samples and ensures that everything is working
linux-smoke-tests:
runs-on: ubuntu-latest
permissions:
id-token: write # This is required for requesting the JWT
steps:
- name: Build ${{ env.PACKAGE_NAME }}
run: |
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')"
chmod a+x builder
./builder build -p ${{ env.PACKAGE_NAME }}
- name: Running samples in CI setup
run: |
python3 -m pip install boto3
sudo apt-get update -y
sudo apt-get install softhsm -y
softhsm2-util --version
- name: configure AWS credentials (Connect and PubSub)
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ env.CI_PUBSUB_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run Basic Connect sample
run: |
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --language Python --sample_file "${{ env.CI_SAMPLES_FOLDER }}/basic_connect.py" --sample_region ${{ env.AWS_DEFAULT_REGION }} --sample_secret_endpoint 'ci/endpoint' --sample_secret_certificate 'ci/PubSub/cert' --sample_secret_private_key 'ci/PubSub/key'
- name: run Websocket Connect sample
run: |
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --language Python --sample_file "${{ env.CI_SAMPLES_FOLDER }}/websocket_connect.py" --sample_region ${{ env.AWS_DEFAULT_REGION }} --sample_secret_endpoint 'ci/endpoint' --sample_arguments '--signing_region us-east-1'
- name: run PubSub sample
run: |
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --language Python --sample_file "${{ env.CI_SAMPLES_FOLDER }}/pubsub.py" --sample_region ${{ env.AWS_DEFAULT_REGION }} --sample_secret_endpoint 'ci/endpoint' --sample_secret_certificate 'ci/PubSub/cert' --sample_secret_private_key 'ci/PubSub/key'
- name: run PKCS11 Connect sample
run: |
mkdir -p /tmp/tokens
export SOFTHSM2_CONF=/tmp/softhsm2.conf
echo "directories.tokendir = /tmp/tokens" > /tmp/softhsm2.conf
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --language Python --sample_file "${{ env.CI_SAMPLES_FOLDER }}/pkcs11_connect.py" --sample_region ${{ env.AWS_DEFAULT_REGION }} --sample_secret_endpoint 'ci/endpoint' --sample_secret_certificate 'ci/PubSub/cert' --sample_secret_private_key 'ci/PubSub/keyp8' --sample_run_softhsm 'true' --sample_arguments '--pkcs11_lib /usr/lib/softhsm/libsofthsm2.so --pin 0000 --token_label my-token --key_label my-key'
- name: configure AWS credentials (Custom Authorizer)
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ env.CI_CUSTOM_AUTHORIZER_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run CustomAuthorizerConnect sample
run: |
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --language Python --sample_file "${{ env.CI_SAMPLES_FOLDER }}/custom_authorizer_connect.py" --sample_region ${{ env.AWS_DEFAULT_REGION }} --sample_secret_endpoint 'ci/endpoint' --sample_secret_custom_authorizer_name 'ci/CustomAuthorizer/name' --sample_secret_custom_authorizer_password 'ci/CustomAuthorizer/password'
- name: configure AWS credentials (Shadow)
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ env.CI_SHADOW_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run Shadow sample
run: |
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --language Python --sample_file "${{ env.CI_SAMPLES_FOLDER }}/shadow.py" --sample_region ${{ env.AWS_DEFAULT_REGION }} --sample_secret_endpoint 'ci/endpoint' --sample_secret_certificate 'ci/Shadow/cert' --sample_secret_private_key 'ci/Shadow/key' --sample_arguments '--thing_name CI_Shadow_Thing'
- name: configure AWS credentials (Jobs)
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ env.CI_JOBS_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run Jobs sample
run: |
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --language Python --sample_file "${{ env.CI_SAMPLES_FOLDER }}/jobs.py" --sample_region ${{ env.AWS_DEFAULT_REGION }} --sample_secret_endpoint 'ci/endpoint' --sample_secret_certificate 'ci/Jobs/cert' --sample_secret_private_key 'ci/Jobs/key' --sample_arguments '--thing_name CI_Jobs_Thing'
- name: configure AWS credentials (Fleet provisioning)
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ env.CI_FLEET_PROVISIONING_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run Fleet Provisioning sample
run: |
echo "Generating UUID for IoT thing"
Sample_UUID=$(python3 -c "import uuid; print (uuid.uuid4())")
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --language Python --sample_file "${{ env.CI_SAMPLES_FOLDER }}/fleetprovisioning.py" --sample_region ${{ env.AWS_DEFAULT_REGION }} --sample_secret_endpoint 'ci/endpoint' --sample_secret_certificate 'ci/FleetProvisioning/cert' --sample_secret_private_key 'ci/FleetProvisioning/key' --sample_arguments "--template_name CI_FleetProvisioning_Template --template_parameters {\"SerialNumber\":\"${Sample_UUID}\"}"
python3 ${{ env.CI_UTILS_FOLDER }}/delete_iot_thing_ci.py --thing_name "Fleet_Thing_${Sample_UUID}" --region "us-east-1"

# check that docs can still build
check-docs:
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,27 @@ to Python by the `awscrt` package ([PyPI](https://pypi.org/project/awscrt/)) ([G
[Step-by-step instructions](./documents/PREREQUISITES.md)

### Install from PyPI

#### MacOS and Linux:

```
python3 -m pip install awsiotsdk
```

#### Windows:

```
python -m pip install awsiotsdk
```

### Install from source
```
# Create a workspace directory to hold all the SDK files
mkdir sdk-workspace
cd sdk-workspace
# Clone the repository
git clone https://github.com/aws/aws-iot-device-sdk-python-v2.git
# Install using Pip
# Install using Pip (use 'python' instead of 'python3' on Windows)
python3 -m pip install ./aws-iot-device-sdk-python-v2
```

Expand Down
7 changes: 0 additions & 7 deletions builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,7 @@
"python3 -m pip install ."
],
"test_steps": [
"python3 -m pip install boto3",
"python3 deviceadvisor/script/DATestRun.py"
],
"env": {
"DA_TOPIC": "test/da",
"DA_SHADOW_PROPERTY": "datest",
"DA_SHADOW_VALUE_SET": "ON",
"DA_SHADOW_VALUE_DEFAULT": "OFF",
"DA_S3_NAME": "aws-iot-sdk-deviceadvisor-logs"
}
}
16 changes: 0 additions & 16 deletions codebuild/samples/connect-auth-linux.sh

This file was deleted.

17 changes: 0 additions & 17 deletions codebuild/samples/connect-linux.sh

This file was deleted.

3 changes: 0 additions & 3 deletions codebuild/samples/linux-smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ phases:
commands:
- echo Build started on `date`
- $CODEBUILD_SRC_DIR/codebuild/samples/setup-linux.sh
- $CODEBUILD_SRC_DIR/codebuild/samples/connect-linux.sh
- $CODEBUILD_SRC_DIR/codebuild/samples/pkcs11-connect-linux.sh
- $CODEBUILD_SRC_DIR/codebuild/samples/pubsub-linux.sh
- $CODEBUILD_SRC_DIR/codebuild/samples/connect-auth-linux.sh
post_build:
commands:
- echo Build completed on `date`
37 changes: 0 additions & 37 deletions codebuild/samples/pkcs11-connect-linux.sh

This file was deleted.

10 changes: 5 additions & 5 deletions deviceadvisor/script/DATestConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"tests" :["MQTT Connect", "MQTT Publish", "MQTT Subscribe", "Shadow Publish", "Shadow Update"],
"test_suite_ids" :
{
"MQTT Connect" : "ejbdzmo3hf3v",
"MQTT Publish" : "euw7favf6an4",
"MQTT Subscribe" : "01o8vo6no7sd",
"Shadow Publish" : "elztm2jebc1q",
"Shadow Update" : "vuydgrbbbfce"
"MQTT Connect" : "mxn32qkm8npn",
"MQTT Publish" : "gcjhujhhz50p",
"MQTT Subscribe" : "nyiuiwx5yxtj",
"Shadow Publish" : "fttdr8ufljnf",
"Shadow Update" : "ng9t8am2jnry"
},
"test_exe_path" :
{
Expand Down
Loading