From 59fd6cc1a8e2b539772b2d4d9dcd40f08a7ce4a2 Mon Sep 17 00:00:00 2001 From: paveltabako Date: Thu, 20 Jul 2023 18:46:57 +0300 Subject: [PATCH] - fixes and improvements --- .github/workflows/ci.yaml | 58 ++++++++++++++++ .github/workflows/ci.yml | 90 ------------------------- .github/workflows/{dev.yml => dev.yaml} | 47 +++++++++---- 3 files changed, 93 insertions(+), 102 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .github/workflows/ci.yml rename .github/workflows/{dev.yml => dev.yaml} (58%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 000000000..969c0f124 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,58 @@ +name: CI + +on: + pull_request: + branches: + - dev + - master + - 'feature/**' + - 'release/**' + - 'hotfix/**' + types: + - opened + - synchronize + - edited + +env: + PROFILE: release + +jobs: + build: + runs-on: ubuntu-latest + concurrency: dev + steps: + - uses: actions/checkout@v3 + + - name: Cache cargo registry + uses: actions/cache@v3 + continue-on-error: false + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Configure AWS credentials ORG + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.ORG_AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.ORG_AWS_SECRET_ACCESS_KEY }} + aws-region: us-west-2 + + - name: Login to Amazon ECR ORG + id: login-ecr-org + uses: aws-actions/amazon-ecr-login@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push docker image to ECR Docker + uses: docker/build-push-action@v4 + with: + context: . + file: Dockerfile.tests + push: false + build-args: | + "ECR_REGISTRY=${{ steps.login-ecr-org.outputs.registry }}" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 291568c36..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: CI - -on: - pull_request: - branches: - - dev - - master - - 'feature/**' - - 'release/**' - - 'hotfix/**' - types: - - opened - - synchronize - - edited - -env: - PROFILE: release - -jobs: - build: - runs-on: ubuntu-latest - concurrency: dev - permissions: - contents: read - id-token: write - steps: - - uses: actions/checkout@v3 - - - name: Cache cargo registry - uses: actions/cache@v3 - continue-on-error: false - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo- - - - name: configure aws credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - role-to-assume: arn:aws:iam::${{ vars.DEV_NETWORK_AWS_ACCOUNT_ID }}:role/github - role-session-name: ${{ github.event.repository.name }} - aws-region: us-west-2 - - - name: Get short SHA - run: | - echo "GITHUB_SHA=${GITHUB_SHA:0:7}" >> $GITHUB_ENV - echo "AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID" >> $GITHUB_ENV - echo "AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY" >> $GITHUB_ENV - echo "AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN" >> $GITHUB_ENV - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build and push docker image to ECR - uses: docker/build-push-action@v4 - with: - context: . - file: Dockerfile.tests - push: false - build-args: | - "AWS_ACCESS_KEY_ID=${{ env.AWS_ACCESS_KEY_ID }}" - "AWS_SECRET_ACCESS_KEY=${{ env.AWS_SECRET_ACCESS_KEY }}" - "AWS_SESSION_TOKEN=${{ env.AWS_SESSION_TOKEN }}" - "SCCACHE_REGION=us-west-2" - "SCCACHE_BUCKET=cere-blockchain-sccache" - - - name: Build and push docker image to ECR - uses: docker/build-push-action@v4 - with: - context: . - push: true - build-args: | - "AWS_ACCESS_KEY_ID=${{ env.AWS_ACCESS_KEY_ID }}" - "AWS_SECRET_ACCESS_KEY=${{ env.AWS_SECRET_ACCESS_KEY }}" - "AWS_SESSION_TOKEN=${{ env.AWS_SESSION_TOKEN }}" - "SCCACHE_REGION=us-west-2" - "SCCACHE_BUCKET=cere-blockchain-sccache" - - tags: | - ${{ steps.login-ecr.outputs.registry }}/pos-network-node:${{ github.sha }} - - - # TODO: paveltabalko to add e2e-tests simulations diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yaml similarity index 58% rename from .github/workflows/dev.yml rename to .github/workflows/dev.yaml index c76149855..487b4b570 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yaml @@ -64,17 +64,40 @@ jobs: tags: | ${{ steps.login-ecr.outputs.registry }}/pos-network-node:${{ github.sha }} - ${{ steps.login-ecr.outputs.registry }}/pos-network-node:dev-${{ github.sha }} ${{ steps.login-ecr.outputs.registry }}/pos-network-node:dev-latest + + # - name: Upload cere-runtime wasm artifact + # uses: actions/upload-artifact@v3 + # with: + # name: cere_runtime.compact.compressed.${{ env.GITHUB_SHA }}.wasm + # path: target/${{ vars.PROFILE }}/wbuild/cere-runtime/cere_runtime.compact.compressed.wasm + # + # - name: Upload cere-dev-runtime wasm artifact + # uses: actions/upload-artifact@v3 + # with: + # name: cere_dev_runtime.compact.compressed.${{ env.GITHUB_SHA }}.wasm + # path: target/${{ vars.PROFILE }}/wbuild/cere-dev-runtime/cere_dev_runtime.compact.compressed.wasm -# - name: Upload cere-runtime wasm artifact -# uses: actions/upload-artifact@v3 -# with: -# name: cere_runtime.compact.compressed.${{ env.GITHUB_SHA }}.wasm -# path: target/${{ vars.PROFILE }}/wbuild/cere-runtime/cere_runtime.compact.compressed.wasm -# -# - name: Upload cere-dev-runtime wasm artifact -# uses: actions/upload-artifact@v3 -# with: -# name: cere_dev_runtime.compact.compressed.${{ env.GITHUB_SHA }}.wasm -# path: target/${{ vars.PROFILE }}/wbuild/cere-dev-runtime/cere_dev_runtime.compact.compressed.wasm + trigger-e2e-tests: + runs-on: ubuntu-latest + needs: build + steps: + - name: 'Trigger e2e DDC tests' + uses: convictional/trigger-workflow-and-wait@v1.6.5 + with: + owner: Cerebellum-Network + repo: ddc-api-e2e-simulations + github_token: ${{ secrets.GH_E2E_TOKEN }} + comment_github_token: ${{ secrets.GH_E2E_TOKEN }} + github_user: devops-cere + workflow_file_name: run-basic-ddc-tests.yml + client_payload: |- + { + "POS_NODE_VERSION": "${{ github.sha }}" + } + ref: master + wait_interval: 30 + propagate_failure: true + trigger_workflow: true + wait_workflow: true + comment_downstream_url: ${{ github.event.pull_request.comments_url }}