mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	CI: build single headers
This commit is contained in:
		
							
								
								
									
										70
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										70
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							| @@ -335,7 +335,7 @@ jobs: | ||||
|       - name: Upload HTML report | ||||
|         uses: actions/upload-artifact@v2 | ||||
|         with: | ||||
|           name: coverage | ||||
|           name: Coverage report | ||||
|           path: coverage | ||||
|       - name: Upload to Coveralls | ||||
|         uses: coverallsapp/github-action@master | ||||
| @@ -379,3 +379,71 @@ jobs: | ||||
|           CXX: clang++-10 | ||||
|       - name: Check | ||||
|         run: cmake --build . -- -k 0 | ||||
|  | ||||
|   amalgamate-h: | ||||
|     needs: gcc | ||||
|     name: Amalgamate ArduinoJson.h | ||||
|     runs-on: ubuntu-20.04 | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v2 | ||||
|       - name: Amalgamate | ||||
|         id: amalgamate | ||||
|         run: | | ||||
|           if [[ $GITHUB_REF == refs/tags/* ]]; then | ||||
|             VERSION=${GITHUB_REF#refs/tags/} | ||||
|           else | ||||
|             VERSION=${GITHUB_SHA::7} | ||||
|           fi | ||||
|           INPUT=src/ArduinoJson.h | ||||
|           OUTPUT=ArduinoJson-$VERSION.h | ||||
|           extras/scripts/build-single-header.sh "$INPUT" "$OUTPUT" | ||||
|           echo ::set-output name=filename::${OUTPUT} | ||||
|       - name: Smoke test | ||||
|         run: | | ||||
|           g++ -x c++ - <<END | ||||
|           #include "${{ steps.amalgamate.outputs.filename }}" | ||||
|           int main() { | ||||
|             StaticJsonDocument<300> doc; | ||||
|             deserializeJson(doc, "{}"); | ||||
|           } | ||||
|           END | ||||
|       - name: Upload artifact | ||||
|         uses: actions/upload-artifact@v2 | ||||
|         with: | ||||
|           name: Single headers | ||||
|           path: ${{ steps.amalgamate.outputs.filename }} | ||||
|  | ||||
|   amalgamate-hpp: | ||||
|     needs: gcc | ||||
|     name: Amalgamate ArduinoJson.hpp | ||||
|     runs-on: ubuntu-20.04 | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v2 | ||||
|       - name: Amalgamate | ||||
|         id: amalgamate | ||||
|         run: | | ||||
|           if [[ $GITHUB_REF == refs/tags/* ]]; then | ||||
|             VERSION=${GITHUB_REF#refs/tags/} | ||||
|           else | ||||
|             VERSION=${GITHUB_SHA::7} | ||||
|           fi | ||||
|           INPUT=src/ArduinoJson.hpp | ||||
|           OUTPUT=ArduinoJson-$VERSION.hpp | ||||
|           extras/scripts/build-single-header.sh "$INPUT" "$OUTPUT" | ||||
|           echo ::set-output name=filename::${OUTPUT} | ||||
|       - name: Smoke test | ||||
|         run: | | ||||
|           g++ -x c++ - <<END | ||||
|           #include "${{ steps.amalgamate.outputs.filename }}" | ||||
|           int main() { | ||||
|             ArduinoJson::StaticJsonDocument<300> doc; | ||||
|             deserializeJson(doc, "{}"); | ||||
|           } | ||||
|           END | ||||
|       - name: Upload artifact | ||||
|         uses: actions/upload-artifact@v2 | ||||
|         with: | ||||
|           name: Single headers | ||||
|           path: ${{ steps.amalgamate.outputs.filename }} | ||||
|   | ||||
| @@ -2,7 +2,6 @@ | ||||
|  | ||||
| set -e | ||||
|  | ||||
| TAG=$(git describe) | ||||
| RE_RELATIVE_INCLUDE='^#include[[:space:]]*"(.*)"' | ||||
| RE_ABSOLUTE_INCLUDE='^#include[[:space:]]*<(ArduinoJson/.*)>' | ||||
| RE_SYSTEM_INCLUDE='^#include[[:space:]]*<(.*)>' | ||||
| @@ -58,25 +57,8 @@ simplify_namespaces() { | ||||
| 	rm -f "$1.bak" | ||||
| } | ||||
|  | ||||
| cd $(dirname $0)/../.. | ||||
| INCLUDED=() | ||||
| process src/ArduinoJson.h true > ../ArduinoJson-$TAG.h | ||||
| simplify_namespaces ../ArduinoJson-$TAG.h | ||||
| g++ -x c++ -c -o ../smoketest.o - <<END | ||||
| #include "../ArduinoJson-$TAG.h" | ||||
| int main() { | ||||
| 	StaticJsonDocument<300> doc; | ||||
| 	deserializeJson(doc, "{}"); | ||||
| } | ||||
| END | ||||
|  | ||||
| INCLUDED=() | ||||
| process src/ArduinoJson.hpp true > ../ArduinoJson-$TAG.hpp | ||||
| simplify_namespaces ../ArduinoJson-$TAG.hpp | ||||
| g++ -x c++ -c -o ../smoketest.o - <<END | ||||
| #include "../ArduinoJson-$TAG.hpp" | ||||
| int main() { | ||||
| 	ArduinoJson::StaticJsonDocument<300> doc; | ||||
| 	ArduinoJson::deserializeJson(doc, "{}"); | ||||
| } | ||||
| END | ||||
| INPUT=$1 | ||||
| OUTPUT=$2 | ||||
| process "$INPUT" true > "$OUTPUT" | ||||
| simplify_namespaces "$OUTPUT" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user