Skip to content

Commit

Permalink
fix: re-implement local-environment-tests-post-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
skylar-simoncelli authored Oct 2, 2024
1 parent b6085ac commit 74719ab
Showing 1 changed file with 47 additions and 13 deletions.
60 changes: 47 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ on:
branches:
- master
workflow_dispatch:
inputs:
branch:
description: 'Branch to build from and test'
required: true
default: 'master'

env:
AWS_REGION: "eu-central-1"
Expand All @@ -22,15 +17,15 @@ permissions:

jobs:
build:
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && (github.event.action != 'closed' || github.event.pull_request.merged == true))
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.get_sha.outputs.sha }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.head_ref || github.ref }}
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Get current commit SHA
id: get_sha
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -82,13 +77,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.head_ref || github.ref }}
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Deploy and test against local environment
uses: ./.github/actions/tests/local-environment-tests
with:
tag: CI
image: ${{ secrets.ECR_REGISTRY_SECRET }}/substrate-node:${{ needs.build.outputs.sha }}
sha: ${{ needs.build.outputs.sha }}
tests: premerge
env:
SUBSTRATE_REPO_SSH_KEY: ${{ secrets.SUBSTRATE_REPO_SSH_KEY }}
EARTHLY_TAR: ${{ secrets.EARTHLY_TAR }}
Expand All @@ -106,7 +103,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.head_ref || github.ref }}
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Deploy ArgoCD Node
uses: ./.github/actions/deploy/argocd/deploy-argocd
with:
Expand All @@ -122,7 +120,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.head_ref || github.ref }}
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Run Tests
uses: ./.github/actions/tests/argocd-tests
with:
Expand All @@ -144,7 +143,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.head_ref || github.ref }}
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Teardown ArgoCD Environment
uses: ./.github/actions/deploy/argocd/teardown-argocd
with:
Expand All @@ -165,7 +165,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.head_ref || github.ref }}
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Acquire AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down Expand Up @@ -198,6 +199,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Upload chain spec artifacts to Kubernetes
uses: ./.github/actions/deploy/upload-chain-specs
with:
Expand All @@ -214,6 +218,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Deploy Rust Docs
uses: ./.github/actions/deploy/deploy-rustdoc
with:
Expand All @@ -222,9 +229,36 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SSH_AUTH_SOCK: /tmp/ssh_agent.sock

local-environment-tests-post-merge:
if: github.event_name == 'pull_request' && github.event.pull_request.merged == true
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Use the merge commit SHA for post-merge testing
ref: ${{ github.event.pull_request.merge_commit_sha || github.sha }}
- name: Deploy and test against local environment
uses: ./.github/actions/tests/local-environment-tests
with:
tag: CI
image: ${{ secrets.ECR_REGISTRY_SECRET }}/substrate-node:${{ needs.build.outputs.sha }}
sha: ${{ needs.build.outputs.sha }}
tests: postmerge
env:
SUBSTRATE_REPO_SSH_KEY: ${{ secrets.SUBSTRATE_REPO_SSH_KEY }}
EARTHLY_TAR: ${{ secrets.EARTHLY_TAR }}
AWS_ROLE_ARN_SECRET: ${{ secrets.AWS_ROLE_ARN_SECRET }}
AWS_REGION: ${{ env.AWS_REGION }}
ACTIONS_PAT: ${{ secrets.ACTIONS_PAT }}
ECR_REGISTRY_SECRET: ${{ secrets.ECR_REGISTRY_SECRET }}
TEST_ENVIRONMENT: local

post-merge-actions-complete:
if: github.event_name == 'pull_request' && github.event.pull_request.merged == true
needs: [deploy-rustdoc, upload-chain-specs]
needs: [deploy-rustdoc, upload-chain-specs, local-environment-tests-post-merge]
runs-on: ubuntu-latest
steps:
- name: Post Merge Actions Complete
Expand Down

0 comments on commit 74719ab

Please sign in to comment.