Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReReboot #1

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
13 changes: 0 additions & 13 deletions .editorconfig

This file was deleted.

11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2

updates:
- package-ecosystem: gomod
directory: /
schedule:
interval: daily
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build

on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- run: go version
- uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean --snapshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: ${{ github.sha }}
path: dist/*
56 changes: 56 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Check

on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
go-mod-tidy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: false
- run: go version
- run: go mod tidy
- name: Check whether go.mod and go.sum are tidied
run: git diff --exit-code

golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: false
- run: go version
- uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --verbose

goreleaser-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- run: go version
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: check
28 changes: 28 additions & 0 deletions .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: govulncheck

on:
schedule:
- cron: '23 05 * * *'
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
govulncheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 'stable'
- run: go version
- run: go install golang.org/x/vuln/cmd/govulncheck@latest
- run: govulncheck --show version -test ./...
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release

on:
push:
tags:
- '*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- run: go version
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean --fail-fast
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 changes: 21 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
name: Test

on:
push:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main

permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}

test:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '^1.19.4'

- name: Print Go version
run: go version

- name: Run tests
run: go test -race -v ./...
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- run: go version
- run: go test -v -count=1 -race -shuffle=on -cover -coverprofile=coverage.out ./...
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
59 changes: 59 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
linters:
presets:
- bugs
- comment
- complexity
- error
- format
- import
- metalinter
- module
- performance
- sql
- style
- test
- unused

# disable:
# - depguard
# - dupl
# - exhaustruct
# - godox
# - lll
# - nlreturn
# - nonamedreturns
# - paralleltest
# - tagliatelle
# - testpackage
# - varnamelen
# - wrapcheck
# - wsl # TODO

#linters-settings:
# ireturn:
# allow:
# - anon
# - error
# - empty
# - stdlib
# - (or|er)$
# - generic
# - T

#issues:
# exclude-rules:
# - path: '(.+)_test\.go'
# linters:
# - bodyclose
# - dupword
# - forcetypeassert
# - funlen
# - gochecknoglobals
# - maintidx
# - unparam
# - path: 'cmd/wpsecadvi'
# linters:
# - unparam
# - path: 'cmd/wpsecadvi/version.go'
# linters:
# - gochecknoglobals
47 changes: 47 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: 1

before:
hooks:
- go mod tidy

builds:
- main: ./cmd/wpsecadvi
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- -s -w -X main.version={{.Version}} -X main.fullCommit={{.FullCommit}} -X main.commitOn={{ .CommitDate }} -X main.isGitDirty={{ .IsGitDirty }}

gomod:
proxy: true
env:
- GOPROXY=https://proxy.golang.org
- GOSUMDB=sum.golang.org
mod: mod

release:
draft: true

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}

changelog:
use: github-native

checksum:
disable: false

report_sizes: true
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright © 2022-2023 Typist Tech Limited
Copyright © 2022-2024 Typist Tech Limited

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading
Loading