Merge pull request #817 from OpenC3/python_micros #575
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: OpenC3 CLI Tests | |
# Only run on a push to master to avoid running for all the dependabot PRs | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
openc3-cli: | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: openc3.sh build | |
# This `shell` line is required to get around a known issue: https://github.com/actions/runner/issues/241#issuecomment-745902718 | |
shell: 'script -q -e -c "bash {0}"' | |
run: ./openc3.sh build | |
- name: openc3.sh run | |
shell: 'script -q -e -c "bash {0}"' | |
run: | | |
set -e | |
! docker ps | grep openc3 | |
./openc3.sh run | |
sleep 10s | |
docker ps | grep openc3 | |
- name: openc3.sh stop | |
shell: 'script -q -e -c "bash {0}"' | |
run: | | |
set -e | |
./openc3.sh stop | |
sleep 20s | |
! docker ps | grep openc3 | |
- name: openc3.sh start | |
shell: 'script -q -e -c "bash {0}"' | |
run: | | |
set -e | |
./openc3.sh start | |
sleep 30s | |
docker ps | grep openc3 | |
# Not testing openc3.sh dev, openc3.sh test | |
- name: openc3.sh util encode,hash | |
shell: 'script -q -e -c "bash {0}"' | |
run: | | |
set -e | |
./openc3.sh util | grep Usage || true | |
./openc3.sh util encode hello | grep aGVsbG8= | |
./openc3.sh util hash hello | grep 2cf24d | |
- name: openc3.sh util tag | |
shell: 'script -q -e -c "bash {0}"' | |
run: | | |
set -e | |
./openc3.sh util tag | grep "Usage: tag" || true | |
./openc3.sh util tag docker.io localhost:12345 openc3inc latest openc3 mine | |
docker image ls | grep localhost:12345/openc3/openc3-cosmos-cmd-tlm-api | grep mine | |
docker image ls | grep localhost:12345/openc3/openc3-cosmos-script-runner-api | grep mine | |
docker image ls | grep localhost:12345/openc3/openc3-cosmos-init | grep mine | |
docker image ls | grep localhost:12345/openc3/openc3-operator | grep mine | |
docker image ls | grep localhost:12345/openc3/openc3-minio | grep mine | |
docker image ls | grep localhost:12345/openc3/openc3-redis | grep mine | |
docker image ls | grep localhost:12345/openc3/openc3-traefik | grep mine | |
- name: openc3.sh util generate | |
shell: 'script -q -e -c "bash {0}"' | |
run: | | |
set -e | |
### PLUGIN ### | |
./openc3.sh cliroot generate | grep "Unknown generator" || true | |
./openc3.sh cliroot generate plugin | grep "Usage" || true | |
./openc3.sh cliroot generate plugin cli-test | |
./openc3.sh cliroot generate plugin cli-test | grep "already exists" || true | |
cd openc3-cosmos-cli-test | |
../openc3.sh cliroot rake build VERSION=1.0.0 | |
../openc3.sh cliroot validate openc3-cosmos-cli-test-1.0.0.gem | |
### TARGET ### | |
../openc3.sh cliroot generate target MY-cli | |
# Verify the target name 'MY_CLI' and lib filename 'my_cli.rb' | |
ls targets/MY_CLI/lib | grep my_cli.rb | |
../openc3.sh cliroot rake build VERSION=1.0.1 | |
../openc3.sh cliroot validate openc3-cosmos-cli-test-1.0.1.gem | |
### MICROSERVICE ### | |
../openc3.sh cliroot generate microservice background | |
# Verify the microservice name 'BACKGROUND' and filename 'background.rb' | |
ls microservices/BACKGROUND | grep background.rb | |
../openc3.sh cliroot rake build VERSION=1.0.2 | |
../openc3.sh cliroot validate openc3-cosmos-cli-test-1.0.2.gem | |
### CONVERSION ### | |
../openc3.sh cliroot generate conversion MY_CLI upcase | |
# Verify the conversion filename 'upcase_conversion.rb' | |
ls targets/MY_CLI/lib | grep upcase_conversion.rb | |
../openc3.sh cliroot rake build VERSION=1.0.3 | |
../openc3.sh cliroot validate openc3-cosmos-cli-test-1.0.3.gem | |
### LIMITS_RESPONSE ### | |
../openc3.sh cliroot generate limits_response MY_CLI example | |
# Verify the conversion filename 'example_limits_response.rb' | |
ls targets/MY_CLI/lib | grep example_limits_response.rb | |
../openc3.sh cliroot rake build VERSION=1.0.3 | |
../openc3.sh cliroot validate openc3-cosmos-cli-test-1.0.3.gem | |
- name: openc3.sh util save,load | |
shell: 'script -q -e -c "bash {0}"' | |
run: | | |
set -e | |
./openc3.sh util save docker.io openc3inc latest | |
# Verify the images were saved | |
ls tmp | grep openc3-cosmos-cmd-tlm-api-latest.tar | |
ls tmp | grep openc3-cosmos-script-runner-api-latest.tar | |
ls tmp | grep openc3-cosmos-init-latest.tar | |
ls tmp | grep openc3-operator-latest.tar | |
ls tmp | grep openc3-minio-latest.tar | |
ls tmp | grep openc3-redis-latest.tar | |
ls tmp | grep openc3-traefik-latest.tar | |
docker image rm openc3inc/openc3-cosmos-cmd-tlm-api:latest | |
docker image rm openc3inc/openc3-cosmos-script-runner-api:latest | |
docker image rm openc3inc/openc3-cosmos-init:latest | |
docker image rm openc3inc/openc3-operator:latest | |
docker image rm openc3inc/openc3-minio:latest | |
docker image rm openc3inc/openc3-redis:latest | |
docker image rm openc3inc/openc3-traefik:latest | |
./openc3.sh util load | |
# Verify the images were loaded | |
docker image ls | grep openc3-cosmos-cmd-tlm-api | |
docker image ls | grep openc3-cosmos-script-runner-api | |
docker image ls | grep openc3-cosmos-init | |
docker image ls | grep openc3-operator | |
docker image ls | grep openc3-minio | |
docker image ls | grep openc3-redis | |
docker image ls | grep openc3-traefik | |
- name: Cleanup volumes | |
shell: 'script -q -e -c "bash {0}"' | |
run: | | |
set -e | |
docker volume ls | grep openc3 | |
./openc3.sh cleanup force | |
! docker volume ls | grep openc3 |