forked from aws/aws-iot-device-sdk-embedded-C
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (107 loc) · 4.6 KB
/
tag-and-zip.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Tag and Create ZIP
on:
workflow_dispatch:
inputs:
commit_id:
description: 'Commit ID to tag and push to remote'
required: true
version_number:
description: 'Tag Version Number (Eg, 202012.00)'
required: true
jobs:
tag-commit:
name: Tag commit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.commit_id }}
- name: Configure git identity
run: |
git config --global user.name "Release Workflow"
- name: Tag Commit and Push to remote
run: |
git tag ${{ github.event.inputs.version_number }} -a -m "AWS IoT Device SDK for Embedded C version ${{ github.event.inputs.version_number }}"
git push origin --tags
- name: Verify tag on remote
run: |
git tag -d ${{ github.event.inputs.version_number }}
git remote update
git checkout tags/${{ github.event.inputs.version_number }}
git diff ${{ github.event.inputs.commit_id }} tags/${{ github.event.inputs.version_number }}
create-zip:
needs: tag-commit
name: Create ZIP and verify package for release asset.
runs-on: ubuntu-latest
steps:
- name: Install ZIP tools
run: sudo apt-get install zip unzip
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.commit_id }}
path: aws-iot-device-sdk-embedded-C
submodules: recursive
- name: Checkout disabled submodules
run: |
cd aws-iot-device-sdk-embedded-C
git submodule update --init --checkout --recursive
- name: Create ZIP
run: |
zip -r aws-iot-device-sdk-embedded-C-${{ github.event.inputs.version_number }}.zip aws-iot-device-sdk-embedded-C -x "*.git*"
ls ./
- name: Validate created ZIP
run: |
mkdir zip-check
mv aws-iot-device-sdk-embedded-C-${{ github.event.inputs.version_number }}.zip zip-check
cd zip-check
unzip aws-iot-device-sdk-embedded-C-${{ github.event.inputs.version_number }}.zip -d aws-iot-device-sdk-embedded-C-${{ github.event.inputs.version_number }}
ls aws-iot-device-sdk-embedded-C-${{ github.event.inputs.version_number }}
diff -r -x "*.git*" aws-iot-device-sdk-embedded-C-${{ github.event.inputs.version_number }}/aws-iot-device-sdk-embedded-C/ ../aws-iot-device-sdk-embedded-C/
cd ../
- name : Build Check Demos
run: |
sudo apt-get install -y libmosquitto-dev
cd zip-check/aws-iot-device-sdk-embedded-C-${{ github.event.inputs.version_number }}/aws-iot-device-sdk-embedded-C/
cmake -S . -B build/ \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror' \
-DAWS_IOT_ENDPOINT="aws-iot-endpoint" \
-DBROKER_ENDPOINT="broker-endpoint" \
-DCLIENT_CERT_PATH="cert/path" \
-DROOT_CA_CERT_PATH="cert/path" \
-DCLIENT_PRIVATE_KEY_PATH="key/path" \
-DCLIENT_IDENTIFIER="ci-identifier" \
-DTHING_NAME="thing-name" \
-DS3_PRESIGNED_GET_URL="get-url" \
-DS3_PRESIGNED_PUT_URL="put-url"
make -C build/ help | grep demo | tr -d '. ' | xargs make -C build/ -j8
make -C demos/jobs/jobs_demo_mosquitto -j8
- name : Build Check Tests
run: |
cd zip-check/aws-iot-device-sdk-embedded-C-${{ github.event.inputs.version_number }}/aws-iot-device-sdk-embedded-C/
rm -rf ./build
cmake -S . -B build/ \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_TESTS=1 \
-DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror' \
-DAWS_IOT_ENDPOINT="aws-iot-endpoint" \
-DBROKER_ENDPOINT="broker-endpoint" \
-DCLIENT_CERT_PATH="cert/path" \
-DROOT_CA_CERT_PATH="cert/path" \
-DCLIENT_PRIVATE_KEY_PATH="key/path" \
-DCLIENT_IDENTIFIER="ci-identifier"
make -C build/ all -j8
- name: Run Unit Tests
run: |
cd zip-check/aws-iot-device-sdk-embedded-C-${{ github.event.inputs.version_number }}/aws-iot-device-sdk-embedded-C/build/
ctest -E system --output-on-failure
cd ..
- name: Create artifact of ZIP
uses: actions/upload-artifact@v2
with:
name: aws-iot-device-sdk-embedded-C-${{ github.event.inputs.version_number }}.zip
path: zip-check/aws-iot-device-sdk-embedded-C-${{ github.event.inputs.version_number }}.zip