diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..4e81aa7 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,23 @@ +name: Go + +on: + pull_request: + branches: [ main ] + +jobs: + + build: + 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: Test + run: go test -v ./... diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e6d9f5b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +name: goreleaser + +on: + push: + tags: + - '*' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Docker Login + uses: docker/login-action@v1 + with: + registry: docker.pkg.github.com + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..3b29cc4 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,32 @@ +builds: + # You can have multiple builds defined as a yaml list + - + # GOOS list to build for. + # For more info refer to: https://golang.org/doc/install/source#environment + # Defaults are darwin and linux. + goos: + - darwin + - linux + + # GOARCH to build for. + # For more info refer to: https://golang.org/doc/install/source#environment + # Defaults are 386, amd64 and arm64. + goarch: + - amd64 + - arm64 + - 386 +dockers: + # You can have multiple Docker images. + - + # GOOS of the built binaries/packages that should be used. + goos: linux + + # GOARCH of the built binaries/packages that should be used. + goarch: amd64 + + # Templates of the Docker image names. + image_templates: + - "docker.pkg.github.com/navid2zp/citus-failover/citus-failover:latest" + # Path to the Dockerfile (from the project root). + dockerfile: Dockerfile + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..92dbd4d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM ubuntu:latest + +WORKDIR ~ + +COPY citus-failover . + +RUN apt-get update && apt-get install -y ca-certificates && apt-get clean + +CMD ["./citus-failover", "-f", "config/config.yml"] \ No newline at end of file