From cbcf82136d305e89ec458ca9a3e5e90f82eead02 Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Thu, 12 Nov 2020 19:50:53 +0100 Subject: [PATCH 1/4] remove root Makefile and get rid of cd in drone ci --- .drone.star | 46 ++++++++++-------------- Makefile | 56 ------------------------------ docs/Makefile | 11 ++++++ store/ocis-boilerplate/.drone.star | 9 ++--- 4 files changed, 34 insertions(+), 88 deletions(-) delete mode 100644 Makefile create mode 100644 docs/Makefile diff --git a/.drone.star b/.drone.star index de8d91f9225..7864f55502a 100644 --- a/.drone.star +++ b/.drone.star @@ -267,8 +267,7 @@ def testing(ctx, module): 'image': 'webhippie/golang:1.14', 'pull': 'always', 'commands': [ - 'cd %s' % (module), - 'make vet', + 'make -C %s vet' % (module), ], 'volumes': [ { @@ -282,8 +281,7 @@ def testing(ctx, module): 'image': 'webhippie/golang:1.14', 'pull': 'always', 'commands': [ - 'cd %s' % (module), - 'make staticcheck', + 'make -C %s staticcheck' % (module), ], 'volumes': [ { @@ -297,8 +295,7 @@ def testing(ctx, module): 'image': 'webhippie/golang:1.14', 'pull': 'always', 'commands': [ - 'cd %s' % (module), - 'make lint', + 'make -C %s lint' % (module), ], 'volumes': [ { @@ -312,9 +309,8 @@ def testing(ctx, module): 'image': 'webhippie/golang:1.14', 'pull': 'always', 'commands': [ - 'cd %s' % (module), - 'make test', - 'mv coverage.out %s_coverage.out' % (module), + 'make -C %s test' % (module), + 'mv %s/coverage.out %s_coverage.out' % (module, module), ], 'volumes': [ { @@ -331,7 +327,7 @@ def testing(ctx, module): 'from_secret': 'cache_s3_endpoint' }, 'bucket': 'cache', - 'source': '%s/%s_coverage.out' % (module, module), + 'source': '%s_coverage.out' % (module), 'target': '%s/%s/coverage' % (ctx.repo.slug, ctx.build.commit + '-${DRONE_BUILD_NUMBER}'), 'path_style': True, 'strip_prefix': module, @@ -466,8 +462,7 @@ def localApiTests(ctx, coreBranch = 'master', coreCommit = '', storage = 'ownclo 'PATH_TO_CORE': '/srv/app/testrunner', }, 'commands': [ - 'cd ocis', - 'make test-acceptance-api', + 'make -C ocis test-acceptance-api', ], 'volumes': [{ 'name': 'gopath', @@ -523,8 +518,7 @@ def coreApiTests(ctx, coreBranch = 'master', coreCommit = '', part_number = 1, n 'EXPECTED_FAILURES_FILE': '/drone/src/ocis/tests/acceptance/expected-failures-on-%s-storage.txt' % (storage.upper()), }, 'commands': [ - 'cd /srv/app/testrunner', - 'make test-acceptance-api', + 'make -C /srv/app/testrunner test-acceptance-api', ], 'volumes': [{ 'name': 'gopath', @@ -923,8 +917,7 @@ def binary(ctx, name): 'image': 'webhippie/golang:1.14', 'pull': 'always', 'commands': [ - 'cd ocis', - 'make release-%s' % (name), + 'make -C ocis release-%s' % (name), ], 'volumes': [ { @@ -938,8 +931,7 @@ def binary(ctx, name): 'image': 'webhippie/golang:1.14', 'pull': 'always', 'commands': [ - 'cd ocis', - 'make release-finish', + 'make -C ocis release-finish', ], 'volumes': [ { @@ -1128,8 +1120,7 @@ def changelog(ctx): 'image': 'webhippie/golang:1.14', 'pull': 'always', 'commands': [ - 'cd ocis', - 'make changelog', + 'make -C ocis changelog', ], }, { @@ -1269,7 +1260,7 @@ def docs(ctx): generateConfigDocs = [] for module in config['modules']: - generateConfigDocs += ['cd /drone/src/%s' % (module), 'make config-docs-generate'] + generateConfigDocs.append('make -C %s config-docs-generate' % (module)) return { 'kind': 'pipeline', @@ -1284,7 +1275,7 @@ def docs(ctx): 'name': 'prepare', 'image': 'owncloudci/alpine:latest', 'commands': [ - 'make docs-copy' + 'make -C docs docs-copy' ], }, { @@ -1302,15 +1293,16 @@ def docs(ctx): 'name': 'test', 'image': 'owncloudci/hugo:0.71.0', 'commands': [ - 'cd hugo', + 'cd docs/hugo', 'hugo', ], }, { - 'name': 'list', + 'name': 'list and remove temporary files', 'image': 'owncloudci/alpine:latest', 'commands': [ 'tree hugo/public', + 'rm -rf docs/hugo', ], }, { @@ -1380,8 +1372,7 @@ def generate(module): 'image': 'webhippie/golang:1.14', 'pull': 'always', 'commands': [ - 'cd %s' % (module), - 'make generate', + 'make -C %s generate' % (module), ], 'volumes': [ { @@ -1592,8 +1583,7 @@ def build(): 'image': 'webhippie/golang:1.14', 'pull': 'always', 'commands': [ - 'cd ocis', - 'make build', + 'make -C ocis build', ], 'volumes': [ { diff --git a/Makefile b/Makefile deleted file mode 100644 index c112427739e..00000000000 --- a/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -SHELL := bash -NAME := ocis -IMPORT := github.com/owncloud/$(NAME) -HUGO := hugo - -.PHONY: all -all: build - -.PHONY: sync -sync: - go mod download - -.PHONY: clean -clean: - rm -rf $(HUGO) - -.PHONY: docs-copy -docs-copy: - mkdir -p $(HUGO); \ - mkdir -p $(HUGO)/content/; \ - cd $(HUGO); \ - git init; \ - git remote rm origin; \ - git remote add origin https://github.com/owncloud/owncloud.github.io; \ - git fetch --depth=1; \ - git checkout origin/source -f; \ - rsync -ax --delete ../docs/ content/; \ - -.PHONY: config-docs-generate -config-docs-generate: - go run github.com/owncloud/flaex >| docs/configuration.md - -.PHONY: docs-build -docs-build: - cd $(HUGO); hugo - -.PHONY: docs -docs: docs-copy docs-build - -BEHAT_BIN=vendor-bin/behat/vendor/bin/behat - -.PHONY: test-acceptance-api -test-acceptance-api: vendor-bin/behat/vendor - BEHAT_BIN=$(BEHAT_BIN) $(PATH_TO_CORE)/tests/acceptance/run.sh --remote --type api - -vendor/bamarni/composer-bin-plugin: composer.lock - composer install - -vendor-bin/behat/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/behat/composer.lock - composer bin behat install --no-progress - -vendor-bin/behat/composer.lock: vendor-bin/behat/composer.json - @echo behat composer.lock is not up to date. - -composer.lock: composer.json - @echo composer.lock is not up to date. diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 00000000000..6475bef925c --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,11 @@ + +.PHONY: docs-copy +docs-copy: + mkdir -p hugo/content/; \ + cd hugo; \ + git init; \ + git remote rm origin; \ + git remote add origin https://github.com/owncloud/owncloud.github.io; \ + git fetch --depth=1; \ + git checkout origin/source -f; \ + rsync -ax --delete --exclude hugo/ --exclude Makefile ../. content/; \ diff --git a/store/ocis-boilerplate/.drone.star b/store/ocis-boilerplate/.drone.star index a204a15edbf..9acb0ce7a80 100644 --- a/store/ocis-boilerplate/.drone.star +++ b/store/ocis-boilerplate/.drone.star @@ -625,22 +625,23 @@ def website(ctx): 'name': 'prepare', 'image': 'owncloudci/alpine:latest', 'commands': [ - 'make docs-copy' + 'make -C docs docs-copy' ], }, { 'name': 'test', 'image': 'webhippie/hugo:latest', 'commands': [ - 'cd hugo', + 'cd docs/hugo', 'hugo', ], }, { - 'name': 'list', + 'name': 'list and remove temporary files', 'image': 'owncloudci/alpine:latest', 'commands': [ - 'tree hugo/public', + 'tree docs/hugo/public', + 'rm -rf docs/hugo', ], }, { From 90e2651e06a30904399e4f9fed05546712aef0fa Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Fri, 13 Nov 2020 10:45:52 +0100 Subject: [PATCH 2/4] remove acceptance tests from storage --- storage/Makefile | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/storage/Makefile b/storage/Makefile index ced3a3b7c6c..c1048bbfab3 100644 --- a/storage/Makefile +++ b/storage/Makefile @@ -139,21 +139,3 @@ config-docs-generate: .PHONY: watch watch: go run github.com/cespare/reflex -c reflex.conf - -BEHAT_BIN=vendor-bin/behat/vendor/bin/behat - -.PHONY: test-acceptance-api -test-acceptance-api: vendor-bin/behat/vendor - BEHAT_BIN=$(BEHAT_BIN) $(PATH_TO_CORE)/tests/acceptance/run.sh --remote --type api - -vendor/bamarni/composer-bin-plugin: composer.lock - composer install - -vendor-bin/behat/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/behat/composer.lock - composer bin behat install --no-progress - -vendor-bin/behat/composer.lock: vendor-bin/behat/composer.json - @echo behat composer.lock is not up to date. - -composer.lock: composer.json - @echo composer.lock is not up to date. From 29c3974ccd4848cfa546c785f47c3962338c250e Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Tue, 17 Nov 2020 11:36:31 +0100 Subject: [PATCH 3/4] add hints about directory context --- docs/ocis/development/testing.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/ocis/development/testing.md b/docs/ocis/development/testing.md index 329a8c263b3..cdd7cd8e01b 100644 --- a/docs/ocis/development/testing.md +++ b/docs/ocis/development/testing.md @@ -10,7 +10,7 @@ geekdocFilePath: testing.md ## Acceptance tests -We are using the ownCloud 10 acceptance testsuite against ocis. To set this up you need the owncloud 10 core repo, a ldap server that the acceptance tests can use to manage users, a redis server for file-versions and the oCIS code. +We are using the ownCloud 10 acceptance test suite against oCIS. To set this up you need the ownCloud 10 core repo, a LDAP server that the acceptance tests can use to manage users, a redis server for file-versions and the oCIS code. ### Getting the tests @@ -42,7 +42,7 @@ In the ownCloud 10 core clone the testing app with the following command: git clone https://github.com/owncloud/testing apps/testing ``` -Then run the api acceptance tests with the following command: +Then run the api acceptance tests with the following command inside the `./ocis` directory: ``` make test-acceptance-api \ TEST_SERVER_URL=https://localhost:9200 \ @@ -84,7 +84,7 @@ If you want to work on a specific issue } } -2. locally run each of the tests marked with that issue in the expected failures file +2. locally run each of the tests marked with that issue in the expected failures file. This must be run inside the `./ocis` directory. E.g.: ``` From 0e1840a03c8840fabffc5881dbd42ba1512e0eb1 Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Tue, 17 Nov 2020 13:16:49 +0100 Subject: [PATCH 4/4] fix coverage upload --- .drone.star | 1 - 1 file changed, 1 deletion(-) diff --git a/.drone.star b/.drone.star index 7864f55502a..44924ba10a9 100644 --- a/.drone.star +++ b/.drone.star @@ -330,7 +330,6 @@ def testing(ctx, module): 'source': '%s_coverage.out' % (module), 'target': '%s/%s/coverage' % (ctx.repo.slug, ctx.build.commit + '-${DRONE_BUILD_NUMBER}'), 'path_style': True, - 'strip_prefix': module, 'access_key': { 'from_secret': 'cache_s3_access_key' },