1
0
Fork 0
mirror of https://github.com/heyarne/airsonic-ui.git synced 2026-05-07 02:33:39 +02:00

Set up continuous deployment (#70)

* Add build step to circleci config

* Add deploy job to circleci

* Configure test → build → deploy as a cascade and ensure `public` exists when building

* Add deploy key

* Deploy only on master

* Remove ssh keys from build step

* Remove travis-ci

* Move build-report into task and update README.md
This commit is contained in:
heyarne 2019-12-14 11:35:07 +01:00 committed by GitHub
commit 6e17c254c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 81 additions and 865 deletions

View file

@ -1,4 +1,5 @@
version: 2 version: 2
jobs: jobs:
test: test:
working_directory: ~/repo working_directory: ~/repo
@ -11,19 +12,86 @@ jobs:
- restore_cache: - restore_cache:
keys: keys:
- build_cache-{{ checksum "package.json" }}-{{ checksum "shadow-cljs.edn" }} - build_cache-{{ checksum "package.json" }}-{{ checksum "shadow-cljs.edn" }}
- run: npm install - run:
- run: npm run test name: Install dependencies
command: npm install
- run:
name: Test
command: npm test
- save_cache: - save_cache:
paths: paths:
- node_modules - node_modules
- ~/.m2 - ~/.m2
- ~/.npm
key: build_cache-{{ checksum "package.json" }}-{{ checksum "shadow-cljs.edn" }} key: build_cache-{{ checksum "package.json" }}-{{ checksum "shadow-cljs.edn" }}
build:
working_directory: ~/repo
docker:
- image: circleci/openjdk:11-jdk-stretch-node-browsers
steps:
- checkout
- restore_cache:
keys:
- build_cache-{{ checksum "package.json" }}-{{ checksum "shadow-cljs.edn" }}
- run:
name: Install dependencies
command: npm install
- run:
name: Build SPA
command: npm run build
- save_cache:
paths:
- node_modules
- ~/.m2
- ~/.npm
key: build_cache-{{ checksum "package.json" }}-{{ checksum "shadow-cljs.edn" }}
- persist_to_workspace:
root: /home/circleci/repo/public
paths:
- "*"
deploy:
working_directory: ~/repo
docker:
- image: circleci/openjdk:11-jdk-stretch-node-browsers
steps:
- add_ssh_keys:
fingerprints:
- "85:2f:28:0f:b9:45:b8:f1:0f:c2:0a:1c:5e:4d:a2:06"
- checkout
- attach_workspace:
at: /home/circleci/repo/public
- restore_cache:
keys:
- build_cache-{{ checksum "package.json" }}-{{ checksum "shadow-cljs.edn" }}
- run:
name: Install dependencies
command: npm install
- run:
name: Deploy to gh-pages branch
command: |
git config user.email "build@circleci.com"
git config user.name "ci-build"
npm run deploy
workflows: workflows:
version: 2 version: 2
test: test-build-deploy:
jobs: jobs:
- test: - test:
filters: filters:
branches: branches:
ignore: ignore:
- gh-pages - gh-pages
- build:
filters:
branches:
ignore:
- gh-pages
requires:
- test
- deploy:
requires:
- build
filters:
branches:
only: master

View file

@ -1,11 +0,0 @@
language: node_js
node_js:
- "10"
- "8"
addons:
chrome: stable
cache:
directories:
- node_modules
- .shadow-cljs
- $HOME/.m2

View file

@ -1,4 +1,4 @@
# Airsonic Web Client [![Build Status](https://travis-ci.org/heyarne/airsonic-ui.svg?branch=master)](https://travis-ci.org/heyarne/airsonic-ui) [![CircleCI](https://circleci.com/gh/heyarne/airsonic-ui.svg?style=svg)](https://circleci.com/gh/heyarne/airsonic-ui) [![Greenkeeper badge](https://badges.greenkeeper.io/heyarne/airsonic-ui.svg)](https://greenkeeper.io/) # Airsonic Web Client [![CircleCI](https://circleci.com/gh/heyarne/airsonic-ui.svg?style=svg)](https://circleci.com/gh/heyarne/airsonic-ui) [![Greenkeeper badge](https://badges.greenkeeper.io/heyarne/airsonic-ui.svg)](https://greenkeeper.io/)
This repository contains an alternative web frontend for [airsonic](https://github.com/airsonic/airsonic). The goal is to eventually be able to fully replace the current web interface. This repository contains an alternative web frontend for [airsonic](https://github.com/airsonic/airsonic). The goal is to eventually be able to fully replace the current web interface.
@ -37,9 +37,11 @@ $ npm install
$ npm run dev $ npm run dev
``` ```
All other build tasks are defined in the `package.json` (more below).
### Editor integration ### Editor integration
Integrating shadow-cljs with your editor helps tremendously with development. After having run `npm run dev` as described above you can connect to the REPL and get features like in-editor code execution and code completion / documentation lookup. For further information see [this part of the shadow-cljs user guide](https://shadow-cljs.github.io/docs/UsersGuide.html#_editor_integration), which contains instructions for Emacs, Atom, VSCode and other editors. Make sure to open `localhost:8080` in the browser to execute ClojureScript code. Integrating shadow-cljs with your editor helps tremendously with development. After having run `npm run dev` as described above you can connect to the REPL and get features like in-editor code execution and code completion / documentation lookup. For further information see [this part of the shadow-cljs user guide](https://shadow-cljs.github.io/docs/UsersGuide.html#_editor_integration). Recommended editors and plugins are Calva for VSCode and CIDER for Emacs (comes with Spacemacs). Make sure to open `localhost:8080` in the browser after starting the `dev:cljs` task to execute ClojureScript code in a live REPL.
### re-frame-10x ### re-frame-10x
@ -66,10 +68,12 @@ $ npm test
# build and optimize the code once for production # build and optimize the code once for production
$ npm run build $ npm run build
# runs npm run build and publishes everything via gh-pages # publishes everything via gh-pages
$ npm run deploy $ npm run deploy
``` ```
There is continuous deployment set up on [circleci](https://circleci.com/gh/heyarne/airsonic-ui) that builds and deploys to `gh-pages` after a commit to the `master` branch.
**Note:** If you have a continuous build running and run `npm run build` or `npm run deploy`, it will delete the compiled tests, causing the continuous tests to not run anymore. This can be fixed by running `npm test` again. **Note:** If you have a continuous build running and run `npm run build` or `npm run deploy`, it will delete the compiled tests, causing the continuous tests to not run anymore. This can be fixed by running `npm test` again.
All build artifacts land in `/public`. Don't change anything in there as changes will be overwritten. All build artifacts land in `/public`. Don't change anything in there as changes will be overwritten.

File diff suppressed because one or more lines are too long

View file

@ -5,11 +5,12 @@
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"build:cljs": "shadow-cljs release app", "build:cljs": "shadow-cljs release app",
"build:cljs-report": "shadow-cljs run shadow.cljs.build-report app public/build-report.html",
"build:sass": "node-sass --output-style compressed src/sass/app.sass | postcss -o public/app/app.css", "build:sass": "node-sass --output-style compressed src/sass/app.sass | postcss -o public/app/app.css",
"build": "rm -r public/*; run-p copy:* build:*", "build": "mkdir -p public; rm -r public/*; run-p copy:* build:*",
"copy:assets": "cp -R src/assets/* public/", "copy:assets": "cp -R src/assets/* public/",
"copy:icons": "cp -R node_modules/open-iconic/font/fonts public", "copy:icons": "cp -R node_modules/open-iconic/font/fonts public",
"deploy": "npm run build && gh-pages -d public -m \"Deploying $(git rev-parse --short HEAD)\"", "deploy": "gh-pages -d public -m \"Deploying $(git rev-parse --short HEAD)\"",
"dev:cljs": "shadow-cljs watch app test", "dev:cljs": "shadow-cljs watch app test",
"dev:sass": "node-sass -w src/sass/app.sass -o public/app", "dev:sass": "node-sass -w src/sass/app.sass -o public/app",
"dev:test": "karma start --reporters notify,progress --auto-watch", "dev:test": "karma start --reporters notify,progress --auto-watch",