Skip to content

Commit

Permalink
Migrate the litmusOcisSpacesDav test from Drone to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
vascoguita committed Dec 21, 2022
1 parent 6c1f72f commit a44c37f
Show file tree
Hide file tree
Showing 13 changed files with 177 additions and 132 deletions.
63 changes: 1 addition & 62 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ OC_CI_GOLANG = "owncloudci/golang:1.19"
OC_CI_ALPINE = "owncloudci/alpine:latest"
OSIXIA_OPEN_LDAP = "osixia/openldap:1.3.0"
OC_CI_PHP = "owncloudci/php:7.4"
OC_LITMUS = "owncloud/litmus:latest"
OC_CS3_API_VALIDATOR = "owncloud/cs3api-validator:0.2.0"
OC_CI_BAZEL_BUILDIFIER = "owncloudci/bazel-buildifier:latest"

def makeStep():
return {
"name": "build",
"image": OC_CI_GOLANG,
"commands": [
"make build",
"make build-revad",
],
}

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

Expand Down Expand Up @@ -132,64 +129,6 @@ def virtualViews():
],
}

def litmusOcisSpacesDav():
return {
"kind": "pipeline",
"type": "docker",
"name": "litmus-owncloud-spaces-dav",
"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.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-users-ocis.toml &",
"/drone/src/cmd/revad/revad -c permissions-ocis-ci.toml &",
"/drone/src/cmd/revad/revad -c users.toml",
],
},
{
"name": "sleep-for-revad-start",
"image": OC_CI_GOLANG,
"commands": [
"sleep 5",
],
},
{
"name": "litmus-owncloud-spaces-dav",
"image": OC_LITMUS,
"environment": {
"LITMUS_USERNAME": "einstein",
"LITMUS_PASSWORD": "relativity",
"TESTS": "basic http copymove props",
},
"commands": [
# The spaceid is randomly generated during the first login so we need this hack to construct the correct url.
"curl -s -k -u einstein:relativity -I http://revad-services:20080/remote.php/dav/files/einstein",
"export LITMUS_URL=http://revad-services:20080/remote.php/dav/spaces/123e4567-e89b-12d3-a456-426655440000!$(ls /drone/src/tmp/reva/data/spaces/personal/)",
"/usr/local/bin/litmus-wrapper",
],
},
],
}

def ocisIntegrationTests(parallelRuns, skipExceptParts = []):
pipelines = []
debugPartsEnabled = (len(skipExceptParts) != 0)
Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ jobs:
docker:
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
include:
- tag: ${{ secrets.DOCKERHUB_ORGANIZATION }}/reva:${{ github.ref_name }}
file: Dockerfile.reva
- tag: ${{ secrets.DOCKERHUB_ORGANIZATION }}/revad:${{ github.ref_name }}
file: Dockerfile.revad
- tag: ${{ secrets.DOCKERHUB_ORGANIZATION }}/revad:${{ github.ref_name }}-eos
file: Dockerfile.revad-eos
- tag: ${{ secrets.DOCKERHUB_ORGANIZATION }}/revad:${{ github.ref_name }}-ceph
file: Dockerfile.revad-ceph
- image: reva
tag: reva:${{ github.ref_name }}
- image: revad
tag: revad:${{ github.ref_name }}
- image: revad-eos
tag: revad:${{ github.ref_name }}-eos
- image: revad-ceph
tag: revad:${{ github.ref_name }}-ceph
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand All @@ -46,5 +47,5 @@ jobs:
uses: docker/build-push-action@v3
with:
push: true
file: docker/${{ matrix.file }}
tags: ${{ matrix.tag }}
file: docker/Dockerfile.${{ matrix.image }}
tags: ${{ secrets.DOCKERHUB_ORGANIZATION }}/${{ matrix.tag }}
33 changes: 23 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Test
on: [pull_request, push, workflow_dispatch]

env:
TEST_IMAGE: 'revad:test'
TAG: 'revad:test'

jobs:
test:
integration-test:
runs-on: self-hosted
steps:
- name: Checkout
Expand All @@ -14,18 +14,28 @@ jobs:
uses: actions/setup-go@v3.3.0
with:
go-version-file: go.mod
- name: Test
run: make test
- name: Test integration
run: make test-integration
env:
REDIS_ADDRESS: redis:6379
services:
redis:
image: registry.cern.ch/docker.io/webhippie/redis
go-test:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go environment
uses: actions/setup-go@v3.3.0
with:
go-version-file: go.mod
- name: Test
run: make test
docker:
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
image: [reva, revad, revad-eos, revad-ceph]
steps:
Expand All @@ -38,26 +48,29 @@ jobs:
with:
context: .
file: docker/Dockerfile.${{ matrix.image }}
tags: ${{ env.TEST_IMAGE }}
tags: ${{ env.TAG }}
load: ${{ matrix.image == 'revad' }}
- name: Upload ${{ env.TEST_IMAGE }} to artifacts
- name: Upload ${{ env.TAG }} to artifacts
uses: ishworkh/docker-image-artifact-upload@v1
if: ${{ matrix.image == 'revad' }}
with:
image: ${{ env.TEST_IMAGE }}
image: ${{ env.TAG }}
retention_days: '1'
litmus:
needs: docker
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
test: [litmus-1-only, litmus-2-only]
profile: [1, 2, 3]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download image
uses: ishworkh/docker-image-artifact-download@v1
with:
image: ${{ env.TEST_IMAGE }}
image: ${{ env.TAG }}
- name: Test
run: make ${{ matrix.test }}
run: make litmus-only
env:
PROFILE: ${{ matrix.profile }}
59 changes: 26 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
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}"
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}"

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

TAG ?= revad:test

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

LITMUS ?= $(CURDIR)/tests/litmus
TIMEOUT ?= 3600
URL_PATH ?= /remote.php/webdav
docker build -t $(TAG) -f docker/Dockerfile.revad .

.PHONY: litmus-1-only
litmus-1-only:
@cd $(LITMUS) && URL_PATH=$(URL_PATH) TEST_IMAGE=$(TEST_IMAGE) docker-compose up --remove-orphans --force-recreate --exit-code-from litmus --abort-on-container-exit --timeout $(TIMEOUT)
LITMUS ?= $(CURDIR)/tests/litmus
TIMEOUT ?= 3600

.PHONY: litmus-1
litmus-1: test-image litmus-1-only

.PHONY: litmus-2-only
litmus-2-only: URL_PATH=/remote.php/dav/files/4c510ada-c86b-4815-8820-42cdf82c3d51
litmus-2-only: litmus-1-only
.PHONY: litmus-only
litmus-only:
ifndef PROFILE
$(error PROFILE is not defined)
else
@cd $(LITMUS) && TAG=$(TAG) docker-compose --profile $(PROFILE) up --remove-orphans --exit-code-from litmus-$(PROFILE) --abort-on-container-exit --timeout $(TIMEOUT)
endif

.PHONY: litmus-2
litmus-2: test-image litmus-2-only
.PHONY: litmus
litmus: test-image litmus-only

TOOLCHAIN ?= $(CURDIR)/toolchain
GOLANGCI_LINT ?= $(TOOLCHAIN)/golangci-lint
Expand All @@ -47,7 +46,7 @@ $(GOLANGCI_LINT):

.PHONY: check-changelog
lint: $(GOLANGCI_LINT)
$(GOLANGCI_LINT) run
@$(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)
Expand Down Expand Up @@ -86,9 +85,6 @@ off:
imports: off $(GOIMPORTS)
$(GOIMPORTS) -w tools pkg internal cmd

.PHONY: build
build: build-revad build-reva

.PHONY: build-cephfs
build-cephfs: build-revad-cephfs build-reva

Expand Down Expand Up @@ -123,11 +119,11 @@ build-reva-docker: off

.PHONY: test
test: off
go test -coverprofile coverage.out -race $$(go list ./... | grep -v /tests/integration)
go test -race $$(go list ./... | grep -v /tests/integration)

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

.PHONY: contrib
contrib:
Expand All @@ -141,9 +137,6 @@ gen-doc:
clean: toolchain-clean
rm -rf dist

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

# create local build versions
dist: gen-doc
go run tools/create-artifacts/main.go -version ${VERSION} -commit ${GIT_COMMIT} -goversion ${GO_VERSION}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ You need to have [Go](https://golang.org/doc/install) (version 1.16 or higher),
```
$ git clone https://github.com/cs3org/reva
$ cd reva
$ make build
$ make
$ mkdir -p /etc/revad
$ cp examples/storage-references/users.demo.json /etc/revad/users.json
$ cp examples/storage-references/groups.demo.json /etc/revad/groups.json
Expand Down
3 changes: 2 additions & 1 deletion changelog/unreleased/enhancement-litmus.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Enhancement: Migrate the litmus tests from Drone to GitHub Actions

We've migrated the litmusOcisOldWebdav and the litmusOcisNewWebdav tests from Drone to GitHub Actions.
We've migrated the litmusOcisOldWebdav, litmusOcisSpacesDav and the litmusOcisNewWebdav tests from Drone to GitHub Actions.

https://github.com/cs3org/reva/pull/3566
https://github.com/cs3org/reva/pull/3565
2 changes: 1 addition & 1 deletion docs/content/en/docs/getting-started/build-reva.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ the Go programming language that installs the Go compiler.
```
git clone https://github.com/cs3org/reva
cd reva
make build
make
```
Loading

0 comments on commit a44c37f

Please sign in to comment.