From 8145a670631d6f19e941d070a165c9bfa32f27d5 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 14 Aug 2024 14:27:11 -0400 Subject: [PATCH] Update prepare release workflow Signed-off-by: Sara Damiano --- .github/workflows/build_examples.yaml | 23 ++++++++---- .github/workflows/compile_platformio.yaml | 2 ++ .github/workflows/prepare_release.yaml | 43 +++++++++++++++-------- 3 files changed, 47 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build_examples.yaml b/.github/workflows/build_examples.yaml index b980d9e..78a0576 100644 --- a/.github/workflows/build_examples.yaml +++ b/.github/workflows/build_examples.yaml @@ -15,8 +15,8 @@ on: type: string jobs: - generate_matrix: - name: Generate Build Scripts + generate_scripts: + name: Generate Install and Build Scripts runs-on: ubuntu-latest if: ${{ ! contains(github.event.head_commit.message, 'ci skip') }} outputs: @@ -27,6 +27,7 @@ jobs: EXAMPLES_TO_BUILD: ${{ inputs.examples_to_build }} steps: + - name: Checkout code - uses: actions/checkout@v4 - name: Setup PlatformIO @@ -42,11 +43,19 @@ jobs: - name: Generate Library Installation Script id: py_libraries run: | - if [ ! -e continuous_integration/install-libraries-arduino-cli.py ] && [ ! -e continuous_integration/install-libraries-platformio.py ] + set -e + if [ "$RUNNER_DEBUG" = "1" ]; then + echo "Enabling debugging!" + set -v + set -x + fi + if [ ! -e continuous_integration/install-libraries-platformio.sh ] && [ ! -e continuous_integration/install-libraries-arduino-cli.sh ] then echo "Generating dependency library installation script" curl -SL https://raw.githubusercontent.com/EnviroDIY/workflows/main/scripts/generate_library_installation_script.py -o generate_library_installation_script.py python -u generate_library_installation_script.py + else + echo "Dependency installation script found" fi - name: Generate Example Build Matrices @@ -75,16 +84,16 @@ jobs: build_ex_arduino: name: Build Examples with Arduino CLI - needs: [determine_library_source, generate_matrix] + needs: [determine_library_source, generate_scripts] uses: ./.github/workflows/compile_arduino_cli.yaml with: library_install_zip: ${{ needs.determine_library_source.outputs.library_install_zip }} - arduino_job_matrix: ${{ needs.generate_matrix.outputs.arduino_job_matrix }} + arduino_job_matrix: ${{ needs.generate_scripts.outputs.arduino_job_matrix }} build_pio: name: Build Examples with PlatformIO - needs: [determine_library_source, generate_matrix] + needs: [determine_library_source, generate_scripts] uses: ./.github/workflows/compile_platformio.yaml with: library_install_git: ${{ needs.determine_library_source.outputs.library_install_git }} - pio_job_matrix: ${{ needs.generate_matrix.outputs.pio_job_matrix }} + pio_job_matrix: ${{ needs.generate_scripts.outputs.pio_job_matrix }} diff --git a/.github/workflows/compile_platformio.yaml b/.github/workflows/compile_platformio.yaml index afc5a42..baa34ea 100644 --- a/.github/workflows/compile_platformio.yaml +++ b/.github/workflows/compile_platformio.yaml @@ -56,6 +56,8 @@ jobs: then echo "No dependecy installation script found, copying script from artifact" mv continuous_integration_artifacts/install-libraries-platformio.sh continuous_integration/install-libraries-platformio.sh + else + echo "No library dependencies to install" fi - name: Restore PlatformIO platforms diff --git a/.github/workflows/prepare_release.yaml b/.github/workflows/prepare_release.yaml index 6154212..b72707b 100644 --- a/.github/workflows/prepare_release.yaml +++ b/.github/workflows/prepare_release.yaml @@ -55,12 +55,15 @@ jobs: echo "version=${VER}" >> $GITHUB_OUTPUT echo "zip_name=${ZIP_FILE}" >> $GITHUB_OUTPUT + check_for_dependencies: + name: Check for any library dependencies + uses: ./.github/workflows/check_for_dependencies.yaml + prepare_assets: name: Prepare Release Assets runs-on: ubuntu-latest - needs: [check_version_number] - outputs: - valid_lib_dep_script: ${{ steps.check_lib_install.outputs.valid_lib_dep_script }} + needs: [check_version_number, check_for_dependencies] + if: ${{ ! failure() && ! cancelled() && needs.check_for_dependencies.outputs.has_dependencies == 'true' }} steps: - name: Checkout code @@ -70,7 +73,7 @@ jobs: uses: EnviroDIY/setup-platformio-action@v1.0.2 - name: Generate Library Installation Script - id: make_dep_install_script + id: py_libraries run: | set -e if [ "$RUNNER_DEBUG" = "1" ]; then @@ -83,15 +86,26 @@ jobs: echo "Generating dependency library installation script" curl -SL https://raw.githubusercontent.com/EnviroDIY/workflows/main/scripts/generate_library_installation_script.py -o generate_library_installation_script.py python -u generate_library_installation_script.py - if [ -e continuous_integration_artifacts/install-libraries-platformio.sh ] - then - echo "Copying generated installation" - mv continuous_integration_artifacts/install-libraries-platformio.sh continuous_integration/install-libraries-platformio.sh - else - echo "No library dependencies to install" - fi else - echo "Dependency installation script found at continuous_integration/install-libraries-platformio.sh" + echo "Dependency installation script found" + fi + + - name: copy scripts into working directory, if needed + id: copy_scripts + run: | + set -e + if [ "$RUNNER_DEBUG" = "1" ]; then + echo "Enabling debugging!" + set -v + set -x + fi + mkdir -p continuous_integration + if [ ! -e continuous_integration/install-libraries-platformio.sh ] && [ -e continuous_integration_artifacts/install-libraries-platformio.sh ] + then + echo "No dependecy installation script found, copying script from artifact" + mv continuous_integration_artifacts/install-libraries-platformio.sh continuous_integration/install-libraries-platformio.sh + else + echo "No library dependencies to install" fi - name: Verify the library deps install script exists @@ -134,6 +148,7 @@ jobs: - name: Install the library from the master branch run: | pio pkg install -g --library https://github.com/EnviroDIY/${GITHUB_REPOSITORY#*/} + pio pkg list -g --only-libraries # zip up all the installed libraries # need to cd into the pio directory so we don't get extra junk directories @@ -167,7 +182,7 @@ jobs: name: Create a Release with Assets runs-on: ubuntu-latest needs: [check_version_number, prepare_assets] - if: ${{ ! failure() && ! cancelled() && needs.prepare_assets.outputs.valid_lib_dep_script == 'true' }} + if: ${{ ! failure() && ! cancelled() && needs.check_for_dependencies.outputs.has_dependencies == 'true' }} steps: - name: Checkout code @@ -208,7 +223,7 @@ jobs: name: Create a New Release runs-on: ubuntu-latest needs: [check_version_number] - if: ${{ ! failure() && ! cancelled() && needs.prepare_assets.outputs.valid_lib_dep_script != 'true' }} + if: ${{ ! failure() && ! cancelled() && needs.check_for_dependencies.outputs.has_dependencies == 'false' }} steps: - name: Checkout code