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

Add tests and release jobs into drone #5

Merged
merged 9 commits into from
Sep 1, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 140 additions & 4 deletions .drone.star
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
def main(ctx):
before = [
tests(ctx),
changelog(ctx),
website(ctx),
]

stages = [
release(ctx),
]

after = [
notify(),
]

return before + after
return before + stages + after

def changelog(ctx):
repo_slug = ctx.build.source_repo if ctx.build.source_repo else ctx.repo.slug
Expand Down Expand Up @@ -46,10 +51,10 @@ def changelog(ctx):
},
{
'name': 'generate',
'image': 'webhippie/golang:1.13',
'image': 'toolhippie/calens:latest',
'pull': 'always',
'commands': [
'make changelog',
'calens >| CHANGELOG.md',
],
},
{
Expand Down Expand Up @@ -219,4 +224,135 @@ def notify():
'failure'
]
},
}
}

def tests(ctx):
return {
'kind': 'pipeline',
'type': 'docker',
'name': 'tests',
'platform': {
'os': 'linux',
'arch': 'amd64',
},
'steps': [
{
'name': 'install',
'image': 'owncloudci/nodejs:11',
'pull': 'always',
'commands': [
'yarn install --frozen-lockfile',
],
},
{
'name': 'lint',
'image': 'owncloudci/nodejs:11',
'pull': 'always',
'commands': [
'yarn lint',
],
},
{
'name': 'build',
'image': 'owncloudci/nodejs:11',
'pull': 'always',
'commands': [
'yarn build',
],
},
],
'trigger': {
'ref': [
'refs/heads/master',
'refs/tags/**',
'refs/pull/**',
],
},
}

def release(ctx):
return {
'kind': 'pipeline',
'type': 'docker',
'name': 'release',
'platform': {
'os': 'linux',
'arch': 'amd64',
},
'steps': [
{
'name': 'build',
'image': 'owncloudci/nodejs:11',
'pull': 'always',
'commands': [
'yarn install --frozen-lockfile',
'yarn build'
],
'when': {
'ref': [
'refs/tags/**',
],
},
},
{
'name': 'changelog',
'image': 'toolhippie/calens:latest',
'pull': 'always',
'commands': [
'calens --version %s -o dist/CHANGELOG.md' % ctx.build.ref.replace("refs/tags/v", "").split("-")[0],
],
'when': {
'ref': [
'refs/tags/**',
],
},
},
{
'name': 'publish-github',
'image': 'plugins/github-release:latest',
'pull': 'always',
'settings': {
'api_key': {
'from_secret': 'github_token',
},
'title': ctx.build.ref.replace("refs/tags/v", ""),
'note': 'dist/CHANGELOG.md',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to build the changelog first. The other alrready built changelog is from another pipeline. Also you need only the changes for that specific tag. Example in https://github.com/owncloud/ocis/blob/master/.drone.star#L565

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks! I added it.

'overwrite': True,
},
'when': {
'ref': [
'refs/tags/**',
],
},
},
{
'name': 'publish-npm',
'image': 'plugins/npm:latest',
'pull': 'always',
'settings': {
'username': {
'from_secret': 'npm_username',
},
'email': {
'from_secret': 'npm_email',
},
'token': {
'from_secret': 'npm_token',
},
},
'when': {
'ref': [
'refs/tags/**',
],
},
},
],
'depends_on': [
'tests'
],
'trigger': {
'ref': [
'refs/tags/**',
],
},
}
28 changes: 26 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
{
"name": "file-picker",
"name": "@owncloud/file-picker",
"version": "0.1.0",
"author": "ownclouders <[email protected]>",
"description": "Easily integrate ownCloud into your existing products",
"type": "module",
"module": "dist/file-picker.js",
"main": "dist/file-picker.js",
"unpkg": "dist/file-picker.min.js",
"repository": {
"type": "git",
"url": "git+https://github.com/owncloud/file-picker.git"
},
"keywords": [
"vue",
"vuejs",
"file",
"picker",
"ocis",
"owncloud",
"location",
"picker"
],
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/owncloud/file-picker/issues"
},
"homepage": "https://owncloud.github.io/integration/file_picker",
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build --target wc --name file-picker",
"build": "vue-cli-service build --target wc --name file-picker && rm ./dist/demo.html",
"test:unit": "vue-cli-service test:unit",
"lint": "vue-cli-service lint"
},
Expand Down