From a7a6cc64f645d6233ebd8353bf6fcbec4daa55b2 Mon Sep 17 00:00:00 2001 From: Arsham Arya Date: Fri, 24 Nov 2023 08:21:42 +0330 Subject: [PATCH] cicd: test on pull requests. --- .github/workflows/test.yaml | 36 ++++++++++++++++++++++++++++++++++++ go.mod | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..940f073 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,36 @@ +name: Go Test + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.21.0 + + - name: Install dependencies + run: go mod download + + - name: Run tests + run: go test -v ./... + + - name: Check code style + run: gofmt -l -s $(find . -type f -name '*.go' -not -path "./vendor/*") + + - name: Gosec Security Scanner + uses: securego/gosec@master + with: + args: ./... diff --git a/go.mod b/go.mod index cba1122..0e9d1eb 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/arshamalh/dockeroller -go 1.19 +go 1.21.0 require ( github.com/docker/docker v20.10.17+incompatible