CI: chuyển workflow sang image node-go để bỏ setup Go và giảm thời gian chạy #11

Closed
opened 2026-04-28 00:15:43 +07:00 by codex · 1 comment
Collaborator

Vấn đề

Workflow CI hiện tại trong .gitea/workflows/ci.yml đang dùng actions/setup-go@v5 ở nhiều job. Việc setup Go trong lúc chạy pipeline làm CI chậm hơn cần thiết.

Pipeline này cũng cần Node, nên image Go thuần không phù hợp.

Mục tiêu

Viết lại CI để dùng image có sẵn môi trường Node + Go:

git.thuanle.me/public/node-go

Mục đích:

  • bỏ bước setup Go trong từng job
  • tận dụng image đã có sẵn dependency runtime cần thiết
  • giảm thời gian khởi động và tổng thời gian chạy CI

Phạm vi

  • Cập nhật .gitea/workflows/ci.yml
  • Cho các job cần Go chạy bằng container image git.thuanle.me/public/node-go
  • Loại bỏ actions/setup-go@v5
  • Giữ nguyên các bước kiểm tra hiện có như gofmtgo test ./...

Đề xuất triển khai

Ví dụ hướng cập nhật:

jobs:
  fmt:
    runs-on: linux
    container:
      image: git.thuanle.me/public/node-go
    steps:
      - uses: actions/checkout@v4
      - run: |
          out=$(gofmt -l .)
          if [ -n "$out" ]; then
            echo "Files not formatted:"
            echo "$out"
            exit 1
          fi

  test:
    runs-on: linux
    container:
      image: git.thuanle.me/public/node-go
    steps:
      - uses: actions/checkout@v4
      - run: go test ./...

Acceptance criteria

  • .gitea/workflows/ci.yml không còn dùng actions/setup-go@v5
  • Các job CI cần Go chạy bằng image git.thuanle.me/public/node-go
  • gofmtgo test ./... vẫn chạy bình thường
  • Log pipeline không còn bước cài đặt Go động
  • Thời gian chạy CI giảm so với workflow hiện tại

Lưu ý

  • Image git.thuanle.me/public/node-go cần có sẵn node, go, gofmt
  • Nếu có tag ổn định, nên pin tag cụ thể thay vì dùng floating tag
## Vấn đề Workflow CI hiện tại trong `.gitea/workflows/ci.yml` đang dùng `actions/setup-go@v5` ở nhiều job. Việc setup Go trong lúc chạy pipeline làm CI chậm hơn cần thiết. Pipeline này cũng cần Node, nên image Go thuần không phù hợp. ## Mục tiêu Viết lại CI để dùng image có sẵn môi trường Node + Go: `git.thuanle.me/public/node-go` Mục đích: - bỏ bước setup Go trong từng job - tận dụng image đã có sẵn dependency runtime cần thiết - giảm thời gian khởi động và tổng thời gian chạy CI ## Phạm vi - Cập nhật `.gitea/workflows/ci.yml` - Cho các job cần Go chạy bằng container image `git.thuanle.me/public/node-go` - Loại bỏ `actions/setup-go@v5` - Giữ nguyên các bước kiểm tra hiện có như `gofmt` và `go test ./...` ## Đề xuất triển khai Ví dụ hướng cập nhật: ```yaml jobs: fmt: runs-on: linux container: image: git.thuanle.me/public/node-go steps: - uses: actions/checkout@v4 - run: | out=$(gofmt -l .) if [ -n "$out" ]; then echo "Files not formatted:" echo "$out" exit 1 fi test: runs-on: linux container: image: git.thuanle.me/public/node-go steps: - uses: actions/checkout@v4 - run: go test ./... ``` ## Acceptance criteria - `.gitea/workflows/ci.yml` không còn dùng `actions/setup-go@v5` - Các job CI cần Go chạy bằng image `git.thuanle.me/public/node-go` - `gofmt` và `go test ./...` vẫn chạy bình thường - Log pipeline không còn bước cài đặt Go động - Thời gian chạy CI giảm so với workflow hiện tại ## Lưu ý - Image `git.thuanle.me/public/node-go` cần có sẵn `node`, `go`, `gofmt` - Nếu có tag ổn định, nên pin tag cụ thể thay vì dùng floating tag
Collaborator

Implementation Plan

Changes

Update .gitea/workflows/ci.yml:

  1. fmt job — add container: image: git.thuanle.me/public/node-go, remove actions/setup-go@v5 step
  2. test job — add container: image: git.thuanle.me/public/node-go, remove actions/setup-go@v5 step
  3. Keep all existing checkout and run steps unchanged

Acceptance Checks

  • No actions/setup-go@v5 in CI file
  • Both jobs use container: image: git.thuanle.me/public/node-go
  • gofmt and go test ./... steps preserved
  • Pipeline runs green

Branch: feat/issue-11-ci-node-go-image

## Implementation Plan ### Changes Update `.gitea/workflows/ci.yml`: 1. **`fmt` job** — add `container: image: git.thuanle.me/public/node-go`, remove `actions/setup-go@v5` step 2. **`test` job** — add `container: image: git.thuanle.me/public/node-go`, remove `actions/setup-go@v5` step 3. Keep all existing checkout and run steps unchanged ### Acceptance Checks - [ ] No `actions/setup-go@v5` in CI file - [ ] Both jobs use `container: image: git.thuanle.me/public/node-go` - [ ] `gofmt` and `go test ./...` steps preserved - [ ] Pipeline runs green Branch: `feat/issue-11-ci-node-go-image`
Sign in to join this conversation.
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: thuanle/claw-email#11