Update On Thu Mar 28 19:29:32 CET 2024

This commit is contained in:
github-action[bot]
2024-03-28 19:29:33 +01:00
parent afcd14d27f
commit 82001bf944
219 changed files with 10007 additions and 5066 deletions

View File

@@ -8,7 +8,18 @@ updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
interval: "weekly"
ignore:
- dependency-name: "github.com/xtaci/smux"
groups:
# Specify a name for the group, which will be used in pull request titles
# and branch names
dependencies:
# Define patterns to include dependencies in the group (based on
# dependency name)
patterns:
- "*" # A wildcard that matches all dependencies in the package
- package-ecosystem: "github-actions"
directory: "/"
schedule:

View File

@@ -16,35 +16,14 @@ env:
REGISTRY_IMAGE: ehco1996/ehco
jobs:
test:
prepare-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
id: go
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: tidy
run: make tidy
- name: lint
run: make lint
- name: test
run: make test
- id: set-matrix
run: |
echo '::set-output name=matrix::{"platform":["amd64","arm64"]}'
build-bin:
runs-on: ubuntu-latest
@@ -55,17 +34,18 @@ jobs:
go-version: "1.21"
id: go
- uses: actions/cache@v3
- name: Check out code into the Go module directory
uses: actions/checkout@v4
# cache golang build
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Check out code into the Go module directory
uses: actions/checkout@v4
${{ runner.os }}-go-${{ hashFiles('go.sum') }}
- name: build
run: |
@@ -77,7 +57,7 @@ jobs:
cp ./build/Dockerfile /tmp/ehco/Dockerfile
- name: Upload binaries
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: binaries
path: /tmp/ehco
@@ -87,15 +67,14 @@ jobs:
build-image:
runs-on: ubuntu-latest
needs:
- prepare-matrix
- build-bin
- test
strategy:
fail-fast: true
matrix:
platform: [amd64, arm64]
matrix: ${{fromJson(needs.prepare-matrix.outputs.matrix)}}
steps:
- name: Download binaries
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: binaries
path: /tmp/ehco
@@ -116,7 +95,7 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build multi-platform image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
id: build
with:
context: /tmp/ehco
@@ -125,15 +104,17 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: digests
name: digests-${{ matrix.platform }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
@@ -141,15 +122,12 @@ jobs:
merge:
runs-on: ubuntu-latest
needs:
- prepare-matrix
- build-image
steps:
- name: Download digests
uses: actions/download-artifact@v3
with:
name: digests
path: /tmp/digests
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
@@ -159,16 +137,36 @@ jobs:
type=sha
type=raw,value=latest
type=ref,event=tag
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# need add more platform when change the matrix
- name: Download digests for amd64
uses: actions/download-artifact@v4
with:
name: digests-amd64
path: /tmp/digests/amd64
- name: Download digests for arm64
uses: actions/download-artifact@v4
with:
name: digests-arm64
path: /tmp/digests/arm64
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
echo "Creating manifest list..."
AMD64_DIGEST=$(ls amd64/)
ARM64_DIGEST=$(ls arm64/)
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
--append ${{ env.REGISTRY_IMAGE }}@sha256:$AMD64_DIGEST \
--append ${{ env.REGISTRY_IMAGE }}@sha256:$ARM64_DIGEST
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

View File

@@ -15,6 +15,7 @@ on:
- "cmd/**"
- "internal/**"
- "pkg/**"
- "go.mod"
jobs:
test:
runs-on: ubuntu-latest
@@ -25,18 +26,18 @@ jobs:
go-version: "1.21"
id: go
- uses: actions/cache@v3
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: tidy
run: make tidy

View File

@@ -1,34 +1,54 @@
name: nightly
name: nightly-release
on:
schedule:
- cron: "0 0 * * *" # nightly At 00:00
# 每天 UTC 时间 00:00 自动触发构建
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
nightly-build-go-bin:
name: nightly-build
create-nightly-release:
runs-on: ubuntu-latest
strategy:
matrix:
goarch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- name: Setup Golang with cache
id: golang-with-cache
uses: magnetikonline/action-golang-cache@v4
- name: Check out code
uses: actions/checkout@v4
with:
go-version-file: go.mod
fetch-depth: 0 # 确保获取所有历史和标签
- uses: wangyoucao577/go-release-action@v1
- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Update 'v0.0.0-nightly' tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# 删除本地和远程的 'v0.0.0-nightly' 标签(如果存在)
git tag -d v0.0.0-nightly || true
git push origin :refs/tags/v0.0.0-nightly || true
# 创建新的 'v0.0.0-nightly' 标签并推送
git tag v0.0.0-nightly
git push origin refs/tags/v0.0.0-nightly
- name: Set up Go
uses: actions/setup-go@v5
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: linux
goarch: ${{ matrix.goarch }}
pre_command: export GODEBUG=http2client=0
build_command: make build-nightly
release_tag: nightly
release_name: nightly
goversion: "1.21.1"
overwrite: true
retry: 3
go-version: "1.21"
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
ref: v0.0.0-nightly
- name: Get dependencies
run: go mod download
- name: GoReleaser Action
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}

View File

@@ -1,44 +1,13 @@
name: release-tag
name: release-go-bin-on-tag
on:
push:
tags:
- "*"
branches:
- test-ci
workflow_dispatch:
jobs:
build-tag-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: set up qemu
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set output
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Build multi-platform image
uses: docker/build-push-action@v4
with:
context: .
tags: "ehco1996/ehco:${{ steps.vars.outputs.tag }}"
push: true
file: build/Dockerfile
platforms: linux/amd64,linux/arm64
go-build:
build-go-bin:
runs-on: ubuntu-latest
steps:
- name: Set up Go
@@ -57,6 +26,6 @@ jobs:
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}