diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e98e9b4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: CI + +on: push + +jobs: + ci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.15 + + - name: Build + run: go build -v ./... + + - name: Lint + uses: golangci/golangci-lint-action@v2 + with: + version: v1.37 + + - name: Package + uses: docker/build-push-action@v2 + with: + push: false + tags: erichripko/pack.yaml + context: . + file: pack.yaml + + - name: Install test runner + run: curl -sSL "https://github.com/gotestyourself/gotestsum/releases/download/v1.6.2/gotestsum_1.6.2_linux_amd64.tar.gz" | sudo tar -xz -C /usr/local/bin gotestsum + + - name: Test + run: gotestsum --junitfile unit-tests.xml -- -v -coverprofile=coverage.txt -covermode=atomic ./... + + - name: Upload results + uses: EnricoMi/publish-unit-test-result-action@v1 + with: + files: unit-tests.xml + + - name: Upload coverage + uses: codecov/codecov-action@v1 + + - name: Login to DockerHub + if: github.ref == 'ref/heads/master' && success() + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Release + if: github.ref == 'ref/heads/master' && success() + uses: docker/build-push-action@v2 + with: + push: true + tags: erichripko/pack.yaml + context: . + file: pack.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 3d7f781..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Release - -on: - push: - branches: - - main - -jobs: - release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v2 - with: - push: true - tags: erichripko/pack.yaml - context: . - file: pack.yaml diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml deleted file mode 100644 index 561698e..0000000 --- a/.github/workflows/verify.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Verify - -on: push - -jobs: - verify: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.15 - - - name: Build - run: go build -v ./... - - - name: Lint - uses: golangci/golangci-lint-action@v2 - with: - version: v1.37 - - - name: Test - run: go test -v -coverprofile=coverage.txt -covermode=atomic ./... - - - name: Upload coverage report - uses: codecov/codecov-action@v1 diff --git a/.gitignore b/.gitignore index 839a56d..9c89c13 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,7 @@ # Dependency directories (remove the comment below to include it) vendor/ + +# Test results +unit-tests.xml +coverage.txt