diff --git a/.forgejo/workflows/act.yml b/.forgejo/workflows/act.yml deleted file mode 100644 index 1a1b149b..00000000 --- a/.forgejo/workflows/act.yml +++ /dev/null @@ -1,80 +0,0 @@ -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 - if: vars.ROLE == 'forgejo-coding' - 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 ./act/container - go test ./act/artifactcache/... ./act/workflowpattern/... ./act/filecollector/... ./act/common/... ./act/jobparser ./act/model ./act/exprparser ./act/schema - - integration: - runs-on: lxc-bookworm - if: vars.ROLE == 'forgejo-coding' - 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 ./act/container - go test -timeout 30m ./act/runner/... diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml index 06132260..3e1466bf 100644 --- a/.forgejo/workflows/test.yml +++ b/.forgejo/workflows/test.yml @@ -40,9 +40,9 @@ jobs: - '/usr/bin/s6-svscan /etc/s6 & sleep 10 ; su -c "forgejo admin user create --admin --username $FORGEJO_ADMIN_USER --password $FORGEJO_ADMIN_PASSWORD --email root@example.com" git && su -c "forgejo forgejo-cli actions register --labels docker --name therunner --secret $FORGEJO_RUNNER_SECRET" git && sleep infinity' steps: - - uses: actions/checkout@v4 + - uses: https://data.forgejo.org/actions/checkout@v4 - - uses: actions/setup-go@v5 + - uses: https://data.forgejo.org/actions/setup-go@v5 with: go-version-file: go.mod @@ -74,11 +74,10 @@ jobs: - run: make FORGEJO_URL=http://$FORGEJO_HOST_PORT test runner-exec-tests: - needs: [build-and-tests] name: runner exec tests if: vars.ROLE == 'forgejo-coding' runs-on: lxc-bookworm - + needs: [build-and-tests] steps: - uses: actions/checkout@v4 @@ -128,9 +127,29 @@ jobs: ./forgejo-runner exec --var MY_VAR=testvariable --workflows .forgejo/testdata/var.yml |& tee /tmp/var.out grep --quiet 'Success - Main echo "VAR -> testvariable"' /tmp/var.out + integration-tests: + name: integration tests + if: vars.ROLE == 'forgejo-coding' + runs-on: lxc-bookworm + steps: + - uses: https://data.forgejo.org/actions/checkout@v4 + + - uses: https://data.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 ./act/container + go test -timeout 30m ./act/runner/... + validate-mocks: - needs: - - build-and-tests name: validate mocks if: vars.ROLE == 'forgejo-coding' runs-on: docker @@ -138,13 +157,12 @@ jobs: image: 'code.forgejo.org/oci/ci:1' steps: - - uses: actions/checkout@v4 + - uses: https://data.forgejo.org/actions/checkout@v4 - - uses: actions/setup-go@v5 + - uses: https://data.forgejo.org/actions/setup-go@v5 with: go-version-file: go.mod - - name: generate mocks run: | set -ex diff --git a/Makefile b/Makefile index 3d751aa1..1d2c8565 100644 --- a/Makefile +++ b/Makefile @@ -106,7 +106,9 @@ fmt-check: fi; test: lint-check fmt-check - @$(GO) test -v -cover -coverprofile coverage.txt ./internal/... && echo "\n==>\033[32m Ok\033[m\n" || exit 1 + $(GO) test -v -cover -coverprofile coverage.txt ./internal/... + $(GO) test -short ./act/container + $(GO) test ./act/artifactcache/... ./act/workflowpattern/... ./act/filecollector/... ./act/common/... ./act/jobparser ./act/model ./act/exprparser ./act/schema .PHONY: vet vet: