test
Pure Run Build / build (push) Canceled after 2m48s

This commit is contained in:
2026-07-23 15:32:58 +08:00
parent 100e9b4f1a
commit d589182a0e
2 changed files with 41 additions and 9 deletions
+24 -9
View File
@@ -1,17 +1,32 @@
name: Go Build with Cache name: Pure Run Build
on: [push] on: [push]
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: 检出代码 - name: 安装基础工具
uses: actions/checkout@v4 run: |
apt-get update
apt-get install -y git golang-go
- name: 设置 Go 并缓存 - name: 克隆当前仓库
uses: magnetikonline/action-golang-cache@v4 run: |
with: git clone ${{ gitea.server_url }}/${{ gitea.repository }}.git .
go-version-file: go.mod git checkout ${{ gitea.sha }}
- name: 编译 - name: 编译 Go 项目
run: go build -o myapp . run: |
go mod tidy
go build -o myapp .
- name: 运行测试
run: |
go test ./...
- name: 打印完成
run: echo "构建完成 ✅"
- name: 运行应用程序
run: |
./myapp
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
set -e
apt-get update
apt-get install -y golang-go git
git clone "${GITEA_SERVER_URL}/${GITEA_REPOSITORY}.git" /tmp/build
cd /tmp/build
git checkout "${GITEA_SHA}"
go mod tidy
go test ./...
go build -o myapp .
echo "构建完成 ✅"
./myapp