diff --git a/.github/workflows/check-markdown-task.yml b/.github/workflows/check-markdown-task.yml index 8fc37a7..3b96f9a 100644 --- a/.github/workflows/check-markdown-task.yml +++ b/.github/workflows/check-markdown-task.yml @@ -41,6 +41,7 @@ on: jobs: run-determination: runs-on: ubuntu-latest + permissions: {} outputs: result: ${{ steps.determination.outputs.result }} steps: @@ -60,27 +61,29 @@ jobs: RESULT="false" fi - echo "::set-output name=result::$RESULT" + echo "result=$RESULT" >> $GITHUB_OUTPUT lint: needs: run-determination if: needs.run-determination.outputs.result == 'true' runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - name: Initialize markdownlint-cli problem matcher - uses: xt0rted/markdownlint-problem-matcher@v1 + uses: xt0rted/markdownlint-problem-matcher@v3 - name: Install Task - uses: arduino/setup-task@v1 + uses: arduino/setup-task@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x @@ -92,21 +95,23 @@ jobs: needs: run-determination if: needs.run-determination.outputs.result == 'true' runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - name: Install Task - uses: arduino/setup-task@v1 + uses: arduino/setup-task@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - name: Check links - run: task --silent markdown:check-links + run: task --silent markdown:check-links \ No newline at end of file diff --git a/.github/workflows/check-workflows-task.yml b/.github/workflows/check-workflows-task.yml index b73584e..1552e1f 100644 --- a/.github/workflows/check-workflows-task.yml +++ b/.github/workflows/check-workflows-task.yml @@ -1,4 +1,4 @@ -# Source: https://github.com/arduino/tooling-project-assets/blob/master/workflow-templates/check-workflows-task.md +# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-workflows-task.md name: Check Workflows env: @@ -28,21 +28,23 @@ on: jobs: validate: runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - name: Install Task - uses: arduino/setup-task@v1 + uses: arduino/setup-task@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - name: Validate workflows - run: task --silent ci:validate + run: task --silent ci:validate \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e55dd3..7276c97 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,6 +18,8 @@ jobs: name: build (${{ matrix.config.os }}, ${{ matrix.config.arch }}) runs-on: ubuntu-latest + permissions: + contents: read strategy: matrix: config: @@ -53,25 +55,22 @@ jobs: id: get_tag_name run: | TAG="${GITHUB_REF##*/}" - echo ::set-output name=AVRDUDE_TAG::v${TAG%%-*} + echo "AVRDUDE_TAG=v${TAG%%-*}" >> $GITHUB_OUTPUT + echo "ARDUINO_TAG=-${TAG#*-}" >> $GITHUB_OUTPUT # this repo should contain only the patches that could not be upstreamed and the release CI nothing else - name: Checkout avrdude-packing repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: avrdude-packing - name: Checkout avrdude repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: avrdudes/avrdude ref: ${{ steps.get_tag_name.outputs.AVRDUDE_TAG }} # pay attention, the pathches could need updating path: ${{ env.PROJECT_NAME }} - - name: Set the version - working-directory: avrdude-packing/patches/ - run: perl -pi -e "s/ARDUINO_VERSION_PLACEHOLDER/${GITHUB_REF##*/}/g" 0008-Append-arduino-to-version-string.patch - - name: Apply patches working-directory: ${{ env.PROJECT_NAME }} run: git apply -v ../avrdude-packing/patches/*.patch @@ -88,11 +87,13 @@ jobs: run: | if [ "${{ matrix.config.os }}" = "macOS" ]; then # For darwin we disable the static flags (not supported by clang) and we make some adjustments - cmake -DCMAKE_C_COMPILER=${{ matrix.config.cross_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cross_compiler }}++ -DCMAKE_AR=${{ matrix.config.ar }} -DCMAKE_LINKER=${{ matrix.config.ld}} -DCMAKE_EXE_LINKER_FLAGS="-L/opt/lib/${{ matrix.config.cross_compile }}/lib/" -DCMAKE_C_FLAGS="-I/opt/lib/${{ matrix.config.cross_compile }}/include -pthread -framework Foundation -framework IOKit -framework Cocoa -framework Security -DHAVE_USB_H" -DCMAKE_PREFIX_PATH=/opt/lib/${{ matrix.config.cross_compile }}/ -DHAVE_LIBFTDI="NO" -DUSE_STATIC_LIBS="ON" -B build/ + cmake -DCMAKE_C_COMPILER=${{ matrix.config.cross_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cross_compiler }}++ -DCMAKE_AR=${{ matrix.config.ar }} -DCMAKE_LINKER=${{ matrix.config.ld}} -DCMAKE_EXE_LINKER_FLAGS="-L/opt/lib/${{ matrix.config.cross_compile }}/lib/" -DCMAKE_C_FLAGS="-I/opt/lib/${{ matrix.config.cross_compile }}/include -pthread -framework Foundation -framework IOKit -framework Cocoa -framework Security -DHAVE_USB_H" -DCMAKE_PREFIX_PATH=/opt/lib/${{ matrix.config.cross_compile }}/ -DHAVE_LIBFTDI="NO" -DUSE_STATIC_LIBS="ON" -DEXTRA_VERSION=${{ env.ARDUINO_TAG }} -B build/ else - cmake -DCMAKE_C_COMPILER=${{ matrix.config.cross_compile }}-gcc -DCMAKE_CXX_COMPILER=${{ matrix.config.cross_compile }}-g++ -DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++" -DCMAKE_C_FLAGS="-I/opt/lib/${{ matrix.config.cross_compile }}/include/libusb-1.0/ -I/opt/lib/${{ matrix.config.cross_compile }}/include -pthread" -DCMAKE_PREFIX_PATH=/opt/lib/${{ matrix.config.cross_compile }}/ -DHAVE_LIBFTDI="NO" -DUSE_STATIC_LIBS="ON" -B build/ + cmake -DCMAKE_C_COMPILER=${{ matrix.config.cross_compile }}-gcc -DCMAKE_CXX_COMPILER=${{ matrix.config.cross_compile }}-g++ -DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++" -DCMAKE_C_FLAGS="-I/opt/lib/${{ matrix.config.cross_compile }}/include/libusb-1.0/ -I/opt/lib/${{ matrix.config.cross_compile }}/include -pthread" -DCMAKE_PREFIX_PATH=/opt/lib/${{ matrix.config.cross_compile }}/ -DHAVE_LIBFTDI="NO" -DUSE_STATIC_LIBS="ON" -DEXTRA_VERSION=${{ env.ARDUINO_TAG }} -B build/ fi cmake --build build/ -v + env: + ARDUINO_TAG: ${{ steps.get_tag_name.outputs.ARDUINO_TAG }} - name: Package working-directory: ${{ env.PROJECT_NAME }} @@ -105,24 +106,26 @@ jobs: tar -czv ${{ env.PROJECT_NAME }}_${{ matrix.config.os }}_${{ matrix.config.arch }} -f ${{ env.PROJECT_NAME }}_${GITHUB_REF##*/}_${{ matrix.config.os }}_${{ matrix.config.arch }}.tar.gz - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: if-no-files-found: error - name: ${{ env.ARTIFACT_NAME }} + name: ${{ env.ARTIFACT_NAME }}_${{ matrix.config.os }}_${{ matrix.config.arch }} path: ${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}_* notarize-macos: runs-on: macos-latest needs: build + permissions: + contents: read steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: ${{ env.ARTIFACT_NAME }} + name: ${{ env.ARTIFACT_NAME }}_macOS_64bit path: ${{ env.DIST_DIR }} - name: Import Code-Signing Certificates @@ -173,26 +176,30 @@ jobs: -C ${{ env.DIST_DIR }}/ ${{ env.PROJECT_NAME }}_macOS_64bit/ - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: if-no-files-found: error - name: ${{ env.ARTIFACT_NAME }} + name: ${{ env.ARTIFACT_NAME }}_macOS_64bit path: ${{ env.DIST_DIR }} - + overwrite: true + create-release: runs-on: ubuntu-latest + permissions: + contents: write needs: [build, notarize-macos] steps: - name: Checkout repository # we need package_index.template - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: ${{ env.ARTIFACT_NAME }} + pattern: ${{ env.ARTIFACT_NAME }}* path: ${{ env.DIST_DIR }} + merge-multiple: true - name: Identify Prerelease # This is a workaround while waiting for create-release action @@ -201,7 +208,7 @@ jobs: run: | wget -q -P /tmp https://github.com/fsaintjacques/semver-tool/archive/3.2.0.zip unzip -p /tmp/3.2.0.zip semver-tool-3.2.0/src/semver >/tmp/semver && chmod +x /tmp/semver - if [[ "$(/tmp/semver get prerel "${GITHUB_REF/refs\/tags\//}")" ]]; then echo "::set-output name=IS_PRE::true"; fi + if [[ "$(/tmp/semver get prerel "${GITHUB_REF/refs\/tags\//}")" ]]; then echo "IS_PRE=true" >> $GITHUB_OUTPUT; fi - name: Generate package index entry run: | diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 9a01386..8d4361c 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -24,14 +24,16 @@ env: jobs: check: runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download JSON schema for labels configuration file id: download-schema - uses: carlosperate/download-file-action@v1 + uses: carlosperate/download-file-action@v2 with: file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/arduino-tooling-gh-label-configuration-schema.json location: ${{ runner.temp }}/label-configuration-schema @@ -55,6 +57,7 @@ jobs: download: needs: check runs-on: ubuntu-latest + permissions: {} strategy: matrix: @@ -64,24 +67,28 @@ jobs: - universal.yml - tooling.yml + steps: - name: Download - uses: carlosperate/download-file-action@v1 + uses: carlosperate/download-file-action@v2 with: file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/${{ matrix.filename }} - name: Pass configuration files to next job via workflow artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: path: | *.yaml *.yml if-no-files-found: error - name: ${{ env.CONFIGURATIONS_ARTIFACT }} + name: ${{ env.CONFIGURATIONS_ARTIFACT }}-${{ matrix.filename }} sync: needs: download runs-on: ubuntu-latest + permissions: + contents: read + issues: write steps: - name: Set environment variables @@ -103,21 +110,22 @@ jobs: run: | # Use of this flag in the github-label-sync command will cause it to only check the validity of the # configuration. - echo "::set-output name=flag::--dry-run" + echo "flag=--dry-run" >> $GITHUB_OUTPUT - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download configuration files artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: ${{ env.CONFIGURATIONS_ARTIFACT }} + pattern: ${{ env.CONFIGURATIONS_ARTIFACT }}-* + merge-multiple: true path: ${{ env.CONFIGURATIONS_FOLDER }} - name: Remove unneeded artifact - uses: geekyeggo/delete-artifact@v1 + uses: geekyeggo/delete-artifact@v5 with: - name: ${{ env.CONFIGURATIONS_ARTIFACT }} + name: ${{ env.CONFIGURATIONS_ARTIFACT }}-* - name: Merge label configuration files run: | @@ -136,4 +144,4 @@ jobs: github-label-sync \ --labels "${{ env.MERGED_CONFIGURATION_PATH }}" \ ${{ steps.dry-run.outputs.flag }} \ - ${{ github.repository }} + ${{ github.repository }} \ No newline at end of file diff --git a/patches/0001-Add-extra-version-information-to-avrdude-output.patch b/patches/0001-Add-extra-version-information-to-avrdude-output.patch new file mode 100644 index 0000000..0b62e5b --- /dev/null +++ b/patches/0001-Add-extra-version-information-to-avrdude-output.patch @@ -0,0 +1,77 @@ +From a52d8145bcd94310d2f737cb56e15d25d9eba86f Mon Sep 17 00:00:00 2001 +From: Hans Ulrich Niedermann +Date: Tue, 8 Oct 2024 21:21:00 +0200 +Subject: [PATCH] Add extra version information to avrdude output + +Some downstream projects build avrdude and want to add +their own version information to the avrdude version. + +This adds a clean way to do that without patching for both +cmake and automake based builds: + + cmake -DEXTRA_VERSION:STRING=-arduino.1-rc1 + ../configure EXTRA_VERSION=-arduino.1-rc1 + +After building avrdude, the last line of "avrdude -?" +will now look similar to the following, depending on +whether you are building an avrdude git checkout or +an avrdude release: + + avrdude version 8.0-20240901-arduino.1-rc1 (30e19f23), https://github.com/avrdudes/avrdude + avrdude version 8.1-arduino.1-rc1 (30e19f23), https://github.com/avrdudes/avrdude +--- + CMakeLists.txt | 5 +++-- + src/configure.ac | 5 +++-- + 2 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 67e38493..b40e5689 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -49,7 +49,7 @@ include(FindPackageMessage) + include(GNUInstallDirs) + + set(CONFIG_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}") +-set(AVRDUDE_FULL_VERSION ${CMAKE_PROJECT_VERSION}) ++set(AVRDUDE_FULL_VERSION "${CMAKE_PROJECT_VERSION}${EXTRA_VERSION}") + + # ===================================== + # Get Git commit info +@@ -91,7 +91,7 @@ if(Git_FOUND) + + # If the commit is not tagged, include the date and commit hash in the full version string. + if(NOT GIT_COMMIT_HASH STREQUAL GIT_TAG_HASH) +- set(AVRDUDE_FULL_VERSION "${CMAKE_PROJECT_VERSION}-${GIT_COMMIT_DATE} (${GIT_COMMIT_HASH})") ++ set(AVRDUDE_FULL_VERSION "${CMAKE_PROJECT_VERSION}-${GIT_COMMIT_DATE}${EXTRA_VERSION} (${GIT_COMMIT_HASH})") + endif() + endif() + +@@ -374,6 +374,7 @@ if (DEBUG_CMAKE) + message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}") + message(STATUS "CONFIG_DIR: ${CONFIG_DIR}") + message(STATUS "AVRDUDE_FULL_VERSION: ${AVRDUDE_FULL_VERSION}") ++ message(STATUS "EXTRA_VERSION: ${EXTRA_VERSION}") + message(STATUS "USE_EXTERNAL_LIBS: ${USE_EXTERNAL_LIBS}") + message(STATUS "USE_LIBUSBWIN32: ${USE_LIBUSBWIN32}") + message(STATUS "HAVE_LIBELF: ${HAVE_LIBELF}") +diff --git a/src/configure.ac b/src/configure.ac +index 91f6a445..c294f590 100644 +--- a/src/configure.ac ++++ b/src/configure.ac +@@ -80,11 +80,12 @@ AC_MSG_RESULT([$PACKAGE_VERSION]) + dnl Compose the full version message mirroring the cmake one, inform + dnl about it and pass it on to avrdude.conf and the "avrdude -?" + dnl version message ++AC_ARG_VAR([EXTRA_VERSION], [extra version information to be added to version info]) + AC_MSG_CHECKING([versioninfo derived AVRDUDE_FULL_VERSION]) + if test "x$GIT_COMMIT_HASH" = "x$GIT_TAG_HASH"; then +- AVRDUDE_FULL_VERSION="$PACKAGE_VERSION" ++ AVRDUDE_FULL_VERSION="$PACKAGE_VERSION$EXTRA_VERSION" + else +- AVRDUDE_FULL_VERSION="$PACKAGE_VERSION ($GIT_COMMIT_HASH)" ++ AVRDUDE_FULL_VERSION="$PACKAGE_VERSION$EXTRA_VERSION ($GIT_COMMIT_HASH)" + fi + AC_MSG_RESULT([$AVRDUDE_FULL_VERSION]) + AC_DEFINE_UNQUOTED([AVRDUDE_FULL_VERSION], ["$AVRDUDE_FULL_VERSION"], +-- +2.46.2 diff --git a/patches/0008-Append-arduino-to-version-string.patch b/patches/0008-Append-arduino-to-version-string.patch deleted file mode 100644 index 78d5b11..0000000 --- a/patches/0008-Append-arduino-to-version-string.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 431eda87..ff8d678f 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -49,7 +49,7 @@ include(FindPackageMessage) - include(GNUInstallDirs) - - set(CONFIG_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}") --set(AVRDUDE_FULL_VERSION ${CMAKE_PROJECT_VERSION}) -+set(AVRDUDE_FULL_VERSION ARDUINO_VERSION_PLACEHOLDER) - - # ===================================== - # Get Git commit info -@@ -91,7 +91,7 @@ if(Git_FOUND) - - # If the commit is not tagged, include the date and commit hash in the full version string. - if(NOT GIT_COMMIT_HASH STREQUAL GIT_TAG_HASH) -- set(AVRDUDE_FULL_VERSION "${CMAKE_PROJECT_VERSION}-${GIT_COMMIT_DATE} (${GIT_COMMIT_HASH})") -+ set(AVRDUDE_FULL_VERSION "ARDUINO_VERSION_PLACEHOLDER-${GIT_COMMIT_DATE} (${GIT_COMMIT_HASH})") - endif() - endif() -