Skip to content

Commit

Permalink
feat: add tests to not-earthly and fix ECR upload (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
skylar-simoncelli authored Aug 27, 2024
1 parent ccbe810 commit a96d46e
Showing 1 changed file with 22 additions and 30 deletions.
52 changes: 22 additions & 30 deletions .github/workflows/not-earthly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,25 @@ env:

jobs:
build-and-push-without-earthly:
# runs-on: [self-hosted, ubuntu]
runs-on: ubuntu-latest
if: github.event.action != 'closed' || github.event.pull_request.merged == true
concurrency:
group: pr-${{ github.event.pull_request.number }}-author-${{ github.event.pull_request.user.login }}
cancel-in-progress: true
permissions:
id-token: write
contents: write
steps:
- name: Checkout partner-chains
uses: actions/checkout@v4

- name: Acquire AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN_SECRET }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to ECR
uses: docker/login-action@v3
with:
registry: ${{ secrets.ECR_REGISTRY_SECRET }}

- name: Install dependencies
run: |
Expand All @@ -42,7 +49,11 @@ jobs:
- name: Build partner-chains-node
run: |
cargo build -p partner-chains-node --locked --release --target x86_64-unknown-linux-gnu
cp target/x86_64-unknown-linux-gnu/release/partner-chains-node partner-chains-node
chmod +x target/x86_64-unknown-linux-gnu/release/partner-chains-node
cp target/x86_64-unknown-linux-gnu/release/partner-chains-node ./partner-chains-node
- name: Run tests
run: cargo test --locked --release --target x86_64-unknown-linux-gnu

- name: Generate Chain Specs
run: |
Expand All @@ -62,32 +73,13 @@ jobs:
docker exec $container_id chown -R substrate:substrate /data /substrate
docker exec $container_id rm -rf /usr/bin/apt* /usr/bin/dpkg*
docker exec $container_id ln -s /data /substrate/.local/share/partner-chains-node
docker cp ./partner-chains-node $container_id:/usr/local/bin/partner-chains-node
docker commit --change='EXPOSE 30333 9615 9933 9944' --change='ENTRYPOINT ["/usr/local/bin/partner-chains-node"]' $container_id substrate-node:${{ github.sha }}
- name: Copy Binary to Docker Container
run: |
docker cp ./partner-chains-node ${{ env.container_id }}:/usr/local/bin/partner-chains-node
- name: Finalize Docker Image
run: |
docker commit --change='EXPOSE 30333 9615 9933 9944' --change='ENTRYPOINT ["/usr/local/bin/partner-chains-node"]' ${{ env.container_id }} substrate/node:${{ github.sha }}
- name: Acquire AWS credentials
uses: aws-actions/configure-aws-credentials@v4
if: ${{ github.event.pull_request.merged == true && !contains(github.event.pull_request.labels.*.name, 'ci-off') }}
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN_SECRET }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to ECR
uses: docker/login-action@v3
if: ${{ github.event.pull_request.merged == true && !contains(github.event.pull_request.labels.*.name, 'ci-off') }}
with:
registry: ${{ secrets.ECR_REGISTRY_SECRET }}

- name: Push to Docker Registry
if: ${{ github.event.pull_request.merged == true && !contains(github.event.pull_request.labels.*.name, 'ci-off') }}
- name: Push to ECR
run: |
docker push substrate/node:${{ github.sha }}
docker tag substrate-node:${{ github.sha }} ${{ secrets.ECR_REGISTRY_SECRET }}/substrate-node:${{ github.sha }}
docker push ${{ secrets.ECR_REGISTRY_SECRET }}/substrate-node:${{ github.sha }}
- name: Cleanup Docker Container
if: always()
Expand Down Expand Up @@ -179,7 +171,7 @@ jobs:
chain-specs:
runs-on: [self-hosted, eks]
needs: [build-and-push-without-earthly]
if: github.ref_name == 'master' || inputs.upload == true
if: ${{ github.event.pull_request.merged == true && !contains(github.event.pull_request.labels.*.name, 'ci-off') }}
permissions:
id-token: write
contents: write
Expand Down

0 comments on commit a96d46e

Please sign in to comment.