Skip to content

Commit

Permalink
chore: Add tangle standalone chain e2e (#155)
Browse files Browse the repository at this point in the history
Co-authored-by: Freddy Li <[email protected]>
  • Loading branch information
freddyli7 and Freddy Li authored Aug 1, 2024
1 parent 5bb313b commit 57a61e7
Show file tree
Hide file tree
Showing 21 changed files with 1,313 additions and 1,108 deletions.
2 changes: 1 addition & 1 deletion .github/actions/install_toolchain/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ runs:
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: 1.74.0
toolchain: 1.79.0
override: true
target: wasm32-unknown-unknown
components: rustfmt
Expand Down
60 changes: 0 additions & 60 deletions .github/workflows/e2e-docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,63 +73,3 @@ jobs:

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

push_subbridge_e2e_to_registry:
name: Push Phala subbridge integrated E2E Docker image to GitHub Container Registry
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
submodules: "true"
- uses: ./.github/actions/install_toolchain

- name: Prepare
id: prep
run: |
# creates local variable of docker image
# creates local variable of commit hash that triggered workflow
COMMIT_HASH=$(echo $GITHUB_SHA | head -c7)
# creates local variable to hold docker images
TAGS="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${COMMIT_HASH},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:subbridge-e2e-latest"
# check if branch/tag that triggered workflow was from tags
if [[ $GITHUB_REF == refs/tags/* ]]; then
# set version
VERSION=${GITHUB_REF#refs/tags/}
# append version and e2e testing name to tags
TAGS="${TAGS},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:subbridge-e2e-${VERSION}"
fi
# sets output of step
echo ::set-output name=tags::${TAGS}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
push: true
file: ./Dockerfile_subbridge_e2e
tags: ${{ steps.prep.outputs.tags }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
79 changes: 79 additions & 0 deletions .github/workflows/tangle-e2e-docker-build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# The Licensed Work is (c) 2022 Sygma
# SPDX-License-Identifier: LGPL-3.0-only

name: Build and publish E2E Docker image with Tangle standalone chain node

on:
pull_request:
types: [opened, synchronize, reopened]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
push_e2e_to_registry:
name: Push E2E Docker image with Tangle standalone chain node to GitHub Container Registry
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
submodules: "true"
- uses: ./.github/actions/install_toolchain

- name: Prepare
id: prep
run: |
# creates local variable of docker image
# creates local variable of commit hash that triggered workflow
COMMIT_HASH=$(echo $GITHUB_SHA | head -c7)
# creates local variable to hold docker images
TAGS="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${COMMIT_HASH},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:e2e-latest"
# check if branch/tag that triggered workflow was from tags
if [[ $GITHUB_REF == refs/tags/* ]]; then
# set version
VERSION=${GITHUB_REF#refs/tags/}
# append version and e2e testing name to tags
TAGS="${TAGS},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:e2e-${VERSION}"
fi
# sets output of step
echo ::set-output name=tags::${TAGS}
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
push: true
file: ./Dockerfile_tangle_standalone_e2e
build-args: mpc_address=${{ env.MPCADDR }}
tags: ${{ steps.prep.outputs.tags }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
Loading

0 comments on commit 57a61e7

Please sign in to comment.