CI: merge the two "amalgamate" jobs

This commit is contained in:
Benoit Blanchon
2024-03-18 10:35:31 +01:00
parent 7c62cdb264
commit ef28064317

View File

@ -500,73 +500,51 @@ jobs:
- name: Check - name: Check
run: cmake --build . -- -k 0 run: cmake --build . -- -k 0
amalgamate-h: amalgamate:
needs: gcc needs: gcc
name: Amalgamate ArduinoJson.h name: Amalgamate ArduinoJson.h
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Amalgamate - name: Setup
id: amalgamate
run: | run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/} VERSION=${GITHUB_REF#refs/tags/}
else else
VERSION=${GITHUB_SHA::7} VERSION=${GITHUB_SHA::7}
fi fi
INPUT=src/ArduinoJson.h echo "ARDUINOJSON_H=ArduinoJson-$VERSION.h" >> $GITHUB_ENV
OUTPUT=ArduinoJson-$VERSION.h echo "ARDUINOJSON_HPP=ArduinoJson-$VERSION.hpp" >> $GITHUB_ENV
extras/scripts/build-single-header.sh "$INPUT" "$OUTPUT" - name: Amalgamate ArduinoJson.h
echo "filename=${OUTPUT}" >> $GITHUB_OUTPUT run: extras/scripts/build-single-header.sh "src/ArduinoJson.h" "$ARDUINOJSON_H"
- name: Smoke test - name: Amalgamate ArduinoJson.hpp
run: extras/scripts/build-single-header.sh "src/ArduinoJson.hpp" "$ARDUINOJSON_HPP"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Single headers
path: |
${{ env.ARDUINOJSON_H }}
${{ env.ARDUINOJSON_HPP }}
- name: Smoke test ArduinoJson.h
run: | run: |
g++ -x c++ - <<END g++ -x c++ - <<END
#include "${{ steps.amalgamate.outputs.filename }}" #include "$ARDUINOJSON_H"
int main() { int main() {
JsonDocument doc; JsonDocument doc;
deserializeJson(doc, "{}"); deserializeJson(doc, "{}");
} }
END END
- name: Upload artifact - name: Smoke test ArduinoJson.hpp
uses: actions/upload-artifact@v4
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@v4
- 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 "filename=${OUTPUT}" >> $GITHUB_OUTPUT
- name: Smoke test
run: | run: |
g++ -x c++ - <<END g++ -x c++ - <<END
#include "${{ steps.amalgamate.outputs.filename }}" #include "$ARDUINOJSON_HPP"
int main() { int main() {
ArduinoJson::JsonDocument doc; ArduinoJson::JsonDocument doc;
deserializeJson(doc, "{}"); deserializeJson(doc, "{}");
} }
END END
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Single headers
path: ${{ steps.amalgamate.outputs.filename }}
esp-idf: esp-idf:
needs: gcc needs: gcc