diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..d4989726979ecc499436260c5294053d6e9b54f5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,61 @@ +name: CI +on: + push: + branches: + - '**' + pull_request: + branches: + - '**' + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: golangci-lint + run: | + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s + ./bin/golangci-lint run -v + build: + runs-on: ${{ matrix.os }} + needs: lint + strategy: + fail-fast: true + matrix: + os: [macos-latest, windows-latest, ubuntu-latest] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v1 + with: + go-version: 1.14 + + - name: Build + run: go build ./cmd/provider-gitlab/ + + - name: Test + run: go test -v ./... + release: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v1 + with: + go-version: 1.14 + - run: echo "::add-path::~/go/bin" + - name: Get release dependencies + run: | + go get github.com/mitchellh/gox + go get github.com/tcnksm/ghr + - uses: go-semantic-release/action@v1 + id: semrel + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + ghr: true + - run: | + gox -parallel 4 -osarch="linux/amd64 darwin/amd64 linux/arm windows/amd64" -ldflags="-extldflags '-static' -s -w" -output="bin/{{.Dir}}_v${{steps.semrel.outputs.version}}_{{.OS}}_{{.Arch}}" ./cmd/provider-gitlab/ + if: steps.semrel.outputs.version != '' + - run: ghr $(cat .ghr) bin/ + if: steps.semrel.outputs.version != '' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}