-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix action to work with new version of the CLI + add more tests #5
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,49 @@ | ||
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 }} | ||
meta-path: '' | ||
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 }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefile | ||
echo running |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
|
||
Comment on lines
+37
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This didn't seem to be populated before There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't test the no-meta case; makes sense There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for clarity -- you're intentionally removing the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the org-id and namespace arguments don't make much sense for the update command because the update command requires a meta.json (which includes the module_id (which includes namespace and orgid)). Back when |
||
org_args = () | ||
if args.org_id: | ||
org_args = ('--org-id', args.org_id) | ||
|
@@ -46,7 +49,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]) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My formatter (prettier) did this formatting.
If you want to keep it in the old style, I can revert this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no preference
if the computer is happy I'm happy