From a1e5406df99b8159a874273f3b7cdaf7b7e5b5ea Mon Sep 17 00:00:00 2001 From: Aleksey Kravchenko Date: Mon, 23 Dec 2024 09:49:39 +0300 Subject: [PATCH] [#2] Add forgejo CI jobs Signed-off-by: Aleksey Kravchenko --- .forgejo/ISSUE_TEMPLATE/bug_report.md | 45 +++++++++++++++++++ .forgejo/ISSUE_TEMPLATE/config.yml | 1 + .forgejo/ISSUE_TEMPLATE/feature_request.md | 20 +++++++++ .forgejo/workflows/builds.yaml | 24 +++++++++++ .forgejo/workflows/dco.yml | 20 +++++++++ .forgejo/workflows/tests.yml | 50 ++++++++++++++++++++++ internal/backend/frostfs/frostfs.go | 6 +-- internal/backend/frostfs/frostfs_test.go | 9 ++-- 8 files changed, 169 insertions(+), 6 deletions(-) create mode 100644 .forgejo/ISSUE_TEMPLATE/bug_report.md create mode 100644 .forgejo/ISSUE_TEMPLATE/config.yml create mode 100644 .forgejo/ISSUE_TEMPLATE/feature_request.md create mode 100644 .forgejo/workflows/builds.yaml create mode 100644 .forgejo/workflows/dco.yml create mode 100644 .forgejo/workflows/tests.yml diff --git a/.forgejo/ISSUE_TEMPLATE/bug_report.md b/.forgejo/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..7e778d2fe --- /dev/null +++ b/.forgejo/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,45 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: community, triage, bug +assignees: '' + +--- + + + +## Expected Behavior + + + +## Current Behavior + + + +## Possible Solution + + + + + + +## Steps to Reproduce (for bugs) + + + +1. + +## Context + + + +## Regression + + + +## Your Environment + +* Version used: +* Server setup and configuration: +* Operating System and version (`uname -a`): diff --git a/.forgejo/ISSUE_TEMPLATE/config.yml b/.forgejo/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..3ba13e0ce --- /dev/null +++ b/.forgejo/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.forgejo/ISSUE_TEMPLATE/feature_request.md b/.forgejo/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..d6d1162a1 --- /dev/null +++ b/.forgejo/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: community, triage +assignees: '' + +--- + +## Is your feature request related to a problem? Please describe. + + +## Describe the solution you'd like + + +## Describe alternatives you've considered + + +## Additional context + diff --git a/.forgejo/workflows/builds.yaml b/.forgejo/workflows/builds.yaml new file mode 100644 index 000000000..d588a7fa6 --- /dev/null +++ b/.forgejo/workflows/builds.yaml @@ -0,0 +1,24 @@ +on: + pull_request: + push: + branches: + - tcl/master + +jobs: + builds: + name: Builds + runs-on: ubuntu-latest + strategy: + matrix: + go_versions: [ '1.22', '1.23' ] + fail-fast: false + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '${{ matrix.go_versions }}' + + - name: Build binary + run: make \ No newline at end of file diff --git a/.forgejo/workflows/dco.yml b/.forgejo/workflows/dco.yml new file mode 100644 index 000000000..4acd63341 --- /dev/null +++ b/.forgejo/workflows/dco.yml @@ -0,0 +1,20 @@ +on: [pull_request] + +jobs: + dco: + name: DCO + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: '1.23' + + - name: Run commit format checker + uses: https://git.frostfs.info/TrueCloudLab/dco-go@v3 + with: + from: 'origin/${{ github.event.pull_request.base.ref }}' diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml new file mode 100644 index 000000000..ffdc44e0a --- /dev/null +++ b/.forgejo/workflows/tests.yml @@ -0,0 +1,50 @@ +on: + pull_request: + push: + branches: + - tcl/master + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '1.23' + cache: true + + - name: Install linters + run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest + + - name: Run linters + # we run the linter only through the FrostFS backend code + run: golangci-lint --timeout=5m run internal/backend/frostfs/ + + tests: + name: Tests + runs-on: oci-runner + strategy: + matrix: + go_versions: [ '1.23' ] + fail-fast: false + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '${{ matrix.go_versions }}' + + - name: Tests for the FrostFS backend + env: + RESTIC_TEST_FUSE: false + + # run only tests for the FrostFS backend + run: |- + podman-service.sh + podman info + go test -v github.com/restic/restic/internal/backend/frostfs \ No newline at end of file diff --git a/internal/backend/frostfs/frostfs.go b/internal/backend/frostfs/frostfs.go index fbe7ad909..9d9b9919b 100644 --- a/internal/backend/frostfs/frostfs.go +++ b/internal/backend/frostfs/frostfs.go @@ -45,11 +45,11 @@ func NewFactory() location.Factory { return location.NewHTTPBackendFactory("frostfs", ParseConfig, location.NoPassword, Create, Open) } -func Open(ctx context.Context, cfg Config, rt http.RoundTripper) (backend.Backend, error) { +func Open(ctx context.Context, cfg Config, _ http.RoundTripper) (backend.Backend, error) { return open(ctx, cfg) } -func Create(ctx context.Context, cfg Config, rt http.RoundTripper) (backend.Backend, error) { +func Create(ctx context.Context, cfg Config, _ http.RoundTripper) (backend.Backend, error) { return open(ctx, cfg) } @@ -81,7 +81,7 @@ func open(ctx context.Context, cfg Config) (backend.Backend, error) { }, nil } -func (b *Backend) IsPermanentError(err error) bool { +func (b *Backend) IsPermanentError(_ error) bool { return true } diff --git a/internal/backend/frostfs/frostfs_test.go b/internal/backend/frostfs/frostfs_test.go index 4b6fea27f..77816682e 100644 --- a/internal/backend/frostfs/frostfs_test.go +++ b/internal/backend/frostfs/frostfs_test.go @@ -26,7 +26,10 @@ import ( func TestIntegration(t *testing.T) { filename := createWallet(t) - defer os.Remove(filename) + defer func() { + err := os.Remove(filename) + require.NoError(t, err) + }() rootCtx := context.Background() aioImage := "truecloudlab/frostfs-aio:" @@ -135,7 +138,7 @@ func createContainer(ctx context.Context, client *pool.Pool, owner user.ID, cont wp := &pool.WaitParams{ PollInterval: 5 * time.Second, - Timeout: 30 * time.Second, + Timeout: 2 * time.Minute, } prm := pool.PrmContainerPut{ ClientParams: sdkClient.PrmContainerPut{ @@ -179,7 +182,7 @@ func createWallet(t *testing.T) string { func createDockerContainer(ctx context.Context, t *testing.T, image string) testcontainers.Container { req := testcontainers.ContainerRequest{ Image: image, - WaitingFor: wait.NewLogStrategy("aio container started").WithStartupTimeout(30 * time.Second), + WaitingFor: wait.NewLogStrategy("aio container started").WithStartupTimeout(60 * time.Second), Name: "aio", Hostname: "aio", NetworkMode: "host",