Skip to content

Commit

Permalink
async-icq simapp & demo (#122)
Browse files Browse the repository at this point in the history
* WIP

* icq: host & controller chains

* sdk v47 replace statements

* workflow: build host & controller images

* relative path to DockerFile

* fix: use IBC MakeTestEncodingConfig

* lint

* simplify, regen types. remove legacy docs

* add make build for demo app
  • Loading branch information
Reecepbcups authored Oct 30, 2023
1 parent 04e47eb commit 0288bf5
Show file tree
Hide file tree
Showing 79 changed files with 11,544 additions and 797 deletions.
92 changes: 91 additions & 1 deletion .github/workflows/async-icq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ env:
GO_VERSION: 1.21.0
WORKING_DIRECTORY: modules/async-icq/

HOST_TAR_PATH: /tmp/icq-host.tar
HOST_IMAGE_NAME: icq-host
HOST_DOCKER_TAG: icq-host:local

CONTROLLER_TAR_PATH: /tmp/icq-demo.tar
CONTROLLER_IMAGE_NAME: icq-demo
CONTROLLER_DOCKER_TAG: icq-demo:local

jobs:
golangci:
name: Linter
Expand Down Expand Up @@ -38,5 +46,87 @@ jobs:
- name: Test
run: go test ./...
working-directory: ${{ env.WORKING_DIRECTORY }}

build-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

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

- name: Build and export Host
uses: docker/build-push-action@v5
with:
context: ${{ env.WORKING_DIRECTORY }}
tags: ${{ env.HOST_DOCKER_TAG }}
file: ${{ env.WORKING_DIRECTORY }}/Dockerfile.icq
outputs: type=docker,dest=${{ env.HOST_TAR_PATH }}

- name: Build and export Controller
uses: docker/build-push-action@v5
with:
context: ${{ env.WORKING_DIRECTORY }}
tags: ${{ env.CONTROLLER_DOCKER_TAG }}
file: ${{ env.WORKING_DIRECTORY }}/Dockerfile.icq-demo
outputs: type=docker,dest=${{ env.CONTROLLER_TAR_PATH }}

- name: Upload host artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.HOST_IMAGE_NAME }}
path: ${{ env.HOST_TAR_PATH }}

- name: Upload controller artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.CONTROLLER_IMAGE_NAME }}
path: ${{ env.CONTROLLER_TAR_PATH }}

e2e-tests:
needs: build-docker
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.WORKING_DIRECTORY }}
strategy:
matrix:
test:
- "ictest-icq"
fail-fast: false

steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: checkout chain
uses: actions/checkout@v4

- name: Download Host Artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.HOST_IMAGE_NAME }}
path: /tmp

- name: Download Controller Artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.CONTROLLER_IMAGE_NAME }}
path: /tmp

- name: Load Docker Image
run: |
docker image load -i ${{ env.HOST_TAR_PATH }}
docker image load -i ${{ env.CONTROLLER_TAR_PATH }}
docker image ls -a
# TODO: e2e
- name: Run Test
run: make ${{ matrix.test }}
24 changes: 24 additions & 0 deletions modules/async-icq/Dockerfile.icq
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# host
# make local-image-icq
# docker run --rm -it icq-host:local q

FROM golang:1.21-alpine3.18 as builder

RUN set -eux; apk add --no-cache git libusb-dev linux-headers gcc musl-dev make go;

ENV GOPATH=""

COPY go.mod .
COPY go.sum .

RUN go mod download

COPY . .

RUN make build

FROM alpine:3.18

COPY --from=builder /go/build/* /bin/simd

ENTRYPOINT ["/bin/simd"]
24 changes: 24 additions & 0 deletions modules/async-icq/Dockerfile.icq-demo
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# make local-image-icq-demo
# docker run --rm -it icq-demo:local q interquery

FROM golang:1.21-alpine3.18 as builder

RUN set -eux; apk add --no-cache git libusb-dev linux-headers gcc musl-dev make go;

ENV GOPATH=""

COPY go.mod .
COPY go.sum .
COPY Makefile .

RUN go mod download

COPY ./testing/demo-simapp .

RUN make build

FROM alpine:3.18

COPY --from=builder /go/build/* /bin/icq-demo

ENTRYPOINT ["/bin/icq-demo"]
Loading

0 comments on commit 0288bf5

Please sign in to comment.