Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate the virtualViews test from Drone to GitHub Actions #3630

Merged
merged 1 commit into from Jan 27, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
60 changes: 1 addition & 59 deletions .drone.star
Expand Up @@ -9,7 +9,7 @@ def makeStep():
"name": "build",
"image": OC_CI_GOLANG,
"commands": [
"make build-revad",
"make revad",
],
}

Expand Down Expand Up @@ -67,66 +67,8 @@ def main(ctx):
# implemented for: ocisIntegrationTests and s3ngIntegrationTests
return [
checkStarlark(),
virtualViews(),
] + ocisIntegrationTests(6) + s3ngIntegrationTests(12)

def virtualViews():
return {
"kind": "pipeline",
"type": "docker",
"name": "virtual-views",
"platform": {
"os": "linux",
"arch": "amd64",
},
"trigger": {
"event": {
"include": [
"pull_request",
"tag",
],
},
},
"steps": [
makeStep(),
{
"name": "revad-services",
"image": OC_CI_GOLANG,
"detach": True,
"commands": [
"cd /drone/src/tests/oc-integration-tests/drone/",
"/drone/src/cmd/revad/revad -c frontend-global.toml &",
"/drone/src/cmd/revad/revad -c gateway.toml &",
"/drone/src/cmd/revad/revad -c storage-home-ocis.toml &",
"/drone/src/cmd/revad/revad -c storage-local-1.toml &",
"/drone/src/cmd/revad/revad -c storage-local-2.toml &",
"/drone/src/cmd/revad/revad -c users.toml",
],
},
cloneApiTestReposStep(),
{
"name": "APIAcceptanceTestsOcisStorage",
"image": OC_CI_PHP,
"commands": [
"cd /drone/src",
"make test-acceptance-api",
],
"environment": {
"PATH_TO_APITESTS": "/drone/src/tmp/testrunner",
"TEST_SERVER_URL": "http://revad-services:20180",
"OCIS_REVA_DATA_ROOT": "/drone/src/tmp/reva/data/",
"DELETE_USER_DATA_CMD": "rm -rf /drone/src/tmp/reva/data/nodes/root/* /drone/src/tmp/reva/data/nodes/*-*-*-* /drone/src/tmp/reva/data/blobs/*",
"STORAGE_DRIVER": "OCIS",
"SKELETON_DIR": "/drone/src/tmp/testing/data/apiSkeleton",
"TEST_REVA": "true",
"REGULAR_USER_PASSWORD": "relativity",
"SEND_SCENARIO_LINE_REFERENCES": "true",
"BEHAT_SUITE": "apiVirtualViews",
},
},
],
}

def ocisIntegrationTests(parallelRuns, skipExceptParts = []):
pipelines = []
debugPartsEnabled = (len(skipExceptParts) != 0)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Expand Up @@ -24,6 +24,6 @@ jobs:
with:
go-version-file: go.mod
- name: Check changelog
run: make check-changelog
run: make check-changelog
env:
PR: ${{ github.event.pull_request.number }}
28 changes: 20 additions & 8 deletions .github/workflows/test.yml
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:

jobs:
integration-test:
integration:
runs-on: self-hosted
steps:
- name: Checkout
Expand All @@ -23,7 +23,7 @@ jobs:
services:
redis:
image: registry.cern.ch/docker.io/webhippie/redis
go-test:
go:
runs-on: self-hosted
steps:
- name: Checkout
Expand All @@ -33,7 +33,7 @@ jobs:
with:
go-version-file: go.mod
- name: Test
run: make test
run: make test-go
env:
COVER_PROFILE: ${{ github.event_name == 'push' && 'coverage.out' || '' }}
- name: Run codacy-coverage-reporter
Expand All @@ -58,22 +58,34 @@ jobs:
file: docker/Dockerfile.revad
tags: revad:test
load: true
litmus:
test:
needs: docker-revad
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
profile: [1, 2, 3]
test: [litmus-1, litmus-2, litmus-3, acceptance-1]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout core
uses: actions/checkout@v3
if: matrix.test == 'acceptance-1'
with:
repository: owncloud/ocis
ref: ${{ vars.OCIS_COMMITID }}
path: tests/ocis
- name: Checkout testing
uses: actions/checkout@v3
if: matrix.test == 'acceptance-1'
with:
repository: owncloud/testing
path: tests/testing
- name: Download image
uses: ishworkh/docker-image-artifact-download@v1
with:
image: revad:test
- name: Test
run: make litmus-only
run: make ${{ matrix.test }} -o test-docker
env:
PROFILE: ${{ matrix.profile }}
IMAGE: revad:test
REVAD_IMAGE: revad:test
6 changes: 6 additions & 0 deletions .gitmodules
@@ -1,3 +1,9 @@
[submodule "docs/themes/docsy"]
path = docs/themes/docsy
url = https://github.com/google/docsy
[submodule "tests/ocis"]
path = tests/ocis
url = https://github.com/owncloud/ocis.git
[submodule "tests/testing"]
path = tests/testing
url = https://github.com/owncloud/testing.git
174 changes: 76 additions & 98 deletions Makefile
@@ -1,145 +1,123 @@
BUILD_DATE = `date +%FT%T%z`
GIT_COMMIT ?= `git rev-parse --short HEAD`
GIT_DIRTY = `git diff-index --quiet HEAD -- || echo "dirty-"`
VERSION ?= `git describe --always`
GO_VERSION ?= `go version | awk '{print $$3}'`
BUILD_FLAGS = "-X main.gitCommit=${GIT_COMMIT} -X main.version=${VERSION} -X main.goVersion=${GO_VERSION} -X main.buildDate=${BUILD_DATE}"

.PHONY: all
all: build-revad build-reva test lint gen-doc

IMAGE ?= revad:test

.PHONY: test-image
test-image:
docker build -t $(IMAGE) -f docker/Dockerfile.revad .

LITMUS ?= $(CURDIR)/tests/litmus
TIMEOUT ?= 3600
all: revad reva test-go lint gen-doc

.PHONY: litmus-only
litmus-only:
ifndef PROFILE
$(error PROFILE is not defined)
else
@cd $(LITMUS) && IMAGE=$(IMAGE) docker-compose --profile $(PROFILE) up --remove-orphans --exit-code-from litmus-$(PROFILE) --abort-on-container-exit --timeout $(TIMEOUT)
endif

.PHONY: litmus
litmus: test-image litmus-only
################################################################################
# Toolchain
################################################################################

TOOLCHAIN ?= $(CURDIR)/toolchain
GOLANGCI_LINT ?= $(TOOLCHAIN)/golangci-lint
CALENS ?= $(TOOLCHAIN)/calens
GOIMPORTS ?= $(TOOLCHAIN)/goimports

.PHONY: toolchain
toolchain: $(GOLANGCI_LINT) $(CALENS) $(GOIMPORTS)

.PHONY: toolchain-clean
toolchain-clean:
rm -rf $(TOOLCHAIN)
toolchain: $(GOLANGCI_LINT) $(CALENS)

$(GOLANGCI_LINT):
@mkdir -p $(@D)
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | BINDIR=$(@D) sh -s v1.50.1

.PHONY: check-changelog
lint: $(GOLANGCI_LINT)
@$(GOLANGCI_LINT) run || (echo "Tip: many lint errors can be automatically fixed with \"make lint-fix\""; exit 1)

.PHONY: lint-fix
lint-fix: $(GOLANGCI_LINT)
gofmt -w .
$(GOLANGCI_LINT) run --fix

$(CALENS):
@mkdir -p $(@D)
git clone --depth 1 --branch v0.2.0 -c advice.detachedHead=false https://github.com/restic/calens.git /tmp/calens
cd /tmp/calens && GOBIN=$(@D) go install
rm -rf /tmp/calens

.PHONY: check-changelog
check-changelog: $(CALENS)
ifndef PR
$(error PR is not defined)
else
$(CALENS) | sed -n '/^Changelog for reva unreleased (UNRELEASED)/,/^Details/p' | \
grep -E '^ \* [[:alpha:]]{3} #$(PR): '
endif

$(GOIMPORTS):
@mkdir -p $(@D)
GOBIN=$(@D) go install golang.org/x/tools/cmd/goimports@v0.3.0

.PHONY: off
off:
GOPROXY=off
echo BUILD_DATE=${BUILD_DATE}
echo GIT_COMMIT=${GIT_COMMIT}
echo GIT_DIRTY=${GIT_DIRTY}
echo VERSION=${VERSION}
echo GO_VERSION=${GO_VERSION}
################################################################################
# Build
################################################################################

.PHONY: imports
imports: off $(GOIMPORTS)
$(GOIMPORTS) -w tools pkg internal cmd
GIT_COMMIT ?= `git rev-parse --short HEAD`
VERSION ?= `git describe --always`
GO_VERSION ?= `go version | awk '{print $$3}'`
BUILD_DATE = `date +%FT%T%z`
BUILD_FLAGS = "-X main.gitCommit=$(GIT_COMMIT) -X main.version=$(VERSION) -X main.goVersion=$(GO_VERSION) -X main.buildDate=$(BUILD_DATE)"

.PHONY: build-cephfs
build-cephfs: build-revad-cephfs build-reva
.PHONY: revad
revad:
go build -ldflags $(BUILD_FLAGS) -o ./cmd/revad/revad ./cmd/revad

.PHONY: tidy
tidy:
go mod tidy
.PHONY: revad-cephfs
revad-cephfs:
go build -ldflags $(BUILD_FLAGS) -tags ceph -o ./cmd/revad/revad ./cmd/revad

.PHONY: build-revad
build-revad: imports
go build -ldflags ${BUILD_FLAGS} -o ./cmd/revad/revad ./cmd/revad
.PHONY: reva
reva:
go build -ldflags $(BUILD_FLAGS) -o ./cmd/reva/reva ./cmd/reva

.PHONY: build-revad-cephfs
build-revad-cephfs: imports
go build -ldflags ${BUILD_FLAGS} -tags ceph -o ./cmd/revad/revad ./cmd/revad
################################################################################
# Test
################################################################################

.PHONY: build-reva
build-reva: imports
go build -ldflags ${BUILD_FLAGS} -o ./cmd/reva/reva ./cmd/reva
REVAD_IMAGE ?= revad:test

# to be run in Docker build
.PHONY: build-revad-docker
build-revad-docker: off
go build -ldflags ${BUILD_FLAGS} -o ./cmd/revad/revad ./cmd/revad
.PHONY: test-docker
test-docker:
docker build -f docker/Dockerfile.revad -t $(REVAD_IMAGE) .

.PHONY: build-revad-cephfs-docker
build-revad-cephfs-docker: off
go build -ldflags ${BUILD_FLAGS} -tags ceph -o ./cmd/revad/revad ./cmd/revad
TESTS = litmus-1 litmus-2 litmus-3 acceptance-1
TIMEOUT ?= 3600

.PHONY: build-reva-docker
build-reva-docker: off
go build -ldflags ${BUILD_FLAGS} -o ./cmd/reva/reva ./cmd/reva
.PHONY: $(TESTS)
$(TESTS): test-docker
docker pull cs3org/behat:latest
REVAD_IMAGE=$(REVAD_IMAGE) \
docker-compose --file tests/docker-compose/$@.yml --project-directory . \
up --force-recreate --renew-anon-volumes --remove-orphans \
--exit-code-from $@ --abort-on-container-exit --timeout $(TIMEOUT)

.PHONY: test
test: off
go test $$([[ -z "${COVER_PROFILE}" ]] && echo "" || echo "-coverprofile=${COVER_PROFILE}") -race $$(go list ./... | grep -v /tests/integration)
.PHONY: test-go
test-go:
go test $$([[ -z "$(COVER_PROFILE)" ]] && echo "" || echo "-coverprofile=$(COVER_PROFILE)") -race $$(go list ./... | grep -v /tests/integration)

.PHONY: test-integration
test-integration: build-revad
test-integration: revad
go test -race ./tests/integration/...

.PHONY: contrib
contrib:
git shortlog -se | cut -c8- | sort -u | awk '{print "-", $$0}' | grep -v 'users.noreply.github.com' > CONTRIBUTORS.md
.PHONY: check-changelog
check-changelog: $(CALENS)
ifndef PR
$(error PR is not defined)
else
$(CALENS) | sed -n '/^Changelog for reva unreleased (UNRELEASED)/,/^Details/p' | \
grep -E '^ \* [[:alpha:]]{3} #$(PR): '
endif

.PHONY: lint
lint: $(GOLANGCI_LINT)
@$(GOLANGCI_LINT) run || (echo "Tip: many lint errors can be automatically fixed with \"make lint-fix\""; exit 1)

.PHONY: lint-fix
lint-fix: $(GOLANGCI_LINT)
gofmt -w .
$(GOLANGCI_LINT) run --fix


################################################################################
# Release
################################################################################

.PHONY: gen-doc
gen-doc:
go run tools/generate-documentation/main.go

dist: gen-doc
go run tools/create-artifacts/main.go -version $(VERSION) -commit $(GIT_COMMIT) -goversion $(GO_VERSION)


################################################################################
# Clean
################################################################################

.PHONY: toolchain-clean
toolchain-clean:
rm -rf $(TOOLCHAIN)

.PHONY: clean
clean: toolchain-clean
rm -rf dist

# create local build versions
dist: gen-doc
go run tools/create-artifacts/main.go -version ${VERSION} -commit ${GIT_COMMIT} -goversion ${GO_VERSION}

test-acceptance-api:
$(PATH_TO_APITESTS)/tests/acceptance/run.sh --type api
3 changes: 3 additions & 0 deletions changelog/unreleased/enhancement-virtualviews.md
@@ -0,0 +1,3 @@
Enhancement: Migrate the virtualViews test from Drone to GitHub Actions

https://github.com/cs3org/reva/pull/3630
2 changes: 1 addition & 1 deletion docker/Dockerfile.reva
Expand Up @@ -31,7 +31,7 @@ ENV GOPATH /go

WORKDIR /go/src/github/cs3org/reva
COPY . .
RUN make build-reva-docker && cp /go/src/github/cs3org/reva/cmd/reva/reva /go/bin/reva
RUN make reva && cp /go/src/github/cs3org/reva/cmd/reva/reva /go/bin/reva

FROM scratch

Expand Down