Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
rsporny committed Oct 22, 2024
1 parent 7c13a69 commit 7c74f41
Showing 1 changed file with 54 additions and 14 deletions.
68 changes: 54 additions & 14 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ permissions:
env:
AWS_REGION: "eu-central-1"
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
STAGING_PREVIEW_VALIDATOR_1_HOST: staging-preview-validator-1-service.staging-preview.svc.cluster.local
STAGING_PREVIEW_VALIDATOR_1_PORT: 9933

jobs:
# build-linux:
Expand Down Expand Up @@ -162,27 +164,44 @@ jobs:
# K8S_SERVER: ${{ secrets.K8S_SERVER }}
# K8S_SA_TOKEN: ${{ secrets.K8S_SA_TOKEN }}

staging-preview-tests:
deploy-staging-preview:
runs-on: [self-hosted, eks]
steps:
- name: Deploy
run: |
echo "Deploying staging-preview... 🚀"
echo "Done! 🎉"
shell: bash

partner-chain-ready:
runs-on: [self-hosted, eks]
needs: deploy-staging-preview
steps:
- name: Check Finalization Status
run: |
FINALIZED_NUMBER=$(
curl -s -H "Content-Type: application/json" -d '\''{"jsonrpc":"2.0","method":"chain_getFinalizedHead","params":[]}'\'' http://$STAGING_PREVIEW_VALIDATOR_1_HOST:$STAGING_PREVIEW_VALIDATOR_1_PORT |
jq -r ".result" |
xargs -I{} curl -s -H "Content-Type: application/json" -d "{\"jsonrpc\":\"2.0\",\"method\":\"chain_getHeader\",\"params\":[\"{}\"]}" http://$STAGING_PREVIEW_VALIDATOR_1_HOST:$STAGING_PREVIEW_VALIDATOR_1_PORT |
jq -r ".result.number" | xargs printf "%d"
)
[ "$FINALIZED_NUMBER" -gt 0 ] && echo "Blocks are being finalized. Finalized Block Number: $FINALIZED_NUMBER" || (echo "No blocks are being finalized." && exit 1)
shell: bash

run-smoke-tests:
permissions:
id-token: write
contents: write
# needs: deploy-staging-preview
contents: read
needs: partner-chain-ready
runs-on: [self-hosted, eks]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Health check
- name: Configure kubectl
uses: ./.github/actions/tests/staging-preview-tests
with:
node-host: staging-preview-validator-1-service.staging-preview.svc.cluster.local
node-port: 9933
node-host: $STAGING_PREVIEW_VALIDATOR_1_HOST
node-port: $STAGING_PREVIEW_VALIDATOR_1_PORT
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
AWS_ROLE_ARN_: ${{ secrets.AWS_ROLE_ARN_ }}
SSH_KEY_BINARY_HOST: ${{ secrets.SSH_KEY_BINARY_HOST }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
JIRA_URL: ${{ secrets.JIRA_URL }}
ACTIONS_PAT: ${{ secrets.ACTIONS_PAT }}
kubeconfig_base64: ${{ secrets.kubeconfig_base64 }}
K8S_SERVER: ${{ secrets.K8S_SERVER }}
K8S_SA_TOKEN: ${{ secrets.K8S_SA_TOKEN }}
Expand All @@ -197,6 +216,27 @@ jobs:
env: staging
decrypt: true
markers: "not active_flow and not passive_flow and (CD or rpc)"

run-all-tests:
permissions:
id-token: write
contents: read
needs: partner-chain-ready
runs-on: [self-hosted, eks]
steps:
- name: Configure kubectl
uses: ./.github/actions/tests/staging-preview-tests
with:
node-host: $STAGING_PREVIEW_VALIDATOR_1_HOST
node-port: $STAGING_PREVIEW_VALIDATOR_1_PORT
env:
kubeconfig_base64: ${{ secrets.kubeconfig_base64 }}
K8S_SERVER: ${{ secrets.K8S_SERVER }}
K8S_SA_TOKEN: ${{ secrets.K8S_SA_TOKEN }}
- name: Setup tests
uses: ./.github/actions/tests/setup-python
env:
ACTIONS_PAT: ${{ secrets.ACTIONS_PAT }}
- name: Save deployment main chain epoch
run: |
echo "DEPLOYMENT_MC_EPOCH=$(curl -s http://staging-preview-services-service.staging-preview.svc.cluster.local:1337/health | jq .currentEpoch)" >> $GITHUB_ENV
Expand Down

0 comments on commit 7c74f41

Please sign in to comment.