Skip to content

Commit

Permalink
Merge pull request #969 from mumoshu/test-infra
Browse files Browse the repository at this point in the history
Add test infrastructure
  • Loading branch information
autumo authored Nov 15, 2023
2 parents 33e59e6 + adf4c9b commit 6c1bb97
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Test

on:
push:
pull_request:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.19'
cache: true
- name: Run tests
run: go test ./...
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.19'
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.55.1
args: -v --timeout=10m
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/go-git/go-git/v5 v5.10.0
github.com/nlopes/slack v0.6.1-0.20191106133607-d06c2a2b3249
github.com/shurcooL/githubv4 v0.0.0-20191006152017-6d1ea27df521
github.com/stretchr/testify v1.8.1
golang.org/x/oauth2 v0.14.0
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2
gopkg.in/yaml.v2 v2.4.0
Expand Down Expand Up @@ -53,6 +54,7 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f // indirect
github.com/skeema/knownhosts v1.2.0 // indirect
Expand Down
24 changes: 24 additions & 0 deletions project_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package main

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestProjectFind(t *testing.T) {
pl := &ProjectList{
Items: []DeployProject{
{
ID: "testid",
Kind: "testkind",
},
},
}
want := DeployProject{
ID: "test",
Kind: "testkind",
}
got := pl.Find("testid")
require.Equal(t, want, got)
}

0 comments on commit 6c1bb97

Please sign in to comment.