Skip to content

Commit

Permalink
feat: refactor CI/CD (cosmos#837)
Browse files Browse the repository at this point in the history
Tracked by epic: celestiaorg/devops#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 celestiaorg/devops#163

---------

Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com>
  • Loading branch information
smuu authored Apr 6, 2023
1 parent e0a49ea commit 09448cb
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 286 deletions.
9 changes: 5 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ updates:
schedule:
interval: daily
open-pull-requests-limit: 10
reviewers:
- "rollkit/celestia"
- package-ecosystem: gomod
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
reviewers:
- "rollkit/celestia"
labels:
- T:dependencies
- package-ecosystem: docker
directory: "/docker"
schedule:
interval: weekly
open-pull-requests-limit: 10
59 changes: 15 additions & 44 deletions .github/workflows/docker-build-da-mockserv.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,23 @@
name: build-mockserv
name: mockserv Docker Build & Publish

# Trigger on all push events, new semantic version tags, and all PRs
on:
push:
branches:
- main
- "**"
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"
pull_request:
release:
types: [published]
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: celestiaorg/rollmint-mockserv

jobs:
docker-build:
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: "ubuntu-latest"
docker-security-build:
permissions:
contents: write
packages: write
steps:
- name: "Checkout source code"
uses: "actions/checkout@v3"
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.17
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,prefix=${{ env.TAG_PREFIX }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64, linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
file: docker/mockserv.Dockerfile
contents: write
packages: write
uses: celestiaorg/.github/.github/workflows/reusable_dockerfile_pipeline.yml@v0.1.0 # yamllint disable-line rule:line-length
with:
dockerfile: docker/mockserv.Dockerfile
packageName: mockserv
72 changes: 0 additions & 72 deletions .github/workflows/docker-build-ethermint-debug.yml

This file was deleted.

117 changes: 0 additions & 117 deletions .github/workflows/docker-build-test-ethermint.yml

This file was deleted.

61 changes: 33 additions & 28 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,55 @@
name: Linters
# lint runs all linters in this repository. This workflow is run on every pull
# request and push to main.
name: lint
on:
push:
tags:
- v*
branches:
- main
pull_request:
workflow_call:

jobs:
golangci:
name: lint
golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 1.19
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.4.0
# This steps sets the GIT_DIFF environment variable to true
# if files defined in PATTERS changed
- uses: technote-space/get-diff-action@v6.1.2
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
# This job will pass without running if go.mod, go.sum, and *.go
# wasn't modified.
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: golangci/golangci-lint-action@v3.4.0
with:
version: v1.50.1
args: --timeout 10m
github-token: ${{ secrets.github_token }}
if: env.GIT_DIFF

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

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

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
markdownlint:
markdown-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: markdownlint-cli
uses: nosborn/github-action-markdown-cli@v3.3.0
with:
files: .
config-file: .markdownlint.yaml
- uses: celestiaorg/.github/.github/actions/markdown-lint@v0.1.0
28 changes: 14 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19

- name: Build
run: go build -v ./...
- name: Build
run: go build -v ./...

- name: Test & Coverage
run: |
go install github.com/ory/go-acc@v0.2.6
go-acc -o coverage.txt ./... -- -v --race
- name: Test & Coverage
run: |
go install github.com/ory/go-acc@v0.2.6
go-acc -o coverage.txt ./... -- -v --race
- uses: codecov/codecov-action@v3
with:
file: ./coverage.txt
- uses: codecov/codecov-action@v3
with:
file: ./coverage.txt
Loading

0 comments on commit 09448cb

Please sign in to comment.