Skip to content

Commit 64f1881

Browse files
author
Carlos Tadeu Panato Junior
authored
replace circleci to use github actions (#88)
* replace circleci to use github actions * update based on feedback
1 parent c8affef commit 64f1881

File tree

8 files changed

+140
-183
lines changed

8 files changed

+140
-183
lines changed

.circleci/config.yml

Lines changed: 0 additions & 177 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: gomod
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 10

.github/workflows/build.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v2
19+
20+
- name: Install Go
21+
uses: actions/setup-go@v2
22+
with:
23+
go-version: 1.17.x
24+
25+
- name: check dependencies
26+
run: make check-deps
27+
28+
- name: Run build
29+
run: make package
30+
31+
- name: Archive production artifacts
32+
uses: actions/upload-artifact@v2
33+
with:
34+
name: push-proxy-binaries
35+
retention-days: 5
36+
path: |
37+
./dist/*.tar.gz
38+
./dist/checksums.txt
39+
40+
image:
41+
runs-on: ubuntu-latest
42+
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v2
46+
47+
- name: Set up QEMU
48+
uses: docker/setup-qemu-action@v1
49+
50+
- name: Set up Docker Buildx
51+
uses: docker/setup-buildx-action@v1
52+
53+
- name: Build image
54+
run: TAG=dirty make container
55+
56+
- name: Test image
57+
run: |
58+
docker run docker.io/mattermost/mattermost-push-proxy-amd64:dirty --version
59+
docker run --platform linux/arm64 docker.io/mattermost/mattermost-push-proxy-arm64:dirty --version

.github/workflows/golangci-lint.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: golangci-lint
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
golangci:
14+
name: lint
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: golangci-lint
19+
uses: golangci/golangci-lint-action@v2
20+
with:
21+
version: latest

.github/workflows/test.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
checks: write
12+
pull-requests: write
13+
14+
jobs:
15+
test:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v2
21+
22+
- name: Install Go
23+
uses: actions/setup-go@v2
24+
with:
25+
go-version: 1.17.x
26+
27+
- name: Run tests
28+
run: |
29+
go install gotest.tools/gotestsum@latest
30+
mkdir -p test-reports
31+
gotestsum --junitfile test-reports/unit-tests.xml
32+
33+
- name: Publish Unit Test Results
34+
uses: EnricoMi/publish-unit-test-result-action@v1
35+
if: always()
36+
with:
37+
files: test-reports/unit-tests.xml

.gitlab-ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include:
2+
- project: 'mattermost/ci/mattermost-push-proxy'
3+
ref: main
4+
file: '/all.yml'

Makefile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ endif
2525
PP_PKG=github.com/mattermost/mattermost-push-proxy/internal/version
2626
LDFLAGS="-X $(PP_PKG).gitVersion=$(GIT_VERSION) -X $(PP_PKG).gitCommit=$(GIT_HASH) -X $(PP_PKG).gitTreeState=$(GIT_TREESTATE) -X $(PP_PKG).buildDate=$(BUILD_DATE)"
2727

28-
2928
DIST_ROOT=dist
3029
DIST_PATH=$(DIST_ROOT)/mattermost-push-proxy
3130

@@ -37,6 +36,13 @@ update-dependencies:
3736
$(GO) get -u ./...
3837
$(GO) mod tidy
3938

39+
check-deps:
40+
$(GO) mod tidy -v
41+
@if [ -n "$$(command git --no-pager diff --exit-code go.mod go.sum)" ]; then \
42+
echo "There are unused dependencies that should be removed. Please execute `go mod tidy` to fix it."; \
43+
exit 1; \
44+
fi
45+
4046
build-release:
4147
@echo Building proxy push server
4248
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build -o $(GOBIN)/mattermost-push-proxy-linux-amd64 -trimpath -ldflags $(LDFLAGS) $(GOFLAGS)
@@ -56,7 +62,6 @@ golangci-lint: ## Run golangci-lint on codebase
5662
@echo Running golangci-lint
5763
golangci-lint run ./...
5864

59-
6065
package-linux-amd64:
6166
@ echo Packaging push proxy for linux amd64
6267

@@ -95,6 +100,9 @@ package-linux-arm64:
95100
tar -C dist -czf $(DIST_PATH)-linux-arm64.tar.gz mattermost-push-proxy
96101

97102
package: build-release package-linux-arm64 package-linux-amd64
103+
cd dist \
104+
sha256sum mattermost-push-proxy-linux-amd64.tar.gz >> checksums.txt \
105+
&& sha256sum mattermost-push-proxy-linux-arm64.tar.gz >> checksums.txt
98106

99107
package-image: build-release
100108
mkdir -p $(DIST_PATH)/bin
@@ -125,7 +133,6 @@ container: package-image init-docker-buildx
125133
--platform $${platform} \
126134
--build-arg=ARCH=$${platform##*/} \
127135
--tag $(IMAGE)-$${platform##*/}:$(TAG) \
128-
--tag $(IMAGE)-$${platform##*/}:latest \
129136
--file docker/Dockerfile \
130137
.; \
131138
done
@@ -136,7 +143,6 @@ push: container
136143
@for platform in $(PLATFORMS); do \
137144
echo "Pushing tags for $${platform} platform"; \
138145
docker push $(IMAGE)-$${platform##*/}:$(TAG); \
139-
docker push $(IMAGE)-$${platform##*/}:latest; \
140146
done
141147

142148
.PHONY: manifest

docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.14 AS TMP
1+
FROM alpine:3.15 AS TMP
22

33
WORKDIR /mattermost-push-proxy
44

@@ -8,7 +8,7 @@ COPY docker/entrypoint .
88
ARG ARCH
99
COPY bin/mattermost-push-proxy-linux-$ARCH bin/mattermost-push-proxy
1010

11-
FROM alpine:3.14
11+
FROM alpine:3.15
1212

1313
RUN apk add --no-cache \
1414
ca-certificates \

0 commit comments

Comments
 (0)