mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-08-26 18:20:59 +00:00
chore: import the ACT test workflow
- remove go vet and build as they are now redundant - replace ./pkg with ./act - rename the workflow from test to act to distinguish it from the runner workflow cleanup and factorization with the runner workflow is left for later
This commit is contained in:
parent
ebc7758c1f
commit
bcddcef2b9
3 changed files with 80 additions and 2 deletions
78
.forgejo/workflows/act.yml
Normal file
78
.forgejo/workflows/act.yml
Normal file
|
@ -0,0 +1,78 @@
|
|||
name: act
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
GOPATH: /go_path
|
||||
GOCACHE: /go_cache
|
||||
|
||||
jobs:
|
||||
unit:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: 'code.forgejo.org/oci/node:22-bookworm'
|
||||
steps:
|
||||
- name: cache go path
|
||||
id: cache-go-path
|
||||
uses: https://code.forgejo.org/actions/cache@v4
|
||||
with:
|
||||
path: /go_path
|
||||
key: go_path-${{ forge.repository }}-${{ forge.ref_name }}
|
||||
restore-keys: |
|
||||
go_path-${{ forge.repository }}-
|
||||
go_path-
|
||||
- name: cache go cache
|
||||
id: cache-go-cache
|
||||
uses: https://code.forgejo.org/actions/cache@v4
|
||||
with:
|
||||
path: /go_cache
|
||||
key: go_cache-${{ forge.repository }}-${{ forge.ref_name }}
|
||||
restore-keys: |
|
||||
go_cache-${{ forge.repository }}-
|
||||
go_cache-
|
||||
|
||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||
|
||||
- uses: https://code.forgejo.org/actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: validate go version
|
||||
run: |
|
||||
set -ex
|
||||
toolchain=$(grep -oP '(?<=toolchain ).+' go.mod)
|
||||
version=$(go version | cut -d' ' -f3)
|
||||
if dpkg --compare-versions ${version#go} lt ${toolchain#go}; then
|
||||
echo "go version too low: $toolchain >= $version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: unit test
|
||||
run: |
|
||||
go test -short -v ./act/container
|
||||
go test -v ./act/artifactcache/... ./act/workflowpattern/... ./act/filecollector/... ./act/common/... ./act/jobparser ./act/model ./act/exprparser ./act/schema
|
||||
|
||||
integration:
|
||||
runs-on: lxc-bookworm
|
||||
needs: [unit]
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||
|
||||
- uses: https://code.forgejo.org/actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: apt install docker.io
|
||||
run: |
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update -qq
|
||||
apt-get -q install -qq -y docker.io
|
||||
|
||||
- name: integration test
|
||||
run: |
|
||||
go test -v ./act/container
|
||||
go test -v ./act/runner/...
|
|
@ -318,7 +318,7 @@ func TestRunContext_GetGitHubContext(t *testing.T) {
|
|||
actor = a
|
||||
}
|
||||
|
||||
repo := "forgejo/act"
|
||||
repo := "forgejo/runner"
|
||||
if r := os.Getenv("ACT_REPOSITORY"); r != "" {
|
||||
repo = r
|
||||
}
|
||||
|
|
|
@ -262,7 +262,7 @@ func TestStepActionLocalPost(t *testing.T) {
|
|||
return strings.HasSuffix(array[1], suffix)
|
||||
})
|
||||
}
|
||||
cm.On("Exec", suffixMatcher("pkg/runner/local/action/post.js"), sal.env, "", "").Return(func(ctx context.Context) error { return tt.err })
|
||||
cm.On("Exec", suffixMatcher("act/runner/local/action/post.js"), sal.env, "", "").Return(func(ctx context.Context) error { return tt.err })
|
||||
|
||||
cm.On("Copy", "/var/run/act", mock.AnythingOfType("[]*container.FileEntry")).Return(func(ctx context.Context) error {
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue