Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async-icq simapp & demo #122

Merged
merged 13 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading