Skip to content

feature: github action using starshipjs (#27) #133

feature: github action using starshipjs (#27)

feature: github action using starshipjs (#27) #133

Workflow file for this run

name: Test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test-with-values:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create yaml file
run: |
cat <<EOF > config.yaml
chains:
- id: osmosis-1
name: osmosis
numValidators: 1
ports:
rest: 1313
rpc: 26653
resources:
limits:
cpu: "0.2"
memory: "200M"
requests:
cpu: "0.1"
memory: "100M"
- id: wasmd
name: wasmd
numValidators: 1
ports:
rpc: 26659
rest: 1319
resources:
limits:
cpu: "0.2"
memory: "200M"
requests:
cpu: "0.1"
memory: "100M"
EOF
cat config.yaml
- uses: ./
id: starship
with:
name: test-with-values
values: config.yaml
- name: Check kubectl pods
run: |
for chain in wasmd osmosis-1; do
kubectl get pods $chain-genesis-0 --namespace $NAMESPACE
done
env:
NAMESPACE: ${{ steps.starship.outputs.namespace }}
- name: Check port forwarded status
run: |
for port in 26659 26653; do
status_code=$(curl --write-out %{http_code} --silent --output /dev/null http://localhost:$port/status)
if [[ "$status_code" -ne 200 ]]; then
echo "Expected status code: 200, got: $status_code, from http://localhost:$port/status"
exit 1
else
echo "Successfully connected to: http://localhost:$port/status"
fi
done
- name: Cleanup cluster
run: |
helm delete $NAME --debug --namespace $NAMESPACE --wait
kubectl delete namespace $NAMESPACE --wait=true
env:
NAMESPACE: ${{ steps.starship.outputs.namespace }}
NAME: ${{ steps.starship.outputs.name }}
test-with-remote-cluster:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: echo -e "$TEMP_KUBECONFIG" > /tmp/kubeconfig
shell: bash
env:
TEMP_KUBECONFIG: |
apiVersion: v1
kind: Config
preferences: {}
- name: Setup kind cluster
if: ${{ inputs.kubeconfig == '' }}
uses: helm/[email protected]
with:
cluster_name: kind-starship
env:
KUBECONFIG: /tmp/kubeconfig
- name: Read kubeconfig
id: kubeconfig
uses: juliangruber/read-file-action@v1
with:
path: /tmp/kubeconfig
- name: Create yaml file
run: |
cat <<EOF > config.yaml
chains:
- id: osmosis-1
name: osmosis
numValidators: 1
ports:
rest: 1313
rpc: 26653
resources:
cpu: "0.2"
memory: "200M"
EOF
- uses: ./
id: starship
with:
name: test-kubeconfig
kubeconfig: ${{ steps.kubeconfig.outputs.content }}
values: config.yaml
- name: Check kubectl pods
run: |
kubectl get pods osmosis-1-genesis-0 --namespace $NAMESPACE
env:
NAMESPACE: ${{ steps.starship.outputs.namespace }}
- name: Cleanup cluster
run: |
helm delete $NAME --debug --namespace $NAMESPACE --wait
kubectl delete namespace $NAMESPACE --wait=true
env:
NAMESPACE: ${{ steps.starship.outputs.namespace }}
NAME: ${{ steps.starship.outputs.name }}
test-with-no-ports:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create yaml file
run: |
cat <<EOF > config.yaml
chains:
- id: osmosis-1
name: osmosis
numValidators: 1
resources:
cpu: "0.2"
memory: "200M"
EOF
- uses: ./
id: starship
with:
name: test-no-portforward
values: config.yaml
- name: Check kubectl pods
run: |
for chain in osmosis-1; do
kubectl get pods $chain-genesis-0 --namespace $NAMESPACE
done
env:
NAMESPACE: ${{ steps.starship.outputs.namespace }}
- name: Cleanup cluster
run: |
helm delete $NAME --debug --namespace $NAMESPACE --wait
kubectl delete namespace $NAMESPACE --wait=true
env:
NAMESPACE: ${{ steps.starship.outputs.namespace }}
NAME: ${{ steps.starship.outputs.name }}