Skip to content

Commit

Permalink
Merge pull request #10 from WoSai/feature/devcontainer
Browse files Browse the repository at this point in the history
Feature/devcontainer
  • Loading branch information
jacexh committed Nov 27, 2023
2 parents 43f33a9 + d5d4d15 commit 4cd7163
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 135 deletions.
62 changes: 62 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.163.1/containers/go
{
"name": "Go",
"image": "mcr.microsoft.com/devcontainers/go:1-1.21-bookworm",
"customizations": {
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.defaultProfile.osx": "zsh",
"terminal.integrated.defaultProfile.windows": "zsh",
"go.toolsManagement.checkForUpdates": "local",
"go.gopath": "/go",
"go.useLanguageServer": true
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"golang.Go",
"eamodio.gitlens",
"mohsen1.prettify-json",
"bierner.markdown-preview-github-styles",
"cschleiden.vscode-github-actions",
"redhat.vscode-yaml",
"carlos-algms.make-task-provider",
"k--kato.intellij-idea-keybindings",
"donjayamanne.githistory",
"github.vscode-pull-request-github",
"carlos-algms.make-task-provider",
"kennylong.kubernetes-yaml-formatter"
]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [16600],

// Use 'portsAttributes' to set default properties for specific forwarded ports. More info: https://code.visualstudio.com/docs/remote/devcontainerjson-reference.
"portsAttributes": {
"16600": {
"label": "HTTP API",
"onAutoForward": "openBrowserOnce"
}
},

"remoteEnv": {
"GOPROXY": "https://goproxy.cn,direct"
},

// Use 'otherPortsAttributes' to configure any ports that aren't configured using 'portsAttributes'.
// "otherPortsAttributes": {
// "onAutoForward": "silent"
// },

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "go work sync",

// Uncomment to connect as a non-root user. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
// "workspaceFolder": "/workspace/ultron",
// "workspaceMount": "source=/home/admin/workspace/ultron,target=/workspace/ultron,type=bind,consistency=cached"
}
23 changes: 0 additions & 23 deletions .devcontainer/Dockerfile

This file was deleted.

63 changes: 0 additions & 63 deletions .devcontainer/devcontainer.json

This file was deleted.

44 changes: 22 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,71 +3,71 @@ name: ci
on:
pull_request:
branches:
- master
- master
push:
branches:
- release/*
- hotfix/*
- master
- release/*
- hotfix/*
- master
tags:
- v*
- v*

jobs:
unittest:
name: Run Unit TestCase
strategy:
fail-fast: true
matrix:
go-version: [1.17.x, 1.18.x]
go-version: [1.21.x]
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: ${{matrix.go-version}}
- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Unittest
run: make test
- name: Upload code coverage report
if: ${{ matrix.go-version == '1.17.x' }}
uses: actions/upload-artifact@v2
if: ${{ matrix.go-version == '1.21.x' }}
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: coverage.txt
- name: Benchmark
run: make bench

code-coverage:
name: Publish Code Coverage Report
runs-on: ubuntu-latest
needs: unittest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Download code coverage report
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: code-coverage-report
- name: Code Coverage Report
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
files: coverage.txt
verbose: true
flags: unittest
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

build-docker-image:
name: Build and Publish Docker Image
runs-on: ubuntu-latest
needs: code-coverage
needs: unittest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
images: ghcr.io/wosai/deepmock
tags: |
Expand All @@ -76,15 +76,15 @@ jobs:
type=ref, event=pr
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
push: true
Expand Down
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM golang:1.17-bullseye as builder
WORKDIR /go/src/github.com/wosai/deepmock
COPY . /go/src/github.com/wosai/deepmock
ENV GO111MODULE on
FROM golang:1.21-bullseye as builder
WORKDIR /go/src/
COPY . /go/src/
ENV GOPROXY https://goproxy.cn,direct
RUN set -e \
&& apt update -y \
Expand All @@ -12,7 +11,7 @@ RUN set -e \

FROM debian:bullseye
WORKDIR /app
COPY --from=builder /go/src/github.com/wosai/deepmock/deepmock .
COPY --from=builder /go/src/deepmock .
COPY entrypoint.sh /usr/bin/

EXPOSE 16600
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/wosai/deepmock

go 1.17
go 1.21

require (
github.com/didi/gendry v1.3.1
Expand Down Expand Up @@ -31,5 +31,5 @@ require (
go.uber.org/multierr v1.1.0 // indirect
google.golang.org/appengine v1.6.2 // indirect
gopkg.in/DATA-DOG/go-sqlmock.v1 v1.3.0 // indirect
gopkg.in/yaml.v2 v2.2.4 // indirect
gopkg.in/yaml.v2 v2.2.8 // indirect
)
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,6 @@ gopkg.in/DATA-DOG/go-sqlmock.v1 v1.3.0/go.mod h1:OdE7CF6DbADk7lN8LIKRzRJTTZXIjtW
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
3 changes: 3 additions & 0 deletions go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
go 1.21.3

use .

0 comments on commit 4cd7163

Please sign in to comment.