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

Commit

Permalink
Update dev dependencies and configure workflows (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelgomesxyz committed Sep 10, 2019
1 parent 0883902 commit d9c99e1
Show file tree
Hide file tree
Showing 24 changed files with 13,353 additions and 412 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/development.yml
@@ -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
52 changes: 52 additions & 0 deletions .github/workflows/production.yml
@@ -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
24 changes: 5 additions & 19 deletions .gitignore
@@ -1,20 +1,6 @@
node_modules node_modules/
temp build/
.tmp coverage/
dist dist/
.sass-cache
app/bower_components
test/bower_components
package
build
*.log
.DS_Store
*.crx
*.pem
coverage
config.json config.json
bext.json *.log
.idea/
extension-*.zip
src.zip
package-lock.json
6 changes: 0 additions & 6 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -19,10 +19,10 @@
</p> </p>


<p align=left"> <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>
<p align=left"> <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> </p>


### Table of Contents ### Table of Contents
Expand Down Expand Up @@ -102,10 +102,10 @@ The commands above have only been tested on Linux.
### Credits ### Credits
<h3 align="center"> <h3 align="center">
<a href="https://tegon.github.io/traktflix/"> <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>
<a href="https://tegon.github.io/traktflix/"> <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> </a>
</h3> </h3>


Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
5 changes: 4 additions & 1 deletion config.dev.json
Expand Up @@ -11,6 +11,9 @@
"clientSecret": "{TraktClientSecret}", "clientSecret": "{TraktClientSecret}",
"analyticsId": "{GoogleAnalyticsId}", "analyticsId": "{GoogleAnalyticsId}",
"rollbarToken": "{RollbarToken}", "rollbarToken": "{RollbarToken}",
"tmdbApiKey": "{TheMovieDatabaseApiKey}" "tmdbApiKey": "{TheMovieDatabaseApiKey}",
"chromeExtensionId": "",
"chromeExtensionKey": "",
"firefoxExtensionId": ""
} }
} }
40 changes: 14 additions & 26 deletions gulpfile.js
@@ -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`, () => { const gulp = require('gulp');
return zipExtension(`chrome`); const zip = require('gulp-zip');
});

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


function zipExtension(browserName) { function zipExtension(browserName) {
fs.writeFileSync(`./build/manifest.json`, generateManifest(browserName)); return gulp.src([`build/${browserName}/**`])

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


gulp.task(`zip-src`, () => { gulp.task('zip-chrome', () => {
return gulp.src([ return zipExtension('chrome');
`README.md`, });
`src/**`
]) gulp.task('zip-firefox', () => {
.pipe(zip(`src.zip`)) return zipExtension('firefox');
.pipe(gulp.dest(`./`)); });
});
gulp.task('zip', gulp.parallel('zip-chrome', 'zip-firefox'));
40 changes: 26 additions & 14 deletions karma.conf.js
@@ -1,32 +1,44 @@
const { getArguments } = require('./scripts/common');

const args = getArguments(process);

module.exports = config => { module.exports = config => {
let webpackConfig = require(`./webpack.config.js`); const webpackConfig = require('./webpack.config.js');
webpackConfig = webpackConfig({ development: true, test: true });
const configuration = { const karmaConfig = {
autoWatch: false, autoWatch: false,
basePath: '', basePath: '',
browsers: [`Chrome`, `Firefox`], browsers: ['Chrome', 'Firefox'],
client: { client: {
jasmine: { jasmine: {
random: false random: false
} }
}, },
concurrency: 1, concurrency: 1,
files: [ files: [
`test/**/*.js` 'test/**/*.js'
], ],
frameworks: [`mocha`, `chai`], frameworks: ['mocha', 'chai'],
preprocessors: { preprocessors: {
[`test/**/*.js`]: [`webpack`] ['test/**/*.js']: ['webpack']
}, },
singleRun: true, singleRun: true,
webpack: webpackConfig webpack: webpackConfig({
development: true,
test: true
})
}; };
if (process.env.TRAVIS) {
configuration.reporters = [`progress`, `coverage`]; if (args.token) {
configuration.coverageReporter = { karmaConfig.coverallsReporter = {
dir: `coverage/`, repoToken: args.token
type: `lcov`
}; };
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.