From 52d99b4d86488fa8d4cc264924bf7c7619da4a05 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Sun, 25 Aug 2024 11:57:59 -0400 Subject: [PATCH] Update workflows Signed-off-by: Sara Damiano --- .github/workflows/build_examples.yaml | 18 +++++ .../workflows/build_examples_platformio.yaml | 38 --------- .github/workflows/changelog_reminder.yaml | 18 +++++ .github/workflows/prepare_release.yaml | 77 +++++++------------ .../workflows/verify_library_structure.yaml | 17 ++++ .gitignore | 1 + ChangeLog.md | 1 + 7 files changed, 84 insertions(+), 86 deletions(-) create mode 100644 .github/workflows/build_examples.yaml delete mode 100644 .github/workflows/build_examples_platformio.yaml create mode 100644 .github/workflows/changelog_reminder.yaml create mode 100644 .github/workflows/verify_library_structure.yaml diff --git a/.github/workflows/build_examples.yaml b/.github/workflows/build_examples.yaml new file mode 100644 index 0000000..1313c55 --- /dev/null +++ b/.github/workflows/build_examples.yaml @@ -0,0 +1,18 @@ +name: Build Examples + +# Triggers the workflow on push or pull request events +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build_examples: + name: Build all examples with PlatformIO and the Arduino CLI + if: ${{ ! contains(github.event.head_commit.message, 'ci skip') }} + uses: EnviroDIY/workflows/.github/workflows/build_examples.yaml@main + with: + boards_to_build: 'all' + examples_to_build: 'examples/now, examples/temperature, examples/adjust, examples/PCsync' + secrets: inherit diff --git a/.github/workflows/build_examples_platformio.yaml b/.github/workflows/build_examples_platformio.yaml deleted file mode 100644 index d14d3c3..0000000 --- a/.github/workflows/build_examples_platformio.yaml +++ /dev/null @@ -1,38 +0,0 @@ -name: Build Examples with PlatformIO - -# Triggers the workflow on push or pull request events -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - if: "!contains(github.event.head_commit.message, 'ci skip')" - - strategy: - matrix: - example: - [ - examples/now/, - examples/temperature/, - examples/adjust/, - examples/PCsync/ - ] - - steps: - - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Install PlatformIO - run: | - python -m pip install --upgrade pip - pip install --upgrade platformio - - - name: Run PlatformIO - env: - PLATFORMIO_CI_SRC: ${{ matrix.example }} - run: | - platformio ci --lib="." --board=mayfly diff --git a/.github/workflows/changelog_reminder.yaml b/.github/workflows/changelog_reminder.yaml new file mode 100644 index 0000000..cf35380 --- /dev/null +++ b/.github/workflows/changelog_reminder.yaml @@ -0,0 +1,18 @@ +on: pull_request +name: Changelog Reminder +jobs: + remind: + name: Changelog Reminder + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token + + - name: Changelog Reminder + uses: peterjgrainger/action-changelog-reminder@v1.3.0 + with: + changelog_regex: '/CHANGELOG\/.*\/*.md/i' + customPrMessage: 'Please add your changes to the change log!' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/prepare_release.yaml b/.github/workflows/prepare_release.yaml index 966264a..8b9982b 100644 --- a/.github/workflows/prepare_release.yaml +++ b/.github/workflows/prepare_release.yaml @@ -7,60 +7,41 @@ on: - 'VERSION' # Push events when the VERSION file changes workflow_dispatch: -name: Prepare a new release and add release assets +name: Create a New Release env: PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }} jobs: - release: - name: Prepare a new release + wait_for_checks: + if: ${{ github.event_name != 'workflow_dispatch' }} + strategy: + matrix: + req_workflow: + [ + verify_library_structure.yaml, + build_examples.yaml, + ] + name: Wait for Checks to complete runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set environment variable for current library version - run: | - echo "::debug::Get the current version number" - VER=$(cat VERSION) - ZIP_FILE="ModularSensors_Dependencies_${VER}" - echo "VERSION=$VER" >> $GITHUB_ENV - echo "ZIP_NAME=$ZIP_FILE" >> $GITHUB_ENV - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Install PlatformIO - run: | - python -m pip install --upgrade pip - pip install --upgrade platformio - - - name: Get notes - id: generate_notes - uses: anmarkoulis/commitizen-changelog-reader@master - with: - # NOTE: Need to add the refs/tags to work with the generate notes action - tag_name: ${{ format('refs/tags/{0}', env.VERSION) }} - changelog: ChangeLog.md - - # Create a new release - - name: Create Release - id: create_release - uses: actions/create-release@v1.1.4 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Wait on Workflow + uses: ArcticLampyrid/action-wait-for-workflow@v1.2.0 with: - tag_name: ${{ env.VERSION }} - release_name: ${{ env.VERSION }} - draft: false - prerelease: false - body: ${{join(fromJson(steps.generate_notes.outputs.notes).notes, '')}} + workflow: ${{ matrix.req_workflow }} + sha: ${{ github.sha || github.event.pull_request.head.sha || github.event.pull_request.head.ref }} # optional + allowed-conclusions: | + success + cancelled + skipped - # Publish the new release to the pio package manager - - name: Publish release to PIO - id: publish-pio - run: pio package publish + release: + name: Prepare a new release + needs: [wait_for_checks] + if: | + always() && + (needs.wait_for_checks.result == 'success' || needs.wait_for_checks.result == 'skipped') + uses: EnviroDIY/workflows/.github/workflows/prepare_release.yaml@main + secrets: inherit + with: + include_dependencies: false diff --git a/.github/workflows/verify_library_structure.yaml b/.github/workflows/verify_library_structure.yaml new file mode 100644 index 0000000..971b387 --- /dev/null +++ b/.github/workflows/verify_library_structure.yaml @@ -0,0 +1,17 @@ +name: Verify library manifest and structure + +# Triggers the workflow on push or pull request events +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + verify_library_structure: + name: Validate library structure + if: ${{ ! contains(github.event.head_commit.message, 'ci skip') }} + uses: EnviroDIY/workflows/.github/workflows/verify_library_structure.yaml@main + with: + library-manager: 'update' + library-compliance: 'permissive' diff --git a/.gitignore b/.gitignore index 90e992f..0dd218d 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,4 @@ examples/PCsync/PCsync.exe *.tar.gz examples/PCsync/python3.9/PCsync3.spec examples/PCsync/python3.9/dist/PCsync3.exe +arduino_lint.json diff --git a/ChangeLog.md b/ChangeLog.md index eea49de..1d39b7d 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Changed to PC sync program to require the port number as input and to allow specifying the timezone. +- Update workflows ### Fixed