From cc3f8a52b5faaa93998b9538d2cc1274dae9a78a Mon Sep 17 00:00:00 2001 From: iamxvbaba Date: Thu, 16 Jul 2026 23:12:11 +0800 Subject: [PATCH 1/5] fix(codegen): make schema provenance portable --- .gitattributes | 1 + cmd/gotdgen/schema_workflow.go | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index d17b0d8af6..c903fb750a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,3 +2,4 @@ tg/* linguist-vendored tdapi/* linguist-vendored tl_*_gen.go linguist-vendored *.gen.go linguist-vendored +*.tl text eol=lf diff --git a/cmd/gotdgen/schema_workflow.go b/cmd/gotdgen/schema_workflow.go index a80dc84521..598b119087 100644 --- a/cmd/gotdgen/schema_workflow.go +++ b/cmd/gotdgen/schema_workflow.go @@ -546,14 +546,21 @@ func schemaGitLocation(sourcePath string) (root, relative string, err error) { if err != nil { return "", "", err } - root, err = runGit(filepath.Dir(abs), "rev-parse", "--show-toplevel") + sourceDir := filepath.Dir(abs) + root, err = runGit(sourceDir, "rev-parse", "--show-toplevel") if err != nil { return "", "", err } - relative, err = filepath.Rel(root, abs) + // Ask Git for the repository-relative directory instead of combining + // filepath.Abs and Git's canonical root. Those paths can name the same + // directory differently: macOS resolves /var to /private/var, while Windows + // runners may mix long paths with their 8.3 aliases. Git already owns the + // tracked-path identity needed by the provenance check. + prefix, err := runGit(sourceDir, "rev-parse", "--show-prefix") if err != nil { return "", "", err } + relative = filepath.Clean(filepath.Join(filepath.FromSlash(prefix), filepath.Base(abs))) return root, relative, nil } From df18307771376284ffd7817775616837bd2d8b63 Mon Sep 17 00:00:00 2001 From: iamxvbaba Date: Thu, 16 Jul 2026 23:12:17 +0800 Subject: [PATCH 2/5] ci: align fork actions with maintenance policy --- .github/workflows/ci.yml | 2 +- .github/workflows/coverage.yml | 19 -------- .github/workflows/nightly.yml | 25 ---------- .github/workflows/update-schema.yml | 76 ----------------------------- README.md | 5 ++ 5 files changed, 6 insertions(+), 121 deletions(-) delete mode 100644 .github/workflows/nightly.yml delete mode 100644 .github/workflows/update-schema.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 175461f624..f5aed846b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,4 +61,4 @@ jobs: env: GOARCH: ${{ matrix.arch }} GOFLAGS: ${{ matrix.flags }} - run: go test --timeout 5m ./... + run: go test --timeout 15m ./... diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index eefa27a889..2d9ae45e42 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -28,22 +28,3 @@ jobs: path: profile.out if-no-files-found: error retention-days: 1 - - upload: - runs-on: ubuntu-latest - needs: - - test - steps: - - name: Checkout code - uses: actions/checkout@v7 - - - name: Download artifact - uses: actions/download-artifact@v8 - with: - name: coverage - - - name: Send coverage - uses: codecov/codecov-action@v7 - with: - files: profile.out - fail_ci_if_error: true diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml deleted file mode 100644 index 4cd56c69fa..0000000000 --- a/.github/workflows/nightly.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Nightly -on: - workflow_dispatch: - schedule: - - cron: '36 7 * * *' - -jobs: - telegram: - uses: gotd/td/.github/workflows/update-schema.yml@main - with: - schema-name: "Telegram" - make-command: "download_schema" - secrets: - APP_ID: ${{ secrets.APP_ID }} - APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} - - encrypted: - uses: gotd/td/.github/workflows/update-schema.yml@main - with: - schema-name: "E2E" - branch: "feat/update-e2e-schema" - make-command: "download_e2e_schema" - secrets: - APP_ID: ${{ secrets.APP_ID }} - APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} diff --git a/.github/workflows/update-schema.yml b/.github/workflows/update-schema.yml deleted file mode 100644 index f48f4b8a13..0000000000 --- a/.github/workflows/update-schema.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: update schema - -on: - workflow_call: - secrets: - APP_ID: - required: true - APP_PRIVATE_KEY: - required: true - inputs: - schema-name: - type: string - required: true - make-command: - type: string - required: true - branch: - type: string - default: "feat/update-schema" - required: false - -jobs: - update-schema: - runs-on: ubuntu-latest - steps: - - uses: tibdex/github-app-token@v2 - id: generate-token - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.APP_PRIVATE_KEY }} - - - name: Checkout latest code - uses: actions/checkout@v7 - - - name: Install Go - uses: actions/setup-go@v6 - with: - go-version: stable - cache: false - - - name: Get Go environment - id: go-env - run: | - echo "::set-output name=cache::$(go env GOCACHE)" - echo "::set-output name=modcache::$(go env GOMODCACHE)" - - name: Set up cache - uses: actions/cache@v6 - with: - path: | - ${{ steps.go-env.outputs.cache }} - ${{ steps.go-env.outputs.modcache }} - key: update-schema-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-${{ hashFiles('**/go.mod') }} - restore-keys: | - update-schema-${{ runner.os }}-go- - - - name: Update schema - run: make ${{ inputs.make-command }} - - - name: Generate files - run: make generate - - - name: Create PR - id: cpr - uses: peter-evans/create-pull-request@v8 - with: - author: GitHub - committer: GitHub - commit-message: 'feat(schema): update ${{ inputs.schema-name }} to the latest layer' - branch: ${{ inputs.branch }} - delete-branch: true - token: ${{ steps.generate-token.outputs.token }} - title: Update ${{ inputs.schema-name }} schema to the latest layer - body: | - Update ${{ inputs.schema-name }} schema to the latest layer. - labels: | - dependencies diff --git a/README.md b/README.md index 6f527d51ec..9a4e1a7563 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,11 @@ upstream base becomes the documented baseline only after deterministic generation, fork tests, downstream `telesrv` validation, and publication of a new immutable tag. +Fork CI deliberately has no scheduled schema updater and does not upload to the +upstream Codecov project. Coverage is still generated and retained as a workflow +artifact. Schema updates must use the reviewed local import and policy-audit +workflow; they are never opened automatically by a credentialed GitHub Action. + Telegram MTProto API client in Go for users and bots. [![Telegram: English chat](https://api.go-faster.org/badge/telegram/gotd_en?title=EN&v=1)](https://t.me/gotd_en) [![Telegram: Russian chat](https://api.go-faster.org/badge/telegram/gotd_ru?title=RU&v=1)](https://t.me/gotd_ru) [![Telegram: Chinese chat](https://api.go-faster.org/badge/telegram/gotd_zhcn?title=CN&v=1)](https://t.me/gotd_zhcn) [![Telegram: Online count](https://api.go-faster.org/badge/telegram/online?groups=gotd_ru&groups=gotd_en&groups=gotd_zhcn)](https://t.me/gotd_en) From da5052551afd32d6b4c8d3f06840a05bd7f6266c Mon Sep 17 00:00:00 2001 From: iamxvbaba Date: Thu, 16 Jul 2026 23:28:09 +0800 Subject: [PATCH 3/5] fix(schema): stabilize locked metadata line endings --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index c903fb750a..7165ab32f4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,3 +3,4 @@ tdapi/* linguist-vendored tl_*_gen.go linguist-vendored *.gen.go linguist-vendored *.tl text eol=lf +*.json text eol=lf From f032abf9906c59c8f1c869228d049bd37a165dc0 Mon Sep 17 00:00:00 2001 From: iamxvbaba Date: Thu, 16 Jul 2026 23:45:15 +0800 Subject: [PATCH 4/5] test(calls): detach async logs from test lifetime --- telegram/calls/group_connection_test.go | 6 +++--- telegram/calls/loopback_test.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/telegram/calls/group_connection_test.go b/telegram/calls/group_connection_test.go index 8fe37cab18..0642bfb906 100644 --- a/telegram/calls/group_connection_test.go +++ b/telegram/calls/group_connection_test.go @@ -9,7 +9,7 @@ import ( "github.com/pion/transport/v4/vnet" "github.com/pion/webrtc/v4" "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" + "go.uber.org/zap" "github.com/gotd/log" "github.com/gotd/log/logzap" @@ -35,7 +35,7 @@ func TestGroupConnJoinPayload(t *testing.T) { require.NoError(t, router.Start()) defer func() { _ = router.Stop() }() - g := newGroupConn(log.For(logzap.New(zaptest.NewLogger(t)))) + g := newGroupConn(log.For(logzap.New(zap.NewNop()))) g.net = nw defer func() { _ = g.close() }() @@ -63,7 +63,7 @@ func TestGroupConnJoinPayload(t *testing.T) { } func TestGroupConnFireOnce(t *testing.T) { - g := newGroupConn(log.For(logzap.New(zaptest.NewLogger(t)))) + g := newGroupConn(log.For(logzap.New(zap.NewNop()))) connected := 0 g.onConnected = func() { connected++ } diff --git a/telegram/calls/loopback_test.go b/telegram/calls/loopback_test.go index d35891433a..cf2a127284 100644 --- a/telegram/calls/loopback_test.go +++ b/telegram/calls/loopback_test.go @@ -10,7 +10,7 @@ import ( "github.com/pion/transport/v4/vnet" "github.com/pion/webrtc/v4" "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" + "go.uber.org/zap" "github.com/gotd/log" "github.com/gotd/log/logzap" @@ -40,7 +40,7 @@ func TestConnLoopback(t *testing.T) { require.NoError(t, router.Start()) defer func() { _ = router.Stop() }() - zapLog := zaptest.NewLogger(t) + zapLog := zap.NewNop() caller := newConn(true, log.For(logzap.New(zapLog.Named("caller")))) caller.net = callerNet callee := newConn(false, log.For(logzap.New(zapLog.Named("callee")))) From 7113441db038cd01904e5304b8f4ec1907247180 Mon Sep 17 00:00:00 2001 From: iamxvbaba Date: Thu, 16 Jul 2026 23:59:16 +0800 Subject: [PATCH 5/5] ci: streamline portable test matrix --- .github/workflows/bench.yml | 2 +- .github/workflows/ci.yml | 32 +++++++++++++++++++++----------- .github/workflows/e2e.yml | 2 +- .github/workflows/lint.yml | 8 ++++---- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 6fc09559af..e8c6e4210d 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -22,7 +22,7 @@ jobs: - name: Get Go environment id: go-env - run: echo "::set-output name=modcache::$(go env GOMODCACHE)" + run: echo "modcache=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT" - name: Set up cache uses: actions/cache@v6 with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5aed846b0..e4ff608b7d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,16 +12,25 @@ jobs: strategy: fail-fast: false matrix: - flags: [""] - go: - - "oldstable" - - "stable" - arch: - - amd64 - runner: - - ubuntu-latest - - macos-latest + # Cover supported Go versions on Linux and portability once per + # non-Linux OS. A Cartesian Go x OS matrix only repeats the generated + # model suite and makes a cold macOS build take over an hour. include: + - arch: amd64 + runner: ubuntu-latest + go: "oldstable" + flags: "" + + - arch: amd64 + runner: ubuntu-latest + go: "stable" + flags: "" + + - arch: amd64 + runner: macos-latest + go: "oldstable" + flags: "" + - arch: amd64 runner: windows-latest go: "stable" @@ -44,9 +53,10 @@ jobs: - name: Get Go environment id: go-env + shell: bash run: | - echo "::set-output name=cache::$(go env GOCACHE)" - echo "::set-output name=modcache::$(go env GOMODCACHE)" + echo "cache=$(go env GOCACHE)" >> "$GITHUB_OUTPUT" + echo "modcache=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT" - name: Set up cache uses: actions/cache@v6 with: diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 4a88b42a11..d0c85a4e7c 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -26,7 +26,7 @@ jobs: # That is, we must not cache e2e test results. - name: Get Go environment id: go-env - run: echo "::set-output name=modcache::$(go env GOMODCACHE)" + run: echo "modcache=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT" - name: Set up cache uses: actions/cache@v6 with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2fd1d73680..00e664790a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,8 +22,8 @@ jobs: - name: Get Go environment id: go-env run: | - echo "::set-output name=cache::$(go env GOCACHE)" - echo "::set-output name=modcache::$(go env GOMODCACHE)" + echo "cache=$(go env GOCACHE)" >> "$GITHUB_OUTPUT" + echo "modcache=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT" - name: Set up cache uses: actions/cache@v6 with: @@ -52,8 +52,8 @@ jobs: - name: Get Go environment id: go-env run: | - echo "::set-output name=cache::$(go env GOCACHE)" - echo "::set-output name=modcache::$(go env GOMODCACHE)" + echo "cache=$(go env GOCACHE)" >> "$GITHUB_OUTPUT" + echo "modcache=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT" - name: Set up cache uses: actions/cache@v6 with: