unit tests

Signed-off-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
Casey Lee
2020-02-10 15:27:05 -08:00
parent be75ee20b1
commit 0582306861
466 changed files with 94683 additions and 62526 deletions

View File

@@ -1,14 +0,0 @@
FROM golangci/golangci-lint:v1.12.5
RUN apt-get install git
LABEL "com.github.actions.name"="Check"
LABEL "com.github.actions.description"="Run static analysis and unit tests"
LABEL "com.github.actions.icon"="check-circle"
LABEL "com.github.actions.color"="green"
COPY "entrypoint.sh" "/entrypoint.sh"
RUN chmod +x /entrypoint.sh
ENV GOFLAGS -mod=vendor
ENTRYPOINT ["/entrypoint.sh"]

View File

@@ -1,12 +0,0 @@
FROM golangci/golangci-lint:v1.12.5
LABEL "com.github.actions.name"="Check"
LABEL "com.github.actions.description"="Run integration tests"
LABEL "com.github.actions.icon"="check-circle"
LABEL "com.github.actions.color"="green"
COPY "entrypoint.sh" "/entrypoint.sh"
RUN chmod +x /entrypoint.sh
ENV GOFLAGS -mod=vendor
ENTRYPOINT ["/entrypoint.sh"]

View File

@@ -1,3 +0,0 @@
#!/bin/sh
set -e
go test -cover ./actions

48
.github/main.workflow vendored
View File

@@ -1,48 +0,0 @@
workflow "check-and-release" {
on = "push"
resolves = ["release"]
}
action "check" {
uses = "./.github/actions/check"
}
action "release-filter" {
needs = ["check"]
uses = "actions/bin/filter@master"
args = "tag 'v*'"
}
# only release on `v*` tags
action "release" {
needs = ["release-filter"]
uses = "docker://goreleaser/goreleaser:v0.98"
args = "release"
secrets = ["GITHUB_TOKEN"]
}
# local action for `make build`
action "build" {
uses = "docker://goreleaser/goreleaser:v0.98"
args = "--snapshot --rm-dist"
secrets = ["SNAPSHOT_VERSION"]
}
# local action for `make vendor`
action "vendor" {
uses = "docker://golang:1.11.4"
args = "go mod vendor"
}
action "integration-tests" {
needs = ["check"]
uses = "./.github/actions/integration"
}
# local release
action "local-release" {
needs = ["integration-tests"]
uses = "docker://goreleaser/goreleaser:v0.98"
args = "release"
secrets = ["GITHUB_TOKEN"]
}

View File

@@ -1,31 +0,0 @@
name: basic
on: push
jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
build:
runs-on: ubuntu-latest
container:
image: node:10.16-jessie
env:
NODE_ENV: development
steps:
- run: env
test:
runs-on: ubuntu-latest
needs: [build]
steps:
- run: cp $GITHUB_EVENT_PATH $HOME/foo.json
- run: ls $HOME
- run: cat $HOME/foo.json
- uses: docker://alpine:3.8
with:
args: uname -a
local-action:
runs-on: ubuntu-latest
steps:
- uses: ./.github/workflows/docker-url

9
.github/workflows/check/Dockerfile vendored Normal file
View File

@@ -0,0 +1,9 @@
FROM golangci/golangci-lint:v1.23.6
RUN apt-get install git
COPY "entrypoint.sh" "/entrypoint.sh"
RUN chmod +x /entrypoint.sh
ENV GOFLAGS -mod=vendor
ENTRYPOINT ["/entrypoint.sh"]

8
.github/workflows/check/action.yml vendored Normal file
View File

@@ -0,0 +1,8 @@
name: Check
description: Run static analysis and unit tests
branding:
icon: check-circle
color: green
runs:
using: 'docker'
image: 'Dockerfile'

View File

@@ -1,4 +1,4 @@
#!/bin/sh
set -e
golangci-lint run
go test -cover -short ./...
go test -cover -short ./...

View File

@@ -1,16 +0,0 @@
name: docker-url
author: nektos
description: testing
inputs:
who-to-greet:
description: who to greet
required: true
default: World
runs:
using: docker
image: docker://alpine:3.8
env:
TEST: enabled
args:
- echo
- ${INPUT_WHO_TO_GREET}

View File

@@ -0,0 +1,7 @@
FROM golangci/golangci-lint:v1.23.6
COPY "entrypoint.sh" "/entrypoint.sh"
RUN chmod +x /entrypoint.sh
ENV GOFLAGS -mod=vendor
ENTRYPOINT ["/entrypoint.sh"]

View File

@@ -0,0 +1,8 @@
name: Check
description: Run integration tests
branding:
icon: check-circle
color: green
runs:
using: 'docker'
image: 'Dockerfile'

View File

@@ -0,0 +1,3 @@
#!/bin/sh
set -e
go test -cover ./runner

9
.github/workflows/push.yml vendored Normal file
View File

@@ -0,0 +1,9 @@
name: push
on: push
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: ./.github/workflows/check
- uses: ./.github/workflows/integration

20
.github/workflows/tag.yml vendored Normal file
View File

@@ -0,0 +1,20 @@
name: tag
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: ./.github/workflows/check
- uses: ./.github/workflows/integration
- uses: goreleaser/goreleaser-action@v1
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}