[#2] Add forgejo CI jobs #3

Merged
alexvanin merged 3 commits from KurlesHS/restic:support/add_forgejo_ci into tcl/master 2025-01-29 13:53:33 +00:00
8 changed files with 179 additions and 13 deletions

View file

@ -0,0 +1,45 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: community, triage, bug
assignees: ''
---
<!--- Provide a general summary of the issue in the Title above -->
## Expected Behavior
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->
## Current Behavior
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
## Possible Solution
<!--- Not obligatory -->
<!--- If no reason/fix/additions for the bug can be suggested, -->
<!--- uncomment the following phrase: -->
<!--- No fix can be suggested by a QA engineer. Further solutions shall be up to developers. -->
## Steps to Reproduce (for bugs)
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. -->
1.
## Context
<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
## Regression
<!-- Is this issue a regression? (Yes / No) -->
<!-- If Yes, optionally please include version or commit id or PR# that caused this regression, if you have these details. -->
## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
* Version used:
* Server setup and configuration:
* Operating System and version (`uname -a`):

View file

@ -0,0 +1 @@
blank_issues_enabled: false

View file

@ -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.
<!--- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
## Describe the solution you'd like
<!--- A clear and concise description of what you want to happen. -->
## Describe alternatives you've considered
<!--- A clear and concise description of any alternative solutions or features you've considered. -->
## Additional context
<!--- Add any other context or screenshots about the feature request here. -->

View file

@ -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

View file

@ -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 }}'

View file

@ -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

View file

@ -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
}

View file

@ -15,6 +15,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
dcontainer "github.com/docker/docker/api/types/container"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"github.com/nspcc-dev/neo-go/pkg/wallet"
"github.com/restic/restic/internal/backend"
@ -26,7 +27,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:"
@ -60,11 +64,11 @@ func TestIntegration(t *testing.T) {
_, err = createContainer(ctx, p, owner, cfg.Container, "REP 1")
require.NoError(t, err)
backend, err := Open(ctx, cfg, nil)
fsBackend, err := Open(ctx, cfg, nil)
require.NoError(t, err)
t.Run("simple store load delete "+version, func(t *testing.T) { simpleStoreLoadDelete(ctx, t, backend) })
t.Run("list "+version, func(t *testing.T) { simpleList(ctx, t, backend) })
t.Run("simple store load delete "+version, func(t *testing.T) { simpleStoreLoadDelete(ctx, t, fsBackend) })
t.Run("list "+version, func(t *testing.T) { simpleList(ctx, t, fsBackend) })
err = aioContainer.Terminate(ctx)
require.NoError(t, err)
@ -135,7 +139,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{
@ -178,11 +182,13 @@ 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),
Name: "aio",
Hostname: "aio",
NetworkMode: "host",
Image: image,
WaitingFor: wait.NewLogStrategy("aio container started").WithStartupTimeout(time.Minute),
Name: "aio",
Hostname: "aio",
HostConfigModifier: func(hc *dcontainer.HostConfig) {
hc.NetworkMode = "host"
},
}
aioC, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
ContainerRequest: req,