From 624674a479d095d193b32ee95a1bc4fd950b09c2 Mon Sep 17 00:00:00 2001 From: Ivan Zorin Date: Wed, 27 Dec 2023 02:21:02 +0300 Subject: [PATCH] UploadV4 metadata workaround (#1855) * chore(deps): bump actions/upload-artifact from 3 to 4 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * push.yml: split metadata artifacts into two separated packages since now it's error by design in uploadV4 to stuff multiple files from different jobs/steps into artifact with the same name * push.yml: add metadata per model artifact since now it's error by design in uploadV4 to stuff multiple files from different jobs/steps into one artifact with the same name * push.yml: testing proposed by github solution for actions:#472 * push.yml: "fixing" upload as github team suggested * push.yml: rename upload metadata step to unify build steps naming pattern * push.yml: upload_metadata: add if-no-files-found: error directive since metadata.zip is essential * push.yml: giving a second chance for cache save/restore actions * push.yml: remove unsupported name field from cache actions * push.yml: add tar to deps so cache action can collect cached files on github * push.yml: try to retrieve cache by key properly * push.yml: try to retrieve cache by key properly * push.yml: remove wildcards from keys * push.yml: try retrieve cache by explicit name * push.yml: trying with enableCrossOsArchive == true * push.yml: revert changes back from cache save/restore to actions download/upload * push.yml: set retention-days == 1 and testing dot file name hoping it will hide artifacts * push.yml: upload_metadata - download jsons: fix pattern for testing * push.yml: adding 3rd party step for testing to delete created artifacts * push.yml: trying to fix syntax in 3rd party step * push.yml: revert changes to working workaround but keep retention-days == 1 * push.yml: upload_metadata: download prebuilt artifacts, generate jsons, upload them as metadata.zip - Work in Progress * push.yml: upload_metadata: trying to fix pattern for artifacts [WiP] * push.yml: upload_metadata: remove matrix since it doesn't work [WiP] * push.yml: upload_metadata: remove pattern to download all prebuilt artifacts * push.yml: add every json to every model of artifact * push.yml: remove uploading/reuploading individual json files as zips * push.yml: pushing to see which error will be at this time... * ci * Revert "push.yml: pushing to see which error will be at this time..." This reverts commit ed3ac204ca9b669a0fb35ecc6c38e7f456db271c. * push.yml: revert manually due to accidential commit from different branch of different repo * Remove the image of my frustration with github checkout update --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ben V. Brown <5425387+Ralim@users.noreply.github.com> --- .github/workflows/push.yml | 42 ++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index ff263b1b..42d20b7f 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -45,26 +45,22 @@ jobs: - name: Copy license files run: cp LICENSE scripts/LICENSE_RELEASE.md source/Hexfile/ + - name: Generate json index file + run: ./source/metadata.py ${{ matrix.model }}.json + - name: Archive ${{ matrix.model }} artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.model }} path: | source/Hexfile/${{ matrix.model }}_*.hex source/Hexfile/${{ matrix.model }}_*.dfu source/Hexfile/${{ matrix.model }}_*.bin + source/Hexfile/${{ matrix.model }}.json source/Hexfile/LICENSE source/Hexfile/LICENSE_RELEASE.md if-no-files-found: error - - name: Generate json index file - run: ./source/metadata.py ${{ matrix.model }}.json - - - name: Archive ${{ matrix.model }} index file - uses: actions/upload-artifact@v3 - with: - name: metadata - path: source/Hexfile/${{ matrix.model }}.json build_multi-lang: runs-on: ubuntu-22.04 @@ -97,26 +93,42 @@ jobs: - name: Copy license files run: cp LICENSE scripts/LICENSE_RELEASE.md source/Hexfile/ + - name: Generate json index file + run: ./source/metadata.py ${{ matrix.model }}_multi-lang.json + - name: Archive ${{ matrix.model }} artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.model }}_multi-lang path: | source/Hexfile/${{ matrix.model }}_*.hex source/Hexfile/${{ matrix.model }}_*.dfu source/Hexfile/${{ matrix.model }}_*.bin + source/Hexfile/${{ matrix.model }}_multi-lang.json source/Hexfile/LICENSE source/Hexfile/LICENSE_RELEASE.md if-no-files-found: error - - name: Generate json index file - run: ./source/metadata.py ${{ matrix.model }}_multi-lang.json - - name: Archive ${{ matrix.model }} index file - uses: actions/upload-artifact@v3 + upload_metadata: + needs: [build, build_multi-lang] + runs-on: ubuntu-20.04 + + steps: + - name: Download all prebuilts + uses: actions/download-artifact@v4 + with: + path: source/Hexfile/ + merge-multiple: true + - run: ls -R source/Hexfile + + - name: Upload JSONs in bulk as metadata + uses: actions/upload-artifact@v4 with: name: metadata - path: source/Hexfile/${{ matrix.model }}_multi-lang.json + path: source/Hexfile/*.json + if-no-files-found: error + tests: runs-on: ubuntu-22.04