Skip to content

Commit 09448cb

Browse files
authored
feat: refactor CI/CD (#837)
Tracked by epic: https://github.com/celestiaorg/devops/issues/111 Changes: - remove unused workflows - use of common workflow for container build (mockserv) - let dependabot bump Dockerfile Please comment on all ideas, thoughts, and questions as a comment. Closes https://github.com/celestiaorg/devops/issues/163 --------- Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com>
1 parent e0a49ea commit 09448cb

10 files changed

Lines changed: 73 additions & 286 deletions

.github/dependabot.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ updates:
55
schedule:
66
interval: daily
77
open-pull-requests-limit: 10
8-
reviewers:
9-
- "rollkit/celestia"
108
- package-ecosystem: gomod
119
directory: "/"
1210
schedule:
1311
interval: weekly
1412
open-pull-requests-limit: 10
15-
reviewers:
16-
- "rollkit/celestia"
1713
labels:
1814
- T:dependencies
15+
- package-ecosystem: docker
16+
directory: "/docker"
17+
schedule:
18+
interval: weekly
19+
open-pull-requests-limit: 10
Lines changed: 15 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,23 @@
1-
name: build-mockserv
1+
name: mockserv Docker Build & Publish
22

3+
# Trigger on all push events, new semantic version tags, and all PRs
34
on:
45
push:
56
branches:
6-
- main
7+
- "**"
8+
tags:
9+
- "v[0-9]+.[0-9]+.[0-9]+"
10+
- "v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+"
11+
- "v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+"
12+
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"
713
pull_request:
8-
release:
9-
types: [published]
10-
workflow_dispatch:
11-
12-
env:
13-
REGISTRY: ghcr.io
14-
IMAGE_NAME: celestiaorg/rollmint-mockserv
1514

1615
jobs:
17-
docker-build:
18-
if: github.event.pull_request.head.repo.full_name == github.repository
19-
runs-on: "ubuntu-latest"
16+
docker-security-build:
2017
permissions:
21-
contents: write
22-
packages: write
23-
steps:
24-
- name: "Checkout source code"
25-
uses: "actions/checkout@v3"
26-
- name: Set up Go
27-
uses: actions/setup-go@v4
28-
with:
29-
go-version: 1.17
30-
- name: Docker meta
31-
id: meta
32-
uses: docker/metadata-action@v4
33-
with:
34-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
35-
tags: |
36-
type=sha,prefix=${{ env.TAG_PREFIX }}
37-
- name: Set up Docker Buildx
38-
uses: docker/setup-buildx-action@v2
39-
- name: Login to GHCR
40-
uses: docker/login-action@v2
41-
with:
42-
registry: ghcr.io
43-
username: ${{ github.repository_owner }}
44-
password: ${{ secrets.GITHUB_TOKEN }}
45-
- name: Build and push
46-
uses: docker/build-push-action@v4
47-
with:
48-
context: .
49-
platforms: linux/amd64, linux/arm64
50-
push: true
51-
tags: ${{ steps.meta.outputs.tags }}
52-
file: docker/mockserv.Dockerfile
18+
contents: write
19+
packages: write
20+
uses: celestiaorg/.github/.github/workflows/reusable_dockerfile_pipeline.yml@v0.1.0 # yamllint disable-line rule:line-length
21+
with:
22+
dockerfile: docker/mockserv.Dockerfile
23+
packageName: mockserv

.github/workflows/docker-build-ethermint-debug.yml

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

.github/workflows/docker-build-test-ethermint.yml

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

.github/workflows/lint.yml

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,55 @@
1-
name: Linters
1+
# lint runs all linters in this repository. This workflow is run on every pull
2+
# request and push to main.
3+
name: lint
24
on:
35
push:
46
tags:
57
- v*
68
branches:
79
- main
810
pull_request:
11+
workflow_call:
912

1013
jobs:
11-
golangci:
12-
name: lint
14+
golangci-lint:
15+
name: golangci-lint
1316
runs-on: ubuntu-latest
1417
steps:
1518
- uses: actions/checkout@v3
1619
- uses: actions/setup-go@v4
1720
with:
1821
go-version: 1.19
19-
- name: golangci-lint
20-
uses: golangci/golangci-lint-action@v3.4.0
22+
# This steps sets the GIT_DIFF environment variable to true
23+
# if files defined in PATTERS changed
24+
- uses: technote-space/get-diff-action@v6.1.2
2125
with:
22-
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
23-
version: latest
24-
25-
# Optional: working directory, useful for monorepos
26-
# working-directory: somedir
27-
28-
# Optional: golangci-lint command line arguments.
29-
# args: --issues-exit-code=0
30-
31-
# Optional: show only new issues if it's a pull request. The default value is `false`.
32-
# only-new-issues: true
26+
# This job will pass without running if go.mod, go.sum, and *.go
27+
# wasn't modified.
28+
PATTERNS: |
29+
**/**.go
30+
go.mod
31+
go.sum
32+
- uses: golangci/golangci-lint-action@v3.4.0
33+
with:
34+
version: v1.50.1
35+
args: --timeout 10m
36+
github-token: ${{ secrets.github_token }}
37+
if: env.GIT_DIFF
3338

34-
# Optional: if set to true then the action will use pre-installed Go.
35-
# skip-go-installation: true
39+
# hadolint lints the Dockerfile
40+
hadolint:
41+
uses: celestiaorg/.github/.github/workflows/reusable_dockerfile_lint.yml@v0.1.0 # yamllint disable-line rule:line-length
42+
with:
43+
dockerfile: docker/mockserv.Dockerfile
3644

37-
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
38-
# skip-pkg-cache: true
45+
yamllint:
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v3
49+
- uses: celestiaorg/.github/.github/actions/yamllint@v0.1.0
3950

40-
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
41-
# skip-build-cache: true
42-
markdownlint:
51+
markdown-lint:
4352
runs-on: ubuntu-latest
4453
steps:
4554
- uses: actions/checkout@v3
46-
- name: markdownlint-cli
47-
uses: nosborn/github-action-markdown-cli@v3.3.0
48-
with:
49-
files: .
50-
config-file: .markdownlint.yaml
55+
- uses: celestiaorg/.github/.github/actions/markdown-lint@v0.1.0

.github/workflows/test.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v3
1515

16-
- name: Set up Go
17-
uses: actions/setup-go@v4
18-
with:
19-
go-version: 1.19
16+
- name: Set up Go
17+
uses: actions/setup-go@v4
18+
with:
19+
go-version: 1.19
2020

21-
- name: Build
22-
run: go build -v ./...
21+
- name: Build
22+
run: go build -v ./...
2323

24-
- name: Test & Coverage
25-
run: |
26-
go install github.com/ory/go-acc@v0.2.6
27-
go-acc -o coverage.txt ./... -- -v --race
24+
- name: Test & Coverage
25+
run: |
26+
go install github.com/ory/go-acc@v0.2.6
27+
go-acc -o coverage.txt ./... -- -v --race
2828
29-
- uses: codecov/codecov-action@v3
30-
with:
31-
file: ./coverage.txt
29+
- uses: codecov/codecov-action@v3
30+
with:
31+
file: ./coverage.txt

0 commit comments

Comments
 (0)