diff --git a/.github/workflows/cron-licenses.yml b/.github/workflows/cron-licenses.yml index 7239078710..54702f4682 100644 --- a/.github/workflows/cron-licenses.yml +++ b/.github/workflows/cron-licenses.yml @@ -1,21 +1,20 @@ -name: "Cron: Update licenses and gitignores" +name: cron-licenses on: schedule: - # weekly on Monday at 0:07 UTC - - cron: "7 0 * * 1" + - cron: "7 0 * * 1" # every Monday at 00:07 UTC jobs: - cron: + cron-licenses: + if: github.repository == "go-gitea/gitea" runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: '>=1.20.1' - - name: update licenses and gitignores - run: timeout -s ABRT 40m make generate-license generate-gitignore + go-version: ">=1.20.1" + - run: make generate-license generate-gitignore + timeout-minutes: 40 - name: push translations to repo uses: appleboy/git-push-action@v0.0.2 with: diff --git a/.github/workflows/lock.yml b/.github/workflows/cron-lock.yml similarity index 80% rename from .github/workflows/lock.yml rename to .github/workflows/cron-lock.yml index 2e132b95fe..e11869058c 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/cron-lock.yml @@ -1,8 +1,8 @@ -name: 'Lock Threads' +name: cron-lock on: schedule: - - cron: '0 0 * * *' # Run once a day + - cron: "0 0 * * *" # every day at 00:00 UTC workflow_dispatch: permissions: diff --git a/.github/workflows/cron-translations.yml b/.github/workflows/cron-translations.yml index c83450d2e6..97e1ff9739 100644 --- a/.github/workflows/cron-translations.yml +++ b/.github/workflows/cron-translations.yml @@ -1,15 +1,14 @@ -name: "Cron: Pull translations from Crowdin" +name: cron-translations on: schedule: - - cron: "7 0 * * *" # every day at 0:07 UTC + - cron: "7 0 * * *" # every day at 00:07 UTC jobs: - crowdin_pull: + crowdin-pull: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - name: download from crowdin uses: docker://jonasfranz/crowdin env: @@ -30,11 +29,10 @@ jobs: commit_message: "[skip ci] Updated translations via Crowdin" remote: "git@github.com:go-gitea/gitea.git" ssh_key: ${{ secrets.DEPLOY_KEY }} - crowdin_push: + crowdin-push: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - name: push translations to crowdin uses: docker://jonasfranz/crowdin env: diff --git a/.github/workflows/push-publish_docs.yml b/.github/workflows/publish-docs.yml similarity index 76% rename from .github/workflows/push-publish_docs.yml rename to .github/workflows/publish-docs.yml index 9037e278ca..de5572a640 100644 --- a/.github/workflows/push-publish_docs.yml +++ b/.github/workflows/publish-docs.yml @@ -1,4 +1,4 @@ -name: "Docs: Publish" +name: publish-docs on: push: @@ -11,12 +11,10 @@ jobs: compliance-docs: runs-on: ubuntu-latest steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup go - uses: actions/setup-go@v4 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: - go-version: '>=1.20.1' + go-version: ">=1.20.1" - name: build docs run: | cd docs diff --git a/.github/workflows/pull-compliance-docs.yml b/.github/workflows/pull-compliance-docs.yml new file mode 100644 index 0000000000..44db6d67af --- /dev/null +++ b/.github/workflows/pull-compliance-docs.yml @@ -0,0 +1,22 @@ +name: compliance-docs + +on: + pull_request: + paths: + - "docs/**" + - "*.md" + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + compliance-docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 20 + - run: make deps-frontend + - run: make lint-md diff --git a/.github/workflows/pull-compliance.yml b/.github/workflows/pull-compliance.yml index 155d9298e9..88342e67d6 100644 --- a/.github/workflows/pull-compliance.yml +++ b/.github/workflows/pull-compliance.yml @@ -1,4 +1,4 @@ -name: "Pull: Compliance Tests" +name: compliance on: [pull_request] @@ -7,136 +7,93 @@ concurrency: cancel-in-progress: true jobs: - lint_basic: + lint-backend: runs-on: ubuntu-latest steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup go - uses: actions/setup-go@v4 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: - go-version: '>=1.20' + go-version: ">=1.20" check-latest: true - - name: deps-backend - run: make deps-backend deps-tools - - name: lint backend - run: make lint-backend + - run: make deps-backend deps-tools + - run: make lint-backend env: - GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not - GOSUMDB: sum.golang.org TAGS: bindata sqlite sqlite_unlock_notify - lint_windows: + lint-go-windows: runs-on: ubuntu-latest steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup go - uses: actions/setup-go@v4 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: - go-version: '>=1.20' + go-version: ">=1.20" check-latest: true - - name: deps-backend - run: make deps-backend deps-tools - - name: lint-backend-windows - run: make lint-go-windows lint-go-vet + - run: make deps-backend deps-tools + - run: make lint-go-windows lint-go-vet env: - GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not - GOSUMDB: sum.golang.org TAGS: bindata sqlite sqlite_unlock_notify GOOS: windows GOARCH: amd64 - lint_gogit: + lint-go-gogit: runs-on: ubuntu-latest steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup go - uses: actions/setup-go@v4 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: - go-version: '>=1.20' + go-version: ">=1.20" check-latest: true - - name: deps-backend - run: make deps-backend deps-tools - - name: lint-backend-gogit - run: make lint-backend + - run: make deps-backend deps-tools + - run: make lint-go env: - GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not - GOSUMDB: sum.golang.org TAGS: bindata gogit sqlite sqlite_unlock_notify - - name: checks backend - run: make --always-make checks-backend # ensure the 'go-licenses' make target runs - check_backend: + checks-backend: runs-on: ubuntu-latest steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup go - uses: actions/setup-go@v4 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: - go-version: '>=1.20' + go-version: ">=1.20" check-latest: true - - name: deps-backend - run: make deps-backend deps-tools - - name: checks backend - run: make --always-make checks-backend # ensure the 'go-licenses' make target runs + - run: make deps-backend deps-tools + - run: make --always-make checks-backend # ensure the "go-licenses" make target runs frontend: runs-on: ubuntu-latest steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup node - uses: actions/setup-node@v3 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: node-version: 20 - - name: deps-frontend - run: make deps-frontend - - name: lint frontend - run: make lint-frontend - - name: checks frontend - run: make checks-frontend - - name: test frontend - run: make test-frontend + - run: make deps-frontend + - run: make lint-frontend + - run: make checks-frontend backend: runs-on: ubuntu-latest steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup go - uses: actions/setup-go@v4 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: - go-version: '>=1.20' + go-version: ">=1.20" check-latest: true - - name: setup node - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3 with: node-version: 20 - - name: deps-backend - run: make deps-backend deps-tools - - name: deps-frontend - run: make deps-frontend - - name: build frontend - run: make frontend - - name: build-backend-no-gcc - run: go build -o gitea_no_gcc # test if build succeeds without the sqlite tag - env: - GOPROXY: https://goproxy.io + - run: make deps-backend deps-tools + - run: make deps-frontend + - run: make frontend + - run: go build -o gitea_no_gcc # test if build succeeds without the sqlite tag - name: build-backend-arm64 run: make backend # test cross compile env: - GOPROXY: https://goproxy.io GOOS: linux GOARCH: arm64 TAGS: bindata gogit - name: build-backend-windows run: go build -o gitea_windows env: - GOPROXY: https://goproxy.io GOOS: windows GOARCH: amd64 TAGS: bindata gogit - name: build-backend-386 run: go build -o gitea_linux_386 # test if compatible with 32 bit env: - GOPROXY: https://goproxy.io GOOS: linux GOARCH: 386 diff --git a/.github/workflows/pull-compliance_docs.yml b/.github/workflows/pull-compliance_docs.yml deleted file mode 100644 index c033b62711..0000000000 --- a/.github/workflows/pull-compliance_docs.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: "Pull: Compliance testing for documentation" - -on: - pull_request: - paths: - - "docs/**" - - "*.md" - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - compliance-docs: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup node - uses: actions/setup-node@v3 - with: - node-version: 20 - - name: install dependencies - run: make deps-frontend - - name: lint markdown - run: make lint-md diff --git a/.github/workflows/pull-db_test.yml b/.github/workflows/pull-db-tests.yml similarity index 60% rename from .github/workflows/pull-db_test.yml rename to .github/workflows/pull-db-tests.yml index 243499b611..4011b4201b 100644 --- a/.github/workflows/pull-db_test.yml +++ b/.github/workflows/pull-db-tests.yml @@ -1,4 +1,4 @@ -name: "Pull: Database Tests" +name: db-tests on: [pull_request] @@ -7,8 +7,7 @@ concurrency: cancel-in-progress: true jobs: - # PostgreSQL Tests - db_pgsql_test: + test-pgsql: runs-on: ubuntu-latest services: pgsql: @@ -33,61 +32,45 @@ jobs: ports: - "9000:9000" steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup go - uses: actions/setup-go@v4 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: - go-version: '>=1.20.0' + go-version: ">=1.20.0" - name: Add hosts to /etc/hosts run: echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts - - name: install dependencies - run: make deps-backend - - name: build - run: make backend + - run: make deps-backend + - run: make backend env: - GOPROXY: https://goproxy.io - GOSUMDB: sum.golang.org TAGS: bindata - - name: run tests - run: timeout -s ABRT 50m make test-pgsql-migration test-pgsql + - run: make test-pgsql-migration test-pgsql + timeout-minutes: 50 env: - GOPROXY: https://goproxy.io TAGS: bindata gogit RACE_ENABLED: true TEST_TAGS: gogit TEST_LDAP: 1 USE_REPO_TEST_DIR: 1 - # SQLite Tests - db_sqlite_test: + test-sqlite: runs-on: ubuntu-latest steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup go - uses: actions/setup-go@v4 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: - go-version: '>=1.20.0' - - name: install dependencies - run: make deps-backend - - name: build - run: make backend + go-version: ">=1.20.0" + - run: make deps-backend + - run: make backend env: - GOPROXY: https://goproxy.io - GOSUMDB: sum.golang.org TAGS: bindata gogit sqlite sqlite_unlock_notify - - name: run tests - run: timeout -s ABRT 50m make test-sqlite-migration test-sqlite + - run: make test-sqlite-migration test-sqlite + timeout-minutes: 50 env: - GOPROXY: https://goproxy.io TAGS: bindata gogit sqlite sqlite_unlock_notify RACE_ENABLED: true TEST_TAGS: gogit sqlite sqlite_unlock_notify USE_REPO_TEST_DIR: 1 - # Unit Tests - db_unit_tests: + test-unit: runs-on: ubuntu-latest services: mysql: @@ -112,8 +95,7 @@ jobs: - "993:993" redis: image: redis - # Set health checks to wait until redis has started - options: >- + options: >- # wait until redis has started --health-cmd "redis-cli ping" --health-interval 5s --health-timeout 3s @@ -121,39 +103,30 @@ jobs: ports: - 6379:6379 steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup go - uses: actions/setup-go@v4 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: - go-version: '>=1.20.0' + go-version: ">=1.20.0" - name: Add hosts to /etc/hosts run: echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts - - name: install dependencies - run: make deps-backend - - name: build - run: make backend + - run: make deps-backend + - run: make backend env: - GOPROXY: https://goproxy.io - GOSUMDB: sum.golang.org TAGS: bindata - - name: unit tests + - name: unit-tests run: make unit-test-coverage test-check env: - GOPROXY: https://goproxy.io TAGS: bindata RACE_ENABLED: true GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }} - - name: unit tests (gogit) + - name: unit-tests-gogit run: make unit-test-coverage test-check env: - GOPROXY: https://goproxy.io TAGS: bindata gogit RACE_ENABLED: true GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }} - # MySQL Tests - db_mysql_test: + test-mysql5: runs-on: ubuntu-latest services: mysql: @@ -177,33 +150,25 @@ jobs: - "587:587" - "993:993" steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup go - uses: actions/setup-go@v4 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: - go-version: '>=1.20.0' + go-version: ">=1.20.0" - name: Add hosts to /etc/hosts run: echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts - - name: install dependencies - run: make deps-backend - - name: build - run: make backend + - run: make deps-backend + - run: make backend env: - GOPROXY: https://goproxy.io - GOSUMDB: sum.golang.org TAGS: bindata - name: run tests run: make test-mysql-migration integration-test-coverage env: - GOPROXY: https://goproxy.io TAGS: bindata RACE_ENABLED: true USE_REPO_TEST_DIR: 1 TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200" - # MySQL8 Tests - db_mysql8_test: + test-mysql8: runs-on: ubuntu-latest services: mysql8: @@ -214,31 +179,23 @@ jobs: ports: - "3306:3306" steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup go - uses: actions/setup-go@v4 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: - go-version: '>=1.20.0' + go-version: ">=1.20.0" - name: Add hosts to /etc/hosts run: echo "127.0.0.1 mysql8" | sudo tee -a /etc/hosts - - name: install dependencies - run: make deps-backend - - name: build - run: make backend + - run: make deps-backend + - run: make backend env: - GOPROXY: https://goproxy.io - GOSUMDB: sum.golang.org TAGS: bindata - - name: run tests - run: timeout -s ABRT 50m make test-mysql8-migration test-mysql8 + - run: make test-mysql8-migration test-mysql8 + timeout-minutes: 50 env: - GOPROXY: https://goproxy.io TAGS: bindata USE_REPO_TEST_DIR: 1 - # MSSQL Tests - db_mssql_test: + test-mssql: runs-on: ubuntu-latest services: mssql: @@ -250,25 +207,18 @@ jobs: ports: - "1433:1433" steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup go - uses: actions/setup-go@v4 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: - go-version: '>=1.20.0' + go-version: ">=1.20.0" - name: Add hosts to /etc/hosts run: echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts - - name: install dependencies - run: make deps-backend - - name: build - run: make backend + - run: make deps-backend + - run: make backend env: - GOPROXY: https://goproxy.io - GOSUMDB: sum.golang.org TAGS: bindata - - name: run tests - run: timeout -s ABRT 50m make test-mssql-migration test-mssql + - run: make test-mssql-migration test-mssql + timeout-minutes: 50 env: - GOPROXY: https://goproxy.io TAGS: bindata USE_REPO_TEST_DIR: 1 diff --git a/.github/workflows/pull-docker-dryrun.yml b/.github/workflows/pull-docker-dryrun.yml new file mode 100644 index 0000000000..3d2207940f --- /dev/null +++ b/.github/workflows/pull-docker-dryrun.yml @@ -0,0 +1,17 @@ +name: docker-dryrun + +on: [pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + docker-dryrun: + runs-on: ubuntu-latest + steps: + - uses: docker/setup-buildx-action@v2 + - uses: docker/build-push-action@v4 + with: + push: false + tags: gitea/gitea:linux-amd64 diff --git a/.github/workflows/pull-docker_dryrun.yml b/.github/workflows/pull-docker_dryrun.yml deleted file mode 100644 index f17d6014b6..0000000000 --- a/.github/workflows/pull-docker_dryrun.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: "Pull: Docker Dry Run" - -on: [pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - docker_dryrun: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Build and push - uses: docker/build-push-action@v4 - with: - push: false - tags: gitea/gitea:linux-amd64 - build-args: | - GOPROXY=https://goproxy.io diff --git a/.github/workflows/pull-e2e-tests.yml b/.github/workflows/pull-e2e-tests.yml new file mode 100644 index 0000000000..a854489e4d --- /dev/null +++ b/.github/workflows/pull-e2e-tests.yml @@ -0,0 +1,26 @@ +name: e2e-tests + +on: [pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + test-e2e: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: ">=1.20" + check-latest: true + - uses: actions/setup-node@v3 + with: + node-version: 20 + - run: make deps-frontend frontend deps-backend + - run: npx playwright install --with-deps + - run: make test-e2e-sqlite + timeout-minutes: 40 + env: + USE_REPO_TEST_DIR: 1 diff --git a/.github/workflows/pull-e2e.yml b/.github/workflows/pull-e2e.yml deleted file mode 100644 index 79c5417508..0000000000 --- a/.github/workflows/pull-e2e.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: "Pull: E2E Tests" - -on: [pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - e2e_tests: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup go - uses: actions/setup-go@v4 - with: - go-version: '>=1.20' - check-latest: true - - name: setup node - uses: actions/setup-node@v3 - with: - node-version: 20 - - name: build - run: make deps-frontend frontend deps-backend - - name: Install playwright browsers - run: npx playwright install --with-deps - - name: run tests - run: timeout -s ABRT 40m make test-e2e-sqlite - env: - GOPROXY: https://goproxy.io - GOSUMDB: sum.golang.org - USE_REPO_TEST_DIR: 1 diff --git a/Makefile b/Makefile index 6a03875b79..3d777505a5 100644 --- a/Makefile +++ b/Makefile @@ -394,7 +394,7 @@ lint-go: lint-go-fix: $(GO) run $(GOLANGCI_LINT_PACKAGE) run --fix -# workaround step for the lint-backend-windows CI task because 'go run' can not +# workaround step for the lint-go-windows CI task because 'go run' can not # have distinct GOOS/GOARCH for its build and run steps .PHONY: lint-go-windows lint-go-windows: @@ -409,7 +409,7 @@ lint-go-vet: .PHONY: lint-editorconfig lint-editorconfig: - $(GO) run $(EDITORCONFIG_CHECKER_PACKAGE) templates + $(GO) run $(EDITORCONFIG_CHECKER_PACKAGE) templates .github/workflows .PHONY: watch watch: