Skip to content

Commit

Permalink
Merge pull request #138 from catdad/#105-linux
Browse files Browse the repository at this point in the history
adding testing on Ubuntu 18.04 Bionic
  • Loading branch information
catdad authored Apr 26, 2019
2 parents 3a474ce + 6dff8a2 commit 136fe68
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 37 deletions.
3 changes: 2 additions & 1 deletion .brackets.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
}
},
"language.fileNames": {
"Jenkinsfile": "groovy"
"Jenkinsfile": "groovy",
".dockerbuild": "dockerfile"
}
}
39 changes: 39 additions & 0 deletions .dockerbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM ubuntu:18.04

ARG TRAVIS_COMMIT
ARG TRAVIS_TAG

COPY . /app

ENV DEBIAN_FRONTEND noninteractive
ENV FORCE_COLOR 1

# dependecies:
# - build-essential: compiling with node-gyp
# - gdebi-core: installing chrome
# - wget: to get stuff, duh
# - curl: also to get stuff
# - xvfb: to run headless electron tests
# - gnupg: apparently needed to run node
# - chrome: too lazy to figure out electron dependencies
# - node: for testing things

RUN apt update -qq
RUN apt install --yes -qq build-essential gdebi-core wget xvfb curl gnupg
RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN gdebi --non-interactive --quiet google-chrome-stable_current_amd64.deb
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash \
&& apt install --yes nodejs

RUN node -v
RUN npm -v

WORKDIR /app

RUN npm ci --unsafe-perm
RUN npm run citest
RUN npm run package -- --version $TRAVIS_COMMIT --tag $TRAVIS_TAG --upload

FROM ubuntu:18.04

COPY --from=0 /app/dist /dist
72 changes: 40 additions & 32 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,43 @@
os:
# - linux
- osx

language: node_js

node_js:
- '10'

addons:
apt:
packages:
- xvfb

install:
- npm ci

script:
- npm run citest
- npm run package -- --version $TRAVIS_COMMIT --tag $TRAVIS_TAG --upload

after_success:
- ls -la dist
jobs:
include:
- name: linux-docker
os: linux
services:
- docker
install:
- cat .dockerbuild
script:
- docker build --build-arg TRAVIS_COMMIT --build-arg TRAVIS_TAG -t raw-viewer-build . -f- < .dockerbuild
- docker images
- docker run -d --rm --name rv raw-viewer-build tail -f /dev/null
- docker cp rv:/dist dist
- docker kill rv
after_success:
- ls -la dist
- name: darwin
os: osx
node_js: '10'
before_install:
- node -v
- npm -v
install:
- npm ci
script:
- npm run citest
- npm run package -- --version $TRAVIS_COMMIT --tag $TRAVIS_TAG --upload
after_success:
- ls -la dist
deploy:
provider: releases
skip_cleanup: true
api_key:
secure: iFtH8nv6evIRzo4qciIeUO7rSH3FIu38rTOloJX4Q49tATO+iIH0vwScn4Nve+xfEyzDQopyLJtK2S8/VRl2a24ogSauYw5WYleceJ9g/xsCvAy9Fdl8NUqaYkJywQodxHXL9GORJfXsindDEOhUyTCBntHG1xtLvlbFqQPF4/Qfk+DzHHQ4SsIwJjGgd82MkP7r1LcoKV3dg3KPk16gyv8BphgIoOWEuEcsyl0Q29lBQKCh+c5dXKCsH+AYg0/glXjlIaX8MS7hbhl3RqDMSa7kmIjp0Zbm2IlLpyixnYIXEdS2Xem6J4wUeA/FlzKKhCXKSoDhuk4NIcRVCmpVasSPTk8Qkc+vf+3PHBNTwqQkfUxMSblqKdsJuxL07XnmM/cyj7ZrmIpSPMO7Rj+EFTkCAbCNa5m5+u9ZsfFQ/Lu3NFjEs5gN39X/a3hdpBDhzQ12aGMjN/HxMH6Y5FfwzT34W+M78EwQyL/Nr1fcbAXIze7dY+JhSrIE8KAJq14+StgiNHcxWe+580bLEHkIxWRTQDp/rtW43jfbDH7WlOn/kfW8TUADsZFptOrBBDkVe6ll2LtanhHSjib1LIs4cP/5whzBluVWlXG8SuhMQwaHIIZBsx3spbAR2iMzsdpCBT836pLBFP3aghoi6tOPUK5iqZPkhQGIP/Ga1WwVORk=
file_glob: true
file: 'dist/*.zip'
on:
repo: catdad/raw-viewer
branch: '*'
tags: true

deploy:
provider: releases
skip_cleanup: true
api_key:
secure: iFtH8nv6evIRzo4qciIeUO7rSH3FIu38rTOloJX4Q49tATO+iIH0vwScn4Nve+xfEyzDQopyLJtK2S8/VRl2a24ogSauYw5WYleceJ9g/xsCvAy9Fdl8NUqaYkJywQodxHXL9GORJfXsindDEOhUyTCBntHG1xtLvlbFqQPF4/Qfk+DzHHQ4SsIwJjGgd82MkP7r1LcoKV3dg3KPk16gyv8BphgIoOWEuEcsyl0Q29lBQKCh+c5dXKCsH+AYg0/glXjlIaX8MS7hbhl3RqDMSa7kmIjp0Zbm2IlLpyixnYIXEdS2Xem6J4wUeA/FlzKKhCXKSoDhuk4NIcRVCmpVasSPTk8Qkc+vf+3PHBNTwqQkfUxMSblqKdsJuxL07XnmM/cyj7ZrmIpSPMO7Rj+EFTkCAbCNa5m5+u9ZsfFQ/Lu3NFjEs5gN39X/a3hdpBDhzQ12aGMjN/HxMH6Y5FfwzT34W+M78EwQyL/Nr1fcbAXIze7dY+JhSrIE8KAJq14+StgiNHcxWe+580bLEHkIxWRTQDp/rtW43jfbDH7WlOn/kfW8TUADsZFptOrBBDkVe6ll2LtanhHSjib1LIs4cP/5whzBluVWlXG8SuhMQwaHIIZBsx3spbAR2iMzsdpCBT836pLBFP3aghoi6tOPUK5iqZPkhQGIP/Ga1WwVORk=
file_glob: true
file: 'dist/*.zip'
on:
repo: catdad/raw-viewer
branch: '*'
tags: true
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"postinstall": "electron-rebuild && node scripts/exiftool-install.js",
"lint": "eslint main.js lib public renderer scripts test",
"pretest": "node test/lib/downloader.js",
"test": "mocha --timeout 10000 --slow 0 test/**.test.js",
"test": "mocha --timeout 30000 --slow 0 test/**.test.js",
"citest": "xvfb-maybe npm test && npm run -s lint",
"start": "electron .",
"dev": "electronmon .",
Expand Down
21 changes: 18 additions & 3 deletions scripts/build-package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-console */
const { promisify } = require('util');
const { pipeline } = require('stream');
const { execFile } = require('child_process');
const path = require('path');
const fs = require('fs-extra');
const del = require('del');
Expand Down Expand Up @@ -71,9 +72,17 @@ const darwinZip = async () => {
});
};

const darwinUpload = async () => {
const linuxTar = async () => {
await promisify(execFile)('tar', [
'cfz',
`dist/${name}-Linux-portable.tar.gz`,
'-C', dirs.linux,
'.'
]);
};

const upload = async (filename) => {
const url = 'https://file.io';
const filename = `${name}-MacOS-portable.zip`;
const filepath = `dist/${filename}`;
console.log(`Uploading ${filepath} to ${url}`);

Expand Down Expand Up @@ -129,7 +138,13 @@ const darwinUpload = async () => {
await darwinZip();

if (argv.upload) {
await darwinUpload();
await upload(`${name}-MacOS-portable.zip`);
}
} else if (platform === 'linux') {
await linuxTar();

if (argv.upload) {
await upload(`${name}-Linux-portable.tar.gz`);
}
}
})().then(() => {
Expand Down
9 changes: 9 additions & 0 deletions test/lib/app-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ let app;

const sleep = time => new Promise(resolve => setTimeout(() => resolve(), time));

const log = (...args) => console.log(...args); // eslint-disable-line no-console

const start = async (configPath = '') => {
app = new Application({
path: electronPath,
Expand All @@ -25,6 +27,13 @@ const start = async (configPath = '') => {

const stop = async () => {
if (app && app.isRunning()) {
try {
const logs = await app.client.log('browser');
log(logs);
} catch (e) {
log(e);
}

await app.stop();
app = null;
}
Expand Down

0 comments on commit 136fe68

Please sign in to comment.