-
Notifications
You must be signed in to change notification settings - Fork 321
88 lines (73 loc) · 2.32 KB
/
go-build-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Go Build Test
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
go-build:
name: Test with go ${{ matrix.go_version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
permissions:
contents: write
# pull-requests: write
strategy:
matrix:
os: [ubuntu-latest]
go_version: ["1.21.x", "1.22.x"]
steps:
- name: Checkout Server repository
uses: actions/checkout@v4
- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go_version }}
- name: Build test SDK core
run: |
go mod tidy
go generate ./...
cd wasm/cmd && make wasm
# TODO: add coverage test
# dockerfile-test:
# name: Build and Test Dockerfile
# runs-on: ubuntu-latest
# strategy:
# matrix:
# go_version: ["1.21"]
# steps:
# - name: Checkout Repository
# uses: actions/checkout@v4
# - name: Set up Go ${{ matrix.go_version }}
# uses: actions/setup-go@v5
# with:
# go-version: ${{ matrix.go_version }}
# - name: Get dependencies
# run: |
# go mod tidy
# go mod download
# go install github.com/magefile/mage@latest
# - name: Build Docker Image
# run: |
# IMAGE_NAME="${{ github.event.repository.name }}-test"
# CONTAINER_NAME="${{ github.event.repository.name }}-container"
# docker build -t $IMAGE_NAME .
# - name: Run Docker Container
# run: |
# IMAGE_NAME="${{ github.event.repository.name }}-test"
# CONTAINER_NAME="${{ github.event.repository.name }}-container"
# docker run --name $CONTAINER_NAME -d $IMAGE_NAME
# docker ps -a
# - name: Test Docker Container Logs
# run: |
# CONTAINER_NAME="${{ github.event.repository.name }}-container"
# docker logs $CONTAINER_NAME
# # - name: Cleanup Docker Container
# # run: |
# # CONTAINER_NAME="${{ github.event.repository.name }}-container"
# # IMAGE_NAME="${{ github.event.repository.name }}-test"
# # docker stop $CONTAINER_NAME
# # docker rm $CONTAINER_NAME
# # docker rmi $IMAGE_NAME