Skip to content

Commit

Permalink
build and test separately (#144)
Browse files Browse the repository at this point in the history
* Create go.yml

* reorganize actions

* fix linting issues

* just build distro
  • Loading branch information
sakai135 authored Aug 20, 2022
1 parent c99296f commit 55e40e7
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml → .github/workflows/distro.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Distro

on:
push:
Expand All @@ -9,25 +9,28 @@ env:
DOCKLE_HOST: "unix:///var/run/docker.sock" # https://github.com/Azure/container-scan/issues/146

jobs:

build:
runs-on: ubuntu-20.04
permissions:
checks: write
steps:
- uses: actions/checkout@v3

- name: Build
run: |
docker build -t $TAG_NAME -f ./distro/Dockerfile --build-arg REF=$RUN_URL --build-arg VERSION=${GITHUB_REF#refs/tags/} .
- uses: azure/container-scan@v0
with:
image-name: ${{ env.TAG_NAME }}

- name: Package
run: |
CONTAINER_ID=$(docker create $TAG_NAME)
docker export $CONTAINER_ID | gzip > wsl-vpnkit.tar.gz
sha256sum wsl-vpnkit.tar.gz | tee wsl-vpnkit.tar.gz.sha256
ls -la wsl-vpnkit.tar.gz
- name: Artifacts
uses: actions/upload-artifact@v3
with:
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Go

on:
push:

jobs:

build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18.5

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...

- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
6 changes: 3 additions & 3 deletions pkg/transport/dial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestHelperProcess(*testing.T) {
if string(read) == "error" {
os.Exit(1)
}
conn.Write(read)
_, _ = conn.Write(read)
}
}

Expand All @@ -73,7 +73,7 @@ func TestDial(t *testing.T) {
t.Errorf("unexpected string %s", str)
}

conn.Write([]byte("hi there\n"))
_, _ = conn.Write([]byte("hi there\n"))
line, _, err = reader.ReadLine()
if err != nil {
t.Error(err)
Expand Down Expand Up @@ -104,7 +104,7 @@ func TestDial_Error(t *testing.T) {
t.Error(err)
}

conn.Write([]byte("error"))
_, _ = conn.Write([]byte("error"))
_, _, err = reader.ReadLine()
if err == nil {
t.Error("expected error")
Expand Down

0 comments on commit 55e40e7

Please sign in to comment.