Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,55 @@ jobs:
- name: Test
run: go test -v -race ./...

- name: Test TinyGo GitLab fallback
run: go test -tags=tinygo ./gitlab

- name: Build WebAssembly
if: runner.os == 'Linux'
run: GOOS=js GOARCH=wasm go build ./...

- name: Build WASI
if: runner.os == 'Linux'
run: GOOS=wasip1 GOARCH=wasm go build ./...

tinygo:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod

- name: Set up Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '24'
package-manager-cache: false

- name: Install TinyGo and Wasmtime
working-directory: ${{ runner.temp }}
run: |
curl --fail --location --silent --show-error --output tinygo.tar.gz https://github.com/tinygo-org/tinygo/releases/download/v0.42.0/tinygo0.42.0.linux-amd64.tar.gz
echo 'b87688fa2e19cee7d813cad7fd7dadb71dff3198e47125aba66ba4af5e490438 tinygo.tar.gz' | sha256sum --check
tar -xzf tinygo.tar.gz
echo "$RUNNER_TEMP/tinygo/bin" >> "$GITHUB_PATH"
curl --fail --location --silent --show-error --output wasmtime.tar.xz https://github.com/bytecodealliance/wasmtime/releases/download/v44.0.1/wasmtime-v44.0.1-x86_64-linux.tar.xz
echo 'afd58715f105e3a7f454169daed22168c5736ec5f225fb04c4ac62c54c9508a3 wasmtime.tar.xz' | sha256sum --check
tar -xJf wasmtime.tar.xz
echo "$RUNNER_TEMP/wasmtime-v44.0.1-x86_64-linux" >> "$GITHUB_PATH"

- name: Test TinyGo WebAssembly GitLab fallback and URLs
run: tinygo test -target=wasm -run '^(TestTinyGoClientRouting|TestTinyGoServicesReturnUnsupported|TestGitLabPortableURLs)$' -v ./gitlab

- name: Test TinyGo WASI GitLab fallback and URLs
run: tinygo test -target=wasip1 -run '^(TestTinyGoClientRouting|TestTinyGoServicesReturnUnsupported|TestGitLabPortableURLs)$' -v ./gitlab

lint:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ repo, err := client.FetchRepository(ctx, "https://github.com/octocat/hello-world

The `Forge` interface exposes services for repos, issues, pull requests, reviews, releases, CI, branches, labels, milestones, deploy keys, secrets, notifications, files, collaborators, commit statuses and commits. Each backend implements these using its native SDK.

Under TinyGo, `gitlab.New` retains its signature and returns a backend whose API operations report `forges.ErrNotSupported`. GitLab URL parsing and web link builders remain available. Native Go retains the full GitLab implementation.

```go
f, _ := client.ForgeFor("github.com")
issues, _ := f.Issues().List(ctx, "octocat", "hello-world", forges.ListIssueOpts{State: "open"})
Expand Down
2 changes: 2 additions & 0 deletions gitlab/branches.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !tinygo

package gitlab

import (
Expand Down
2 changes: 2 additions & 0 deletions gitlab/ci.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !tinygo

package gitlab

import (
Expand Down
2 changes: 2 additions & 0 deletions gitlab/collaborators.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !tinygo

package gitlab

import (
Expand Down
2 changes: 2 additions & 0 deletions gitlab/collaborators_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !tinygo

package gitlab

import (
Expand Down
2 changes: 2 additions & 0 deletions gitlab/commit_statuses.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !tinygo

package gitlab

import (
Expand Down
2 changes: 2 additions & 0 deletions gitlab/commit_statuses_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !tinygo

package gitlab

import (
Expand Down
2 changes: 2 additions & 0 deletions gitlab/commits.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !tinygo

package gitlab

import (
Expand Down
2 changes: 2 additions & 0 deletions gitlab/commits_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !tinygo

package gitlab

import (
Expand Down
2 changes: 2 additions & 0 deletions gitlab/contributors_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !tinygo

package gitlab

import (
Expand Down
2 changes: 2 additions & 0 deletions gitlab/deploy_keys.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !tinygo

package gitlab

import (
Expand Down
2 changes: 2 additions & 0 deletions gitlab/files.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !tinygo

package gitlab

import (
Expand Down
2 changes: 2 additions & 0 deletions gitlab/files_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !tinygo

package gitlab

import (
Expand Down
2 changes: 2 additions & 0 deletions gitlab/forks_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !tinygo

package gitlab

import (
Expand Down
22 changes: 2 additions & 20 deletions gitlab/gitlab.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !tinygo

package gitlab

import (
Expand Down Expand Up @@ -442,23 +444,3 @@ func (s *gitLabRepoService) Search(ctx context.Context, opts forge.SearchRepoOpt
}
return repos, nil
}

func (s *gitLabRepoService) SettingsURL(repoHTMLURL string) string {
return repoHTMLURL + "/-/settings"
}

func (s *gitLabRepoService) WikiURL(repoHTMLURL string) string {
return repoHTMLURL + "/-/wikis"
}

func (s *gitLabRepoService) ActionsURL(repoHTMLURL string) string {
return repoHTMLURL + "/-/pipelines"
}

func (s *gitLabRepoService) ReleasesURL(repoHTMLURL string) string {
return repoHTMLURL + "/-/releases"
}

func (s *gitLabRepoService) BlobURL(repoHTMLURL, ref, path string) string {
return repoHTMLURL + "/-/blob/" + ref + "/" + path
}
2 changes: 2 additions & 0 deletions gitlab/gitlab_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !tinygo

package gitlab

import (
Expand Down
Loading
Loading