Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

Commit

Permalink
feat: automate releases (#49)
Browse files Browse the repository at this point in the history
Initially we wanted to fully automate releases and build artifact
uploads, but as @kim pointed out it might be a security hazard and also
might mislead people into thinking this is an official production
release. So until we have the proper infrastructure in place to securely
automate releases, we'll do them manually.

It's worth mentioning that the releases are meant for our own internal
evaluation only as the app is still in prototype stage. For this I added
a warning in the readme.

* Configure electron-builder release
* Build both platforms in parallel
* Add author and description
* Explicitly spell out Linux package types
* Build macOS only for master
* Update README
* chore(release): 0.0.2
* Remove publish steps
* Extract development related documentation
* Fix link
* Improve wording
* Update contact info
* Automate releases
Co-authored-by: Rūdolfs Ošiņš <rudolfs@osins.org>
  • Loading branch information
xla authored and rudolfs committed Mar 4, 2020
1 parent 32bdcd1 commit 1b66743
Show file tree
Hide file tree
Showing 8 changed files with 1,140 additions and 129 deletions.
57 changes: 24 additions & 33 deletions .buildkite/pipeline.yaml
@@ -1,34 +1,25 @@
.test_linux: &test_linux
label: 'Test and package app on Linux'
agents:
production: "true"
platform: "linux"
timeout_in_minutes: 60
env:
DOCKER_IMAGE: 'gcr.io/opensourcecoin/radicle-upstream:0.2.1'
SHARED_MASTER_CACHE: true
command: '.buildkite/run.sh'
artifact_paths:
- "app/dist/*.AppImage"
- "app/dist/*.snap"
- "app/cypress/screenshots/**/*.png"

.test_macos: &test_macos
label: 'Test and package app on macOS'
agents:
production: "false"
platform: "macos"
timeout_in_minutes: 60
command: '.buildkite/run.sh'
artifact_paths:
- "app/dist/*.dmg"
- "app/cypress/screenshots/**/*.png"

steps:
- branches: master
concurrency: 1
concurrency_group: master
<<: *test_linux
<<: *test_macos
- branches: "!master"
<<: *test_linux
- label: 'Test and package app on Linux'
command: '.buildkite/run.sh'
agents:
production: "true"
platform: "linux"
timeout_in_minutes: 60
env:
DOCKER_IMAGE: 'gcr.io/opensourcecoin/radicle-upstream:0.2.1'
SHARED_MASTER_CACHE: true
artifact_paths:
- "app/dist/*.AppImage"
- "app/dist/*.snap"
- "app/cypress/screenshots/**/*.png"

- label: 'Test and package app on macOS'
if: build.branch == 'master'
command: '.buildkite/run.sh'
agents:
production: "false"
platform: "macos"
timeout_in_minutes: 60
artifact_paths:
- "app/dist/*.dmg"
- "app/cypress/screenshots/**/*.png"
127 changes: 127 additions & 0 deletions DEVELOPMENT.md
@@ -0,0 +1,127 @@
## Development

Our current workflow is to put our changes in feature branches which get
submitted for review on GitHub as pull requests. Ideally a pull request is
small and changes only one aspect of the code at a time. After a pull request
is reviewed by at least one peer and passes all tests it can be squash-merged
into master.

To automate our release process as much as possible we're using
[Standard Version][sv] and commits on master should be formatted according to
the [conventional commits specification][ccs].

Here are a couple of examples:

chore: remove leftover error mod reference (#74)
fix: improve project creation validations (#76)
feat: project creation (#70)

The pull request ref goes in brackets at the end.
Generally we also follow [good commit message hygene][tpope].


### Releases

To perform a release:

1. If you haven't already, install the [`hub`][hub] cli tool.

2. Run: `(cd app && yarn release)` and follow the instructions.
Here's what a typical release looks like:

```
$ yarn release
Cutting release v0.0.11:
✔ git checkout master
✔ git branch release-v0.0.11 && git checkout release-v0.0.11
✔ yarn run standard-version
✔ git push origin release-v0.0.11
✔ hub pull-request -p --no-edit
Now ask a peer to review the following pull request,
but don't merge it just yet:
👉 https://github.com/rudolfs/test/pull/17
To merge the pull request and finalize this release run:
👉 yarn release:finalize v0.0.11 17
$ yarn release:finalize v0.0.11 17
Finalizing release v0.0.11:
✔ hub api -XPUT "repos/radicle-dev/radicle-upstream/pulls/17/merge"
✔ git checkout master && git pull
✔ git tag v0.0.11 74369ee3c078bc3688f0b668cc94a36491271d52
✔ git push --tags
Release v0.0.11 successfully completed! 👏 🎉 🚀
```

3. Once the release PR branch is merged into master a build will be triggered
on Buildkite, this will build the app for both Linux and macOS. When the
build has completed you can download the binaries [here][artifacts].


### CI setup

CI is configured via:

```
radicle-upstream/.buildkite
.
├── Dockerfile
├── pipeline.yaml
└── run.sh
```

The build process is run for every commit that is pushed to GitHub. When the
tests pass, the build process spits out and uploads an app binary as build
artifact. When the tests fail, screenshots of the failing tests will be
uploaded instead of the binary.


### Buildkite setup

We use a Docker image that has all of the system dependencies installed to run
tests on Buildkite. Follow these steps if you need to update the dependencies
bundled in the image:

1. Install [Google Cloud SDK][gc]

2. Authenticate with Google Cloud: `gcloud auth configure-docker`, pick
`[1] opensourcecoin` when asked for which project to use

3. Prepare a new docker image with all the necessary dependencies by editing:
`.buildkite/Dockerfile`

4. Get the current image version from `pipeline.yaml` and build a new Docker
image (remember to bump the version):
```
cd .buildkite
docker build . -t gcr.io/opensourcecoin/radicle-upstream:0.2.1
docker push gcr.io/opensourcecoin/radicle-upstream:0.2.1
```

5. Push the new image version to Google Cloud:
`docker push gcr.io/opensourcecoin/radicle-upstream:0.2.1`

6. Update the image version in `pipeline.yaml`:
```
DOCKER_IMAGE: 'gcr.io/opensourcecoin/radicle-upstream:0.2.1'
```
7. Commit changes to `Dockerfile` and `pipeline.yaml` and push to origin, this
should build the new branch with the updated image


[tpope]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[sv]: https://github.com/conventional-changelog/standard-version
[gc]: https://cloud.google.com/sdk/docs/quickstart-macos
[ccs]: https://www.conventionalcommits.org/en/v1.0.0/
[artifacts]: https://buildkite.com/monadic/radicle-upstream/builds?branch=master
[hub]: https://github.com/github/hub
69 changes: 5 additions & 64 deletions README.md
@@ -1,4 +1,4 @@
[![Build status][0]][1]
[![Build status][badge]][status]

# radicle-upstream

Expand All @@ -11,68 +11,9 @@ A monorepo for related Radicle projects:
See the README.md of each respective project for further details, including
installation, usage, and testing instructions.

Be sure to have a look at [DEVELOPMENT.md][dev] before contributing.

## Development

Notes and guidelines for committers:

- [Use tpope commit norms][2]: Capitalize commit messages, use the imperative
present tense, wrap commit messages at 50 characters.


#### CI

CI is configured via:

```
radicle-upstream/.buildkite
.
├── Dockerfile
├── pipeline.yaml
└── run.sh
```

The build process is run for every commit that is pushed to GitHub. When the
tests pass, the build process spits out and uploads an app binary as build
artifact. When the tests fail, screenshots of the failing tests will be
uploaded instead of the binary.


#### Buildkite setup

We use a Docker image that has all of the system dependencies installed to run
tests on Buildkite. Follow these steps if you need to update the dependencies
bundled in the image:

1. Install [Google Cloud SDK][3]

2. Authenticate with Google Cloud: `gcloud auth configure-docker`, pick
`[1] opensourcecoin` when asked for which project to use

3. Prepare a new docker image with all the necessary dependencies by editing:
`.buildkite/Dockerfile`

4. Get the current image version from `pipeline.yaml` and build a new Docker
image (remember to bump the version):
```
cd .buildkite
docker build . -t gcr.io/opensourcecoin/radicle-upstream:0.2.1
docker push gcr.io/opensourcecoin/radicle-upstream:0.2.1
```

5. Push the new image version to Google Cloud:
`docker push gcr.io/opensourcecoin/radicle-upstream:0.2.1`

6. Update the image version in `pipeline.yaml`:
```
DOCKER_IMAGE: 'gcr.io/opensourcecoin/radicle-upstream:0.2.1'
```
7. Commit changes to `Dockerfile` and `pipeline.yaml` and push to origin, this
should build the new branch with the updated image


[0]: https://badge.buildkite.com/4fb43c6b471ab7cc26509eae235b0e4bbbaace11cc1848eae6.svg?branch=master
[1]: https://buildkite.com/monadic/radicle-upstream
[2]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[3]: https://cloud.google.com/sdk/docs/quickstart-macos
[badge]: https://badge.buildkite.com/4fb43c6b471ab7cc26509eae235b0e4bbbaace11cc1848eae6.svg?branch=master
[status]: https://buildkite.com/monadic/radicle-upstream
[dev]: DEVELOPMENT.md
5 changes: 5 additions & 0 deletions app/CHANGELOG.md
@@ -0,0 +1,5 @@
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.0.2](https://github.com/radicle-dev/radicle-upstream/compare/v0.0.1...v0.0.2) (2020-01-23)
12 changes: 6 additions & 6 deletions app/README.md
Expand Up @@ -9,8 +9,8 @@ We currently support Linux and macOS.
The app is written in Svelte + Electron. For our dependency management and
script execution we use `yarn`.

Code formatting is dictated by [prettier][0] and we enforce it locally on
a pre-commit basis with [husky][1] and [lint-staged][2].
Code formatting is dictated by [prettier][pr] and we enforce it locally on
a pre-commit basis with [husky][hu] and [lint-staged][ls].


### Setup
Expand Down Expand Up @@ -52,12 +52,12 @@ yarn electron:start - wait for dependency start-up and start electron without
yarn proxy:build - build the backend GraphQL proxy binary
yarn proxy:start - start the backend proxy and serve mock data
yarn svelte:clean - remove build artefacts
yarn svelte:clean - remove build artifacts
yarn svelte:build - compile svelte to JS
yarn svelte:watch - compile svelte to JS on every change to the code
```


[0]: https://prettier.io/
[1]: https://github.com/typicode/husky
[2]: https://github.com/okonet/lint-staged
[pr]: https://prettier.io/
[hu]: https://github.com/typicode/husky
[ls]: https://github.com/okonet/lint-staged
30 changes: 27 additions & 3 deletions app/package.json
@@ -1,6 +1,16 @@
{
"name": "radicle-upstream",
"version": "0.0.1",
"version": "0.0.2",
"author": {
"name": "Radicle",
"email": "dev@radicle.xyz",
"url": "https://radicle.xyz"
},
"description": "Desktop client for radicle",
"repository": {
"type": "git",
"url": "https://github.com/radicle-dev/radicle-upstream.git"
},
"build": {
"appId": "radicle-upstream.monadic.xyz",
"files": [
Expand All @@ -16,6 +26,12 @@
"to": "proxy"
}
],
"linux": {
"target": [
"Appimage",
"snap"
]
},
"mac": {
"target": [
"dmg"
Expand Down Expand Up @@ -47,6 +63,7 @@
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-svelte": "^5.1.1",
"rollup-plugin-terser": "^5.2.0",
"standard-version": "^7.1.0",
"svelte": "^3.17.1",
"svelte-spa-router": "^2.0.0",
"wait-on": "^4.0.0"
Expand All @@ -57,7 +74,7 @@
"test": "TZ='UTC' run-p --race proxy:start:test test:run",
"test:debug": "TZ='UTC' run-p --race svelte:watch proxy:start:test cypress:open",
"test:run": "wait-on http://localhost:8080 && yarn svelte:build && yarn cypress:run",
"dist": "rm -rf ./dist && mkdir ./dist && yarn svelte:clean && yarn svelte:build && yarn proxy:build:release && cp ../proxy/target/release/proxy dist && electron-builder",
"dist": "rm -rf ./dist && mkdir ./dist && yarn svelte:clean && yarn svelte:build && yarn proxy:build:release && cp ../proxy/target/release/proxy dist && electron-builder --publish never",
"electron:start": "wait-on ./public/bundle.js && wait-on ./native/main.comp.js && wait-on http://localhost:8080 && NODE_ENV=development electron .",
"svelte:clean": "rm -rf public/bundle.*",
"svelte:build": "yarn svelte:clean && rollup -c",
Expand All @@ -69,7 +86,9 @@
"proxy:start:test": "cd ../proxy && cargo run -- --source=memory --test",
"cypress:run": "yarn run cypress run",
"cypress:open": "yarn run cypress open",
"generate:colors": "babel-node --presets \"@babel/env\" scripts/generate-colors.js"
"generate:colors": "babel-node --presets \"@babel/env\" scripts/generate-colors.js",
"release": "babel-node --presets \"@babel/env\" scripts/release.js",
"release:finalize": "babel-node --presets \"@babel/env\" scripts/release.js --finalize"
},
"dependencies": {
"@babel/runtime": "^7.8.3",
Expand All @@ -85,6 +104,11 @@
"pre-commit": "lint-staged"
}
},
"standard-version": {
"skip": {
"tag": true
}
},
"lint-staged": {
"*.{js,css,json,html}": [
"prettier --write"
Expand Down

0 comments on commit 1b66743

Please sign in to comment.