Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .codecov.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"timezone": "Asia/Shanghai",
"extends": [
"schedule:earlyMondays",
"config:recommended",
// "docker:pinDigests",
"helpers:pinGitHubActionDigests",
":configMigration",
":pinDevDependencies",
"security:openssf-scorecard",
],
}
139 changes: 8 additions & 131 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,8 @@ permissions:

on:
push:
tags:
- v*
branches:
- master
- stable
- v1
release:
types:
- published
- released
pull_request:
types:
- opened
Expand All @@ -42,139 +34,24 @@ jobs:
strategy:
matrix:
go_version:
- ^1.19
- 1.23
- 1.24
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
submodules: recursive

- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
with:
go-version: ${{ matrix.go_version }}

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Run linter
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8

- name: Run tests
run: go test -coverprofile=./coverage.txt -covermode=atomic -v ./...

- name: Collect coverage
uses: codecov/codecov-action@v1
with:
file: ./coverage.txt

fuzz:
name: Fuzzing
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ^1.18

- name: Cache fuzz results
uses: actions/cache@v2
with:
path: ~/.cache/go-build/fuzz
key: ${{ runner.os }}-go-${{ hashFiles('**/*_fuzz_test.go', '**/*_fuzz_internal_test.go') }}
restore-keys: ${{ runner.os }}-go-

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
run: go test -v ./...

- name: Run fuzzing
run: make -j4 fuzz

lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ^1.19

- name: Run linter
uses: golangci/golangci-lint-action@v3
with:
version: v1.48.0

docker:
name: Docker
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive

- name: Get Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: nineseconds/mtg,ghcr.io/9seconds/mtg
tag-semver: "{{version}},{{major}},{{major}}.{{minor}}"

- name: Setup QEMU
uses: docker/setup-qemu-action@v1

- name: Setup BuildX
uses: docker/setup-buildx-action@v1

- name: Setup cache
uses: actions/cache@v2
with:
path: /tmp/buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Login to GHCR.io
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_PAT }}

- name: Build and push
uses: docker/build-push-action@v2
with:
pull: true
context: .
platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7,linux/arm/v6
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=local,src=/tmp/buildx-cache
cache-to: type=local,dest=/tmp/buildx-cache
11 changes: 6 additions & 5 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ jobs:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -60,7 +61,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -74,4 +75,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v3
22 changes: 0 additions & 22 deletions .golangci.toml

This file was deleted.

65 changes: 0 additions & 65 deletions .goreleaser.yml

This file was deleted.

10 changes: 10 additions & 0 deletions .ko.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
builds:
- id: mtg
dir: . # default is .
flags:
- -trimpath
- -mod=readonly
ldflags:
- -s -w
- -extldflags "-static"
- -X main.version={{.Env.VERSION}}
47 changes: 47 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-illegal-windows-names
- id: check-json
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-symlinks
# - id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: check-yaml
- id: destroyed-symlinks
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: no-commit-to-branch

# zizmor detects security vulnerabilities in GitHub Actions workflows.
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.7.0
hooks:
- id: zizmor
#entry: zizmor --gh-token "$(gh auth token)"

# `actionlint` hook, for verifying correct syntax in GitHub Actions workflows.
- repo: https://github.com/rhysd/actionlint
rev: v1.7.7
hooks:
- id: actionlint

# `gitleaks` detects hardcoded secrets in the codebase to prevent accidental exposure.
- repo: https://github.com/gitleaks/gitleaks
rev: v8.26.0
hooks:
- id: gitleaks

- repo: https://github.com/golangci/golangci-lint
rev: v2.1.6
hooks:
- id: golangci-lint-config-verify
- id: golangci-lint-fmt
- id: golangci-lint-full
31 changes: 0 additions & 31 deletions Dockerfile

This file was deleted.

Loading
Loading