mirror of
https://github.com/screego/server.git
synced 2025-12-24 12:57:51 +08:00
Add CI
This commit is contained in:
50
.github/workflows/build.yml
vendored
Normal file
50
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
name: build
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
screego:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.15.x
|
||||
- uses: actions/setup-node@v1
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
ui/node_modules
|
||||
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: ${{ runner.os }}-node_modules-
|
||||
- uses: actions/checkout@v2
|
||||
- run: go mod download
|
||||
- run: (cd ui && yarn)
|
||||
- run: (cd ui && yarn build)
|
||||
- run: (cd ui && yarn testformat)
|
||||
- uses: golangci/golangci-lint-action@v2
|
||||
with:
|
||||
version: v1.31
|
||||
- run: go build ./...
|
||||
- run: go test -race ./...
|
||||
- if: startsWith(github.ref, 'refs/tags/v')
|
||||
run: echo "$DOCKER_PASS" | docker login --username "$DOCKER_USER" --password-stdin
|
||||
env:
|
||||
DOCKER_USER: ${{ secrets.DOCKER_USER }}
|
||||
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
|
||||
- if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
version: latest
|
||||
args: release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- if: startsWith(github.ref, 'refs/tags/v')
|
||||
run: make VERSION=${GITHUB_REF/refs\/tags\/v/} docker-manifest-annotate docker-manifest-push
|
||||
env:
|
||||
DOCKER_USER: ${{ secrets.DOCKER_USER }}
|
||||
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
|
||||
65
.golangci.yml
Normal file
65
.golangci.yml
Normal file
@@ -0,0 +1,65 @@
|
||||
inters:
|
||||
enable:
|
||||
- asciicheck
|
||||
- bodyclose
|
||||
- deadcode
|
||||
- depguard
|
||||
- dogsled
|
||||
- dupl
|
||||
- errcheck
|
||||
- exhaustive
|
||||
- exportloopref
|
||||
- gci
|
||||
- gocritic
|
||||
- godot
|
||||
- goerr113
|
||||
- gofmt
|
||||
- gofumpt
|
||||
- goimports
|
||||
- golint
|
||||
- gomodguard
|
||||
- goprintffuncname
|
||||
- gosec
|
||||
- gosimple
|
||||
- govet
|
||||
- ineffassign
|
||||
- interfacer
|
||||
- misspell
|
||||
- nakedret
|
||||
- nolintlint
|
||||
- prealloc
|
||||
- rowserrcheck
|
||||
- scopelint
|
||||
- sqlclosecheck
|
||||
- staticcheck
|
||||
- structcheck
|
||||
- stylecheck
|
||||
- typecheck
|
||||
- unconvert
|
||||
- unparam
|
||||
- unused
|
||||
- varcheck
|
||||
- whitespace
|
||||
disable:
|
||||
- funlen
|
||||
- gochecknoglobals
|
||||
- gocognit
|
||||
- goconst
|
||||
- gocyclo
|
||||
- godox
|
||||
- gomnd
|
||||
- lll
|
||||
- maligned
|
||||
- nestif
|
||||
- nlreturn
|
||||
- noctx
|
||||
- testpackage
|
||||
- wsl
|
||||
|
||||
linters-settings:
|
||||
gofumpt:
|
||||
extra-rules: true
|
||||
goimports:
|
||||
local-prefixes: github.com/screego/server
|
||||
misspell:
|
||||
locale: US
|
||||
135
.goreleaser.yml
Normal file
135
.goreleaser.yml
Normal file
@@ -0,0 +1,135 @@
|
||||
# This is an example goreleaser.yaml file with some sane defaults.
|
||||
# Make sure to check the documentation at http://goreleaser.com
|
||||
project_name: screego
|
||||
before:
|
||||
hooks:
|
||||
- go mod download
|
||||
- go run hack/packr/packr.go
|
||||
builds:
|
||||
- env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- linux
|
||||
- windows
|
||||
- darwin
|
||||
- freebsd
|
||||
- openbsd
|
||||
goarch:
|
||||
- 386
|
||||
- amd64
|
||||
- arm
|
||||
- arm64
|
||||
- ppc64
|
||||
- ppc64le
|
||||
goarm:
|
||||
- 6
|
||||
- 7
|
||||
flags:
|
||||
- '-tags="netgo osusergo"'
|
||||
ldflags:
|
||||
- '-s'
|
||||
- '-w'
|
||||
- '-X main.version={{.Version}}'
|
||||
- '-X main.commitHash={{.Commit}}'
|
||||
- '-X main.mode=prod'
|
||||
archives:
|
||||
- files:
|
||||
- LICENSE
|
||||
- README.md
|
||||
replacements:
|
||||
386: i386
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
checksum:
|
||||
dockers:
|
||||
- goos: linux
|
||||
goarch: amd64
|
||||
goarm: ''
|
||||
binaries:
|
||||
- screego
|
||||
image_templates:
|
||||
- "screego/server:amd64-unstable"
|
||||
- "screego/server:amd64-{{ .RawVersion }}"
|
||||
- "screego/server:amd64-{{ .Major }}"
|
||||
dockerfile: Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.title={{.ProjectName}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
||||
- goos: linux
|
||||
goarch: 386
|
||||
binaries:
|
||||
- screego
|
||||
goarm: ''
|
||||
image_templates:
|
||||
- "screego/server:386-unstable"
|
||||
- "screego/server:386-{{ .RawVersion }}"
|
||||
- "screego/server:386-{{ .Major }}"
|
||||
dockerfile: Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.title={{.ProjectName}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
||||
- goos: linux
|
||||
goarch: arm64
|
||||
goarm: ''
|
||||
binaries:
|
||||
- screego
|
||||
image_templates:
|
||||
- "screego/server:arm64-unstable"
|
||||
- "screego/server:arm64-{{ .RawVersion }}"
|
||||
- "screego/server:arm64-{{ .Major }}"
|
||||
dockerfile: Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.title={{.ProjectName}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
||||
- goos: linux
|
||||
goarch: arm
|
||||
goarm: 7
|
||||
binaries:
|
||||
- screego
|
||||
image_templates:
|
||||
- "screego/server:armv7-unstable"
|
||||
- "screego/server:armv7-{{ .RawVersion }}"
|
||||
- "screego/server:armv7-{{ .Major }}"
|
||||
dockerfile: Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.title={{.ProjectName}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
||||
- goos: linux
|
||||
goarch: arm
|
||||
goarm: 6
|
||||
binaries:
|
||||
- screego
|
||||
image_templates:
|
||||
- "screego/server:armv6-unstable"
|
||||
- "screego/server:armv6-{{ .RawVersion }}"
|
||||
- "screego/server:armv6-{{ .Major }}"
|
||||
dockerfile: Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.title={{.ProjectName}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
||||
- goos: linux
|
||||
goarch: ppc64le
|
||||
goarm: ''
|
||||
binaries:
|
||||
- screego
|
||||
image_templates:
|
||||
- "screego/server:ppc64le-unstable"
|
||||
- "screego/server:ppc64le-{{ .RawVersion }}"
|
||||
- "screego/server:ppc64le-{{ .Major }}"
|
||||
dockerfile: Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.title={{.ProjectName}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
||||
5
Dockerfile
Normal file
5
Dockerfile
Normal file
@@ -0,0 +1,5 @@
|
||||
FROM scratch
|
||||
COPY screego /screego
|
||||
EXPOSE 5050
|
||||
WORKDIR "/"
|
||||
ENTRYPOINT [ "/scrego" ]
|
||||
25
Makefile
Normal file
25
Makefile
Normal file
@@ -0,0 +1,25 @@
|
||||
DOCKER_MANIFEST=DOCKER_CLI_EXPERIMENTAL=enabled docker manifest
|
||||
|
||||
docker-login-ci:
|
||||
docker login -u "$$DOCKER_USER" -p "$$DOCKER_PASS";
|
||||
|
||||
docker-manifest-annotate:
|
||||
echo ${VERSION}
|
||||
${DOCKER_MANIFEST} create --amend "screego/server:unstable" "screego/server:amd64-unstable" "screego/server:386-unstable" "screego/server:armv7-unstable" "screego/server:arm64-unstable" "screego/server:ppc64le-unstable"
|
||||
${DOCKER_MANIFEST} create --amend "screego/server:${VERSION}" "screego/server:amd64-${VERSION}" "screego/server:386-${VERSION}" "screego/server:armv7-${VERSION}" "screego/server:arm64-${VERSION}" "screego/server:ppc64le-${VERSION}"
|
||||
${DOCKER_MANIFEST} annotate "screego/server:unstable" "screego/server:amd64-unstable" --os=linux --arch=amd64
|
||||
${DOCKER_MANIFEST} annotate "screego/server:${VERSION}" "screego/server:amd64-${VERSION}" --os=linux --arch=amd64
|
||||
${DOCKER_MANIFEST} annotate "screego/server:unstable" "screego/server:386-unstable" --os=linux --arch=386
|
||||
${DOCKER_MANIFEST} annotate "screego/server:${VERSION}" "screego/server:386-${VERSION}" --os=linux --arch=386
|
||||
${DOCKER_MANIFEST} annotate "screego/server:unstable" "screego/server:armv7-unstable" --os=linux --arch=arm --variant=v7
|
||||
${DOCKER_MANIFEST} annotate "screego/server:${VERSION}" "screego/server:armv7-${VERSION}" --os=linux --arch=arm --variant=v7
|
||||
${DOCKER_MANIFEST} annotate "screego/server:unstable" "screego/server:arm64-unstable" --os=linux --arch=arm64
|
||||
${DOCKER_MANIFEST} annotate "screego/server:${VERSION}" "screego/server:arm64-${VERSION}" --os=linux --arch=arm64
|
||||
${DOCKER_MANIFEST} annotate "screego/server:unstable" "screego/server:ppc64le-unstable" --os=linux --arch=ppc64le
|
||||
${DOCKER_MANIFEST} annotate "screego/server:${VERSION}" "screego/server:ppc64le-${VERSION}" --os=linux --arch=ppc64le
|
||||
|
||||
|
||||
docker-manifest-push:
|
||||
${DOCKER_MANIFEST} push "screego/server:${VERSION}"
|
||||
${DOCKER_MANIFEST} push "screego/server:unstable"
|
||||
|
||||
Reference in New Issue
Block a user