From 9b6fb522422f20487fd8e75eb83a32ef911c0449 Mon Sep 17 00:00:00 2001 From: zaporter-work Date: Wed, 29 Nov 2023 11:01:42 -0500 Subject: [PATCH 1/6] initial --- .github/workflows/testme.yml | 57 ++++++++++++++++++++++++----------- action.yml | 4 +-- test/meta.json | 2 +- test/module.tar.gz | Bin 0 -> 37 bytes upload.py | 2 +- 5 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 test/module.tar.gz diff --git a/.github/workflows/testme.yml b/.github/workflows/testme.yml index 16c97e7..0b722a3 100644 --- a/.github/workflows/testme.yml +++ b/.github/workflows/testme.yml @@ -1,27 +1,48 @@ on: push: - + jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: deps - run: pip install ruff - - uses: actions/checkout@v3 - - name: lint - run: ruff upload.py + - uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: deps + run: pip install ruff + - uses: actions/checkout@v3 + - name: lint + run: ruff upload.py publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: upload - uses: ./ - with: - meta-path: test/meta.json - org-id: ${{ secrets.test_org_id }} - do-upload: false - key-id: ${{ secrets.viam_key_id }} - key-value: ${{ secrets.viam_key_value }} + - uses: actions/checkout@v3 + - name: update-only + uses: ./ + with: + meta-path: test/meta.json + do-upload: false + key-id: ${{ secrets.viam_key_id }} + key-value: ${{ secrets.viam_key_value }} + - name: upload-with-meta-path + uses: ./ + with: + meta-path: test/meta.json + module-path: test/module.tar.gz + do-upload: true + platform: "linux/amd64" + version: "0.0.0-${{ github.run_id }}-${{ github.run_attempt }}" + key-id: ${{ secrets.viam_key_id }} + key-value: ${{ secrets.viam_key_value }} + - name: upload-no-meta-path + uses: ./ + with: + name: upload-ci-test + org-id: ${{ secrets.test_org_id }} + module-path: test/module.tar.gz + do-upload: true + do-update: false + platform: "linux/amd64" + version: "0.0.1-${{ github.run_id }}-${{ github.run_attempt }}" + key-id: ${{ secrets.viam_key_id }} + key-value: ${{ secrets.viam_key_value }} diff --git a/action.yml b/action.yml index 8fb6daa..0d1d5dc 100644 --- a/action.yml +++ b/action.yml @@ -11,9 +11,9 @@ inputs: name: description: name of the module. only necessary if you don't provide a metadata file. (see inputs.meta-path) org-id: - description: organization id. one of org-id or namespace are required if your meta.json doesn't use a namespace + description: organization id. one of org-id or namespace are required if you don't provide a metadata file. (see inputs.meta-path) namespace: - description: public namespace. one of org-id or namespace are required if your meta.json doesn't use a namespace + description: public namespace. one of org-id or namespace are required if you don't provide a metadata file. (see inputs.meta-path) key-id: description: ID of your auth key required: true diff --git a/test/meta.json b/test/meta.json index 59538e3..8325926 100644 --- a/test/meta.json +++ b/test/meta.json @@ -1,5 +1,5 @@ { - "name": "upload-ci-test", + "module_id": "e76d1b3b-0468-4efd-bb7f-fb1d2b352fcb:upload-ci-test", "visibility": "private", "url": "https://github.com/viamrobotics/upload-module", "description": "No-op module used for the upload CI action's self-test", diff --git a/test/module.tar.gz b/test/module.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..0a35ba3eb17d9ad145ffb02625d994deed362bbc GIT binary patch literal 37 scmb2|=HRf3OHXBBE=eseDJ{s!PfXD(Ni1S8e!|2M{3kG-iGhIu0M?oc{r~^~ literal 0 HcmV?d00001 diff --git a/upload.py b/upload.py index 287adad..f26e987 100755 --- a/upload.py +++ b/upload.py @@ -46,7 +46,7 @@ def main(): subprocess.check_call([command, 'version']) subprocess.check_call([command, 'auth', 'api-key', '--key-id', args.key_id, '--key', args.key_value]) if args.do_update: - subprocess.check_call([command, 'module', 'update', *meta_args, *org_args]) + subprocess.check_call([command, 'module', 'update', *meta_args]) logging.info('ran update') if args.do_upload: subprocess.check_call([command, 'module', 'upload', *meta_args, *org_args, '--platform', args.platform, '--version', args.version, args.module_path]) From b614d1681f104d7b11fe7036596fcf20fb3ba34d Mon Sep 17 00:00:00 2001 From: zaporter-work Date: Wed, 29 Nov 2023 11:09:13 -0500 Subject: [PATCH 2/6] fix --- test/module.tar.gz | Bin 37 -> 170 bytes test/run.sh | 3 +++ 2 files changed, 3 insertions(+) create mode 100755 test/run.sh diff --git a/test/module.tar.gz b/test/module.tar.gz index 0a35ba3eb17d9ad145ffb02625d994deed362bbc..6dd98cb45f94467e93f232d5747918a8a00a977e 100644 GIT binary patch literal 170 zcmb2|=3oE==C_yj@--QV9Q}CC#@`d5nn^y1AvDYlk+#cPPblP{Sw&tmrRbFeJoa#!6T)5?K@s)5MZ{zH>alYmM z?-mzZBwg5ePF?tL&aH#e&*$&Tb(+tz{Y7{8;(2W+W82%kW3KmC)r#2vi2n5cB*ZyT Qvf-+ Date: Wed, 29 Nov 2023 11:22:07 -0500 Subject: [PATCH 3/6] read the action.yml --- .github/workflows/testme.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/testme.yml b/.github/workflows/testme.yml index 0b722a3..36bfec8 100644 --- a/.github/workflows/testme.yml +++ b/.github/workflows/testme.yml @@ -39,6 +39,7 @@ jobs: with: name: upload-ci-test org-id: ${{ secrets.test_org_id }} + meta-path: '' module-path: test/module.tar.gz do-upload: true do-update: false From 07f86a1159a7dcef03aa2fa80497ec10bb941641 Mon Sep 17 00:00:00 2001 From: zaporter-work Date: Wed, 29 Nov 2023 11:33:30 -0500 Subject: [PATCH 4/6] fix upload.py --- upload.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/upload.py b/upload.py index f26e987..af859f7 100755 --- a/upload.py +++ b/upload.py @@ -34,6 +34,9 @@ def main(): meta_args = () if args.meta_path: meta_args = ('--module', args.meta_path) + elif args.name: + meta_args = ('--name', args.name) + org_args = () if args.org_id: org_args = ('--org-id', args.org_id) From 05d116fece35fe094a0a786d4531e5c0614ffe01 Mon Sep 17 00:00:00 2001 From: zaporter-work Date: Wed, 29 Nov 2023 11:40:20 -0500 Subject: [PATCH 5/6] add test readme --- test/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test/README.md diff --git a/test/README.md b/test/README.md new file mode 100644 index 0000000..e94b610 --- /dev/null +++ b/test/README.md @@ -0,0 +1,9 @@ +This is a simple test module uploaded during the github action tests defined in .github/workflows/testme.yml + +The module.tar.gz was created by running: + +```sh +tar -czf module.tar.gz ./run.sh +``` + +The meta.js points to `run.sh` so the tar command must be run from the `test` directory From 7ebf3ce2f1360229f6e32c67186e7b982a4d5680 Mon Sep 17 00:00:00 2001 From: zaporter-work Date: Wed, 29 Nov 2023 11:56:05 -0500 Subject: [PATCH 6/6] switch to namespace --- test/meta.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/meta.json b/test/meta.json index 8325926..5b4643f 100644 --- a/test/meta.json +++ b/test/meta.json @@ -1,5 +1,5 @@ { - "module_id": "e76d1b3b-0468-4efd-bb7f-fb1d2b352fcb:upload-ci-test", + "module_id": "viam:upload-ci-test", "visibility": "private", "url": "https://github.com/viamrobotics/upload-module", "description": "No-op module used for the upload CI action's self-test",