Skip to content

Commit

Permalink
Update prepare release workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Sara Damiano <[email protected]>
  • Loading branch information
SRGDamia1 committed Aug 14, 2024
1 parent 8124288 commit 8145a67
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 21 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/build_examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -27,6 +27,7 @@ jobs:
EXAMPLES_TO_BUILD: ${{ inputs.examples_to_build }}

steps:
- name: Checkout code
- uses: actions/checkout@v4

- name: Setup PlatformIO
Expand All @@ -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
Expand Down Expand Up @@ -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 }}
2 changes: 2 additions & 0 deletions .github/workflows/compile_platformio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 29 additions & 14 deletions .github/workflows/prepare_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -70,7 +73,7 @@ jobs:
uses: EnviroDIY/[email protected]

- name: Generate Library Installation Script
id: make_dep_install_script
id: py_libraries
run: |
set -e
if [ "$RUNNER_DEBUG" = "1" ]; then
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8145a67

Please sign in to comment.