Prepare travis builds

This commit is contained in:
Thomas Nordquist
2019-01-13 03:52:28 +01:00
parent 7e28865a73
commit 37bb0b6ea1
4 changed files with 52 additions and 12 deletions

26
.travis.yml Normal file
View File

@@ -0,0 +1,26 @@
language: node_js
cache:
directories:
- node_modules
- $HOME/.cache/electron
- $HOME/.cache/electron-builder
- $HOME/.npm/_prebuilds
node_js:
- "10"
os:
- linux
- osx
install:
- npm install
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install snapd && sudo snap install snapcraft --classic; fi
script:
- npm run build
- npm run prepare-release
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then npm run package -- linux; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then npm run package -- mac; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then npm run package -- win; fi

View File

@@ -9,7 +9,8 @@
"test": "npm run test-backend",
"build": "cd app; npm run build; cd ..; cd backend; npm run build; cd ..",
"test-backend": "cd backend && npm run test && cd ..",
"release": "npm run test && ./release.sh"
"prepare-release": "./prepare-release.sh",
"package": "ts-node package.ts"
},
"repository": {
"type": "git",

View File

@@ -7,7 +7,7 @@ const linux: builder.CliOptions = {
arm64: true,
linux: ['snap', 'AppImage', 'deb', 'pacman'],
projectDir: './build/clean',
publish: 'onTag',
publish: 'always',
}
const win: builder.CliOptions = {
@@ -17,7 +17,7 @@ const win: builder.CliOptions = {
arm64: false,
win: ['portable'],
projectDir: './build/clean',
publish: 'onTag',
publish: 'always',
}
const mac: builder.CliOptions = {
@@ -31,6 +31,7 @@ const mac: builder.CliOptions = {
}
async function buildAll() {
console.log(process.argv[2])
switch (process.argv[2]) {
case 'win':
await builder.build(win)

View File

@@ -1,20 +1,32 @@
#!/bin/bash
DIR=build/clean
rm -rf "$DIR"
mkdir -p "$DIR"
git clone .git "$DIR"
set -e
ORIGINAL_DIR=`pwd`
DIR=build/clean
rm -rf "$DIR" || echo "Directory did not exist"
mkdir -p "$DIR"
git clone .git "$DIR"
cd $DIR
cd app && npm install; cd ..
cd backend && npm install; cd ..
# App
cd app
npm install
cd ..
# Backend
cd backend
npm install;
#npm run test
cd ..
# Build
npm run build
rm -rf app/node_modules
cd "$ORIGINAL_DIR"
node_modules/.bin/ts-node build.ts
exit 0
docker run --rm -ti \
--env ELECTRON_CACHE="/root/.cache/electron" \