Skip to content
Permalink
Browse files

Update dev dependencies and configure workflows (#116)

  • Loading branch information...
rafaelgssa committed Sep 10, 2019
1 parent 0883902 commit d9c99e1df93be75d4d65fa9cdbac23b249941fcb
@@ -0,0 +1,27 @@
name: 'Development'

on:
push:
branches:
- dev

jobs:
test:
name: 'Test'
runs-on: ubuntu-latest
steps:
- name: 'Checkout dev'
uses: actions/checkout@v1
- name: 'Install dependencies'
run: npm ci
- if: github.repository == 'rafaelgssa/traktflix'
name: 'Generate config.json'
run: "echo \"{ \\\"development\\\": { \\\"clientId\\\": \\\"${{ secrets.TRAKT_CLIENT_ID }}\\\", \\\"clientSecret\\\": \\\"${{ secrets.TRAKT_CLIENT_SECRET }}\\\", \\\"analyticsId\\\": \\\"${{ secrets.GOOGLE_ANALYTICS_ID }}\\\", \\\"rollbarToken\\\": \\\"${{ secrets.ROLLBAR_TOKEN }}\\\", \\\"tmdbApiKey\\\": \\\"${{ secrets.TMDB_API_KEY }}\\\", \\\"chromeExtensionKey\\\": \\\"${{ secrets.CHROME_EXTENSION_KEY }}\\\", \\\"firefoxExtensionId\\\": \\\"${{ secrets.FIREFOX_EXTENSION_ID }}\\\" } }\" >> ./config.json"
- if: github.repository == 'rafaelgssa/traktflix'
name: 'Run build'
run: npm run build-dev
- if: github.repository == 'rafaelgssa/traktflix'
name: 'Zip dist'
run: npm run zip
- name: 'Run tests'
run: xvfb-run npm test
@@ -0,0 +1,52 @@
name: 'Production'

on:
push:
branches:
- master

jobs:
build:
name: 'Build'
runs-on: ubuntu-latest
steps:
- name: 'Checkout master'
uses: actions/checkout@v1
- name: 'Install dependencies'
run: npm ci
- if: github.repository == 'rafaelgssa/traktflix'
name: 'Generate config.json'
run: "echo \"{ \\\"production\\\": { \\\"clientId\\\": \\\"${{ secrets.TRAKT_CLIENT_ID }}\\\", \\\"clientSecret\\\": \\\"${{ secrets.TRAKT_CLIENT_SECRET }}\\\", \\\"analyticsId\\\": \\\"${{ secrets.GOOGLE_ANALYTICS_ID }}\\\", \\\"rollbarToken\\\": \\\"${{ secrets.ROLLBAR_TOKEN }}\\\", \\\"tmdbApiKey\\\": \\\"${{ secrets.TMDB_API_KEY }}\\\", \\\"chromeExtensionKey\\\": \\\"${{ secrets.CHROME_EXTENSION_KEY }}\\\", \\\"firefoxExtensionId\\\": \\\"${{ secrets.FIREFOX_EXTENSION_ID }}\\\" } }\" >> ./config.json"
- if: github.repository == 'rafaelgssa/traktflix'
name: 'Run build'
run: npm run build
- if: github.repository == 'rafaelgssa/traktflix'
name: 'Zip dist'
run: npm run zip
- if: github.repository == 'rafaelgssa/traktflix'
name: 'Generate release'
run: npm run generate-release token=${{ secrets.GITHUB_ACCESS_TOKEN }}
- if: github.repository == 'rafaelgssa/traktflix'
name: 'Upload to Chrome store'
uses: trmcnvn/chrome-addon@v1
with:
extension: ${{ secrets.CHROME_EXTENSION_ID }}
zip: ./dist/chrome.zip
client-id: ${{ secrets.CHROME_CLIENT_ID }}
client-secret: ${{ secrets.CHROME_CLIENT_SECRET }}
refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }}
- if: github.repository == 'rafaelgssa/traktflix'
name: 'Upload to Firefox store'
uses: trmcnvn/firefox-addon@v1
with:
uuid: ${{ secrets.FIREFOX_EXTENSION_ID }}
xpi: ./dist/firefox.zip
manifest: ./browser/build/firefox/manifest.json
api-key: ${{ secrets.FIREFOX_CLIENT_ID }}
api-secret: ${{ secrets.FIREFOX_CLIENT_SECRET }}
- if: github.repository == 'rafaelgssa/traktflix'
name: 'Run tests and send coverage'
run: xvfb-run npm test token=${{ secrets.COVERALLS_TOKEN }}
- if: github.repository != 'rafaelgssa/traktflix'
name: 'Run tests'
run: xvfb-run npm test
@@ -1,20 +1,6 @@
node_modules
temp
.tmp
dist
.sass-cache
app/bower_components
test/bower_components
package
build
*.log
.DS_Store
*.crx
*.pem
coverage
node_modules/
build/
coverage/
dist/
config.json
bext.json
.idea/
extension-*.zip
src.zip
package-lock.json
*.log

This file was deleted.

@@ -19,10 +19,10 @@
</p>

<p align=left">
<a href="https://chrome.google.com/webstore/detail/traktflix/ehlckfimahifadnbecobagimllmbdmde"><img src="https://github.com/tegon/traktflix/raw/master/chrome-badge.png" alt="Get the extension on Chrome"></a>
<a href="https://chrome.google.com/webstore/detail/traktflix/ehlckfimahifadnbecobagimllmbdmde"><img src="https://github.com/tegon/traktflix/raw/master/assets/chrome-badge.png" alt="Get the extension on Chrome"></a>
</p>
<p align=left">
<a href="https://addons.mozilla.org/en-US/firefox/addon/traktflix"><img src="https://github.com/tegon/traktflix/raw/master/firefox-badge.png" alt="Get the extension on Firefox"></a>
<a href="https://addons.mozilla.org/en-US/firefox/addon/traktflix"><img src="https://github.com/tegon/traktflix/raw/master/assets/firefox-badge.png" alt="Get the extension on Firefox"></a>
</p>

### Table of Contents
@@ -102,10 +102,10 @@ The commands above have only been tested on Linux.
### Credits
<h3 align="center">
<a href="https://tegon.github.io/traktflix/">
<img src="https://github.com/tegon/traktflix/raw/master/tmdb-api-logo.png" alt="TMDB" width="150">
<img src="https://github.com/tegon/traktflix/raw/master/assets/tmdb-api-logo.png" alt="TMDB" width="150">
</a>
<a href="https://tegon.github.io/traktflix/">
<img src="https://github.com/tegon/traktflix/raw/master/trakt-api-logo.png" alt="TMDB" width="150">
<img src="https://github.com/tegon/traktflix/raw/master/assets/trakt-api-logo.png" alt="TMDB" width="150">
</a>
</h3>

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -11,6 +11,9 @@
"clientSecret": "{TraktClientSecret}",
"analyticsId": "{GoogleAnalyticsId}",
"rollbarToken": "{RollbarToken}",
"tmdbApiKey": "{TheMovieDatabaseApiKey}"
"tmdbApiKey": "{TheMovieDatabaseApiKey}",
"chromeExtensionId": "",
"chromeExtensionKey": "",
"firefoxExtensionId": ""
}
}
@@ -1,31 +1,19 @@
const fs = require(`fs`);
const gulp = require(`gulp`);
const zip = require(`gulp-zip`);
const generateManifest = require(`./scripts/generateManifest.js`);

gulp.task(`zip-chrome`, () => {
return zipExtension(`chrome`);
});

gulp.task(`zip-firefox`, () => {
return zipExtension(`firefox`);
});
const gulp = require('gulp');
const zip = require('gulp-zip');

function zipExtension(browserName) {
fs.writeFileSync(`./build/manifest.json`, generateManifest(browserName));

return gulp.src([
`build/**`
])
.pipe(zip(`extension-${browserName}.zip`))
.pipe(gulp.dest(`./`));
return gulp.src([`build/${browserName}/**`])
.pipe(zip(`${browserName}.zip`))
.pipe(gulp.dest('./dist'));
}

gulp.task(`zip-src`, () => {
return gulp.src([
`README.md`,
`src/**`
])
.pipe(zip(`src.zip`))
.pipe(gulp.dest(`./`));
});
gulp.task('zip-chrome', () => {
return zipExtension('chrome');
});

gulp.task('zip-firefox', () => {
return zipExtension('firefox');
});

gulp.task('zip', gulp.parallel('zip-chrome', 'zip-firefox'));
@@ -1,32 +1,44 @@
const { getArguments } = require('./scripts/common');

const args = getArguments(process);

module.exports = config => {
let webpackConfig = require(`./webpack.config.js`);
webpackConfig = webpackConfig({ development: true, test: true });
const configuration = {
const webpackConfig = require('./webpack.config.js');

const karmaConfig = {
autoWatch: false,
basePath: '',
browsers: [`Chrome`, `Firefox`],
browsers: ['Chrome', 'Firefox'],
client: {
jasmine: {
random: false
}
},
concurrency: 1,
files: [
`test/**/*.js`
'test/**/*.js'
],
frameworks: [`mocha`, `chai`],
frameworks: ['mocha', 'chai'],
preprocessors: {
[`test/**/*.js`]: [`webpack`]
['test/**/*.js']: ['webpack']
},
singleRun: true,
webpack: webpackConfig
webpack: webpackConfig({
development: true,
test: true
})
};
if (process.env.TRAVIS) {
configuration.reporters = [`progress`, `coverage`];
configuration.coverageReporter = {
dir: `coverage/`,
type: `lcov`

if (args.token) {
karmaConfig.coverallsReporter = {
repoToken: args.token
};
karmaConfig.coverageReporter = {
dir: 'coverage/',
type: 'lcov'
};
karmaConfig.reporters = ['progress', 'coverage', 'coveralls'];
}
config.set(configuration);

config.set(karmaConfig);
};

0 comments on commit d9c99e1

Please sign in to comment.
You can’t perform that action at this time.