From 99481ebf71e83cf7c5722f46a31a6d50b5506cfe Mon Sep 17 00:00:00 2001 From: lutangar Date: Mon, 7 Nov 2022 11:38:53 +0100 Subject: [PATCH 01/38] allow to run API without Google passeport --- app.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index 5e2f2f88..a9b7e989 100644 --- a/app.js +++ b/app.js @@ -18,8 +18,6 @@ const session = require('express-session'); const MongoStore = require('connect-mongo')(session); const User = require('./api/models/User'); const Facebook = require('./api/passport/facebook'); -const Google = require('./api/passport/google'); -const GoogleToken = require('./api/passport/googleToken'); const FacebookToken = require('./api/passport/facebookToken'); const morgan = require('morgan'); const config = require('./config'); @@ -106,7 +104,7 @@ swaggerTools.initializeMiddleware(swaggerConfig, async function (middleware) { }) }) ); - + const routerConfig = { controllers: './api/controllers', useStubs: false, @@ -120,8 +118,15 @@ swaggerTools.initializeMiddleware(swaggerConfig, async function (middleware) { app.enable('trust proxy') Facebook.configureFacebookStrategy(app); - Google.configureGoogleStrategy(app); - GoogleToken.configureGoogleTokenStrategy(app); + + if (config.google?.APP_ID) { + const Google = require('./api/passport/google'); + const GoogleToken = require('./api/passport/googleToken'); + + Google.configureGoogleStrategy(app); + GoogleToken.configureGoogleTokenStrategy(app); + } + FacebookToken.configureFacebookTokenStrategy(app); startServer(app); }); From 59a2f4ee9b43c83e4ad94631c72251da60d68021 Mon Sep 17 00:00:00 2001 From: lutangar Date: Mon, 7 Nov 2022 11:39:05 +0100 Subject: [PATCH 02/38] allow to run API without Google analytics --- api/constants/index.js | 4 ---- api/controllers/analytics.js | 8 ++++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/constants/index.js b/api/constants/index.js index be07b854..df356e9f 100644 --- a/api/constants/index.js +++ b/api/constants/index.js @@ -1,7 +1,5 @@ const DEFAULT_LANG = 'en-US'; const DEFAULT_CELL_SIZE = 'medium'; -const DEFAULT_GA_VIEW = '162469865'; -const MOBILE_GA_VIEW = '205673218'; const DEFAULT_FORMAT = 'cboard'; const APP_LANGS = [ 'ar-SA', @@ -51,6 +49,4 @@ module.exports = { DEFAULT_CELL_SIZE: DEFAULT_CELL_SIZE, APP_LANGS: APP_LANGS, DEFAULT_FORMAT: DEFAULT_FORMAT, - DEFAULT_GA_VIEW: DEFAULT_GA_VIEW, - MOBILE_GA_VIEW: MOBILE_GA_VIEW }; diff --git a/api/controllers/analytics.js b/api/controllers/analytics.js index f9436588..0e52d28a 100644 --- a/api/controllers/analytics.js +++ b/api/controllers/analytics.js @@ -3,6 +3,7 @@ const { google } = require('googleapis'); const analyticsreporting = google.analyticsreporting('v4'); const constants = require('../constants'); +const config = require("../../config"); module.exports = { batchGet: batchGet, @@ -20,7 +21,7 @@ async function batchGet(req, res) { try { const reportRequests = req.body.map(requestReport => { const report = { - viewId: requestReport.mobileView ? constants.MOBILE_GA_VIEW : constants.DEFAULT_GA_VIEW, + viewId: requestReport.mobileView ? config.MOBILE_GA_VIEW : config.DEFAULT_GA_VIEW, dateRanges: [ { startDate: requestReport.startDate, @@ -99,4 +100,7 @@ async function userActivity(req, res) { } } -gapiAuth(); \ No newline at end of file + +if (config.MOBILE_GA_VIEW || config.DEFAULT_GA_VIEW) { + gapiAuth(); +} From c4846bd1ebdaf8a4eed3826af562061556d5f24d Mon Sep 17 00:00:00 2001 From: lutangar Date: Mon, 7 Nov 2022 11:37:15 +0100 Subject: [PATCH 03/38] allow to run API without Facebook passeport --- app.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index a9b7e989..ce7fb97d 100644 --- a/app.js +++ b/app.js @@ -17,8 +17,6 @@ const db = require('./db'); const session = require('express-session'); const MongoStore = require('connect-mongo')(session); const User = require('./api/models/User'); -const Facebook = require('./api/passport/facebook'); -const FacebookToken = require('./api/passport/facebookToken'); const morgan = require('morgan'); const config = require('./config'); @@ -117,7 +115,13 @@ swaggerTools.initializeMiddleware(swaggerConfig, async function (middleware) { app.enable('trust proxy') - Facebook.configureFacebookStrategy(app); + if (config.facebook?.APP_ID ) { + const Facebook = require('./api/passport/facebook'); + const FacebookToken = require('./api/passport/facebookToken'); + + Facebook.configureFacebookStrategy(app); + FacebookToken.configureFacebookTokenStrategy(app); + } if (config.google?.APP_ID) { const Google = require('./api/passport/google'); @@ -127,7 +131,6 @@ swaggerTools.initializeMiddleware(swaggerConfig, async function (middleware) { GoogleToken.configureGoogleTokenStrategy(app); } - FacebookToken.configureFacebookTokenStrategy(app); startServer(app); }); From 7172b391e8df7dc018d47053d16c90d7f5b0aca4 Mon Sep 17 00:00:00 2001 From: lutangar Date: Sun, 16 Oct 2022 18:57:30 +0200 Subject: [PATCH 04/38] allow email adresses configuration add default email from to preserve original enb behavior fix cs set default email in config --- .env.defaults | 4 +++- api/controllers/analytics.js | 2 +- api/controllers/user.js | 4 ++-- api/mail/email-verification.js | 17 +++++++++-------- api/mail/index.js | 6 +++--- config/env/development.js | 3 ++- config/env/production.js | 3 ++- 7 files changed, 22 insertions(+), 17 deletions(-) diff --git a/.env.defaults b/.env.defaults index f6c7ae55..95c2dba3 100644 --- a/.env.defaults +++ b/.env.defaults @@ -1,2 +1,4 @@ -GOOGLE_APPLICATION_CREDENTIALS=/opt/cboard-api/google-auth.json \ No newline at end of file +GOOGLE_APPLICATION_CREDENTIALS=/opt/cboard-api/google-auth.json +EMAIL_FROM=cboard@cboard.io +EMAIL_SUPPORT=cboard@cboard.io diff --git a/api/controllers/analytics.js b/api/controllers/analytics.js index 0e52d28a..7f3f32df 100644 --- a/api/controllers/analytics.js +++ b/api/controllers/analytics.js @@ -3,7 +3,7 @@ const { google } = require('googleapis'); const analyticsreporting = google.analyticsreporting('v4'); const constants = require('../constants'); -const config = require("../../config"); +const config = require('../../config'); module.exports = { batchGet: batchGet, diff --git a/api/controllers/user.js b/api/controllers/user.js index 12e3125f..d9d21746 100644 --- a/api/controllers/user.js +++ b/api/controllers/user.js @@ -71,7 +71,7 @@ async function createUser(req, res) { let domain = req.headers.origin; //if origin is private insert default hostname if (!domain) { - domain = 'https://app.cboard.io' + domain = `https://${process.env.APP_DOMAIN}` } nev.sendVerificationEmail(newTempUser.email, domain, URL, function (err, info) { @@ -469,7 +469,7 @@ async function forgotPassword(req, res) { let domain = req.headers.origin; //if origin is private insert default hostname if (!domain) { - domain = 'https://app.cboard.io' + domain = `https://${process.env.APP_DOMAIN}` } nev.sendResetPasswordEmail(user.email, domain, user.id, token, function (err) { diff --git a/api/mail/email-verification.js b/api/mail/email-verification.js index bbd4ded2..de3fb2a1 100644 --- a/api/mail/email-verification.js +++ b/api/mail/email-verification.js @@ -1,7 +1,8 @@ 'use strict'; var randtoken = require('rand-token'), - nodemailer = require('nodemailer'); + nodemailer = require('nodemailer'), + config = require('../../config'); module.exports = function(mongoose) { var isPositiveInteger = function(x) { @@ -43,8 +44,8 @@ module.exports = function(mongoose) { }; // default options var options = { - verificationURL: 'https://app.cboard.io/activate/${URL}', - resetPasswordURL: 'https://app.cboard.io/reset/${USERID}/${URL}', + verificationURL: `https://${process.env.APP_DOMAIN}/activate/\${URL}`, + resetPasswordURL: `https://${process.env.APP_DOMAIN}/reset/\${USERID}/\${URL}`, URLLength: 48, // mongo-stuff @@ -65,7 +66,7 @@ module.exports = function(mongoose) { } }, verifyMailOptions: { - from: 'Do Not Reply ', + from: `Do Not Reply <${config.emailTransport.from}>`, subject: 'Confirm your account', html: '

Please verify your account by clicking this link. If you are unable to do so, copy and ' + @@ -82,7 +83,7 @@ module.exports = function(mongoose) { }, shouldSendConfirmation: true, confirmMailOptions: { - from: 'Do Not Reply', + from: `Do Not Reply<${config.emailTransport.from}>`, subject: 'Successfully verified!', html: '

Your account has been successfully verified.

', text: 'Your account has been successfully verified.' @@ -95,7 +96,7 @@ module.exports = function(mongoose) { } }, resetPasswordEmailOptions: { - from: 'Do Not Reply ', + from: `Do Not Reply <${config.emailTransport.from}>`, subject: 'Cboard - Password reset', html: '

A request was submitted to reset the password of your Cboard account.

\ @@ -110,7 +111,7 @@ module.exports = function(mongoose) { }, hashingFunction: null, reportPublicBoardEmailOptions:{ - from: 'Cboard Support ', + from: `Cboard Support <${config.emailTransport.from}>`, subject: 'Public Board Report', html: '

The user ${whistleblowerName} reported that the board ${name} from the user ${author} contains inappropiate contet.

\ @@ -614,7 +615,7 @@ module.exports = function(mongoose) { .replace('${url}', url) .replace('${reason}', reason) - mailOptions.to = 'support@cboard.io'; + mailOptions.to = config.supportEmail; if (!callback) { callback = options.confirmSendMailReportCallback; } diff --git a/api/mail/index.js b/api/mail/index.js index a6046880..46132863 100644 --- a/api/mail/index.js +++ b/api/mail/index.js @@ -57,20 +57,20 @@ function configNev(locale) { // emailing options transportOptions: config.emailTransport, verifyMailOptions: { - from: 'Do Not Reply ', + from: `Do Not Reply <${config.emailTransport.from}>`, subject: subject, html: html, text: text }, shouldSendConfirmation: true, confirmMailOptions: { - from: 'Do Not Reply ', + from: `Do Not Reply <${config.emailTransport.from}>`, subject: 'Cboard - Successfully verified!', html: '

Your account at Cboard has been successfully verified.

', text: 'Your account at Cboard has been successfully verified.' }, resetPasswordMailOptions: { - from: 'Do Not Reply ', + from: `Do Not Reply <${config.emailTransport.from}>`, subject: 'Cboard - Password reset', html: '

A request was submitted to reset the password of your Cboard account.

\ diff --git a/config/env/development.js b/config/env/development.js index b7a702e3..6f96eb57 100644 --- a/config/env/development.js +++ b/config/env/development.js @@ -5,6 +5,7 @@ const constants = require('../constants'); module.exports = { env: 'development', databaseUrl: process.env.MONGO_URL || 'mongodb://localhost/cboard-api', + supportEmail: process.env.EMAIL_SUPPORT || 'support@cboard.io', session: { secret: process.env.API_SESSION_SECRET || 's3Cur3' }, @@ -36,7 +37,7 @@ module.exports = { ] }, emailTransport: { - from: 'cboard@cboard.io', + from: process.env.EMAIL_FROM || 'cboard@cboard.io', host: 'smtp.sendgrid.net', port: 465, secure: false, diff --git a/config/env/production.js b/config/env/production.js index 86dd4411..2e7b96fb 100644 --- a/config/env/production.js +++ b/config/env/production.js @@ -5,6 +5,7 @@ const constants = require('../constants'); module.exports = { env: 'production', databaseUrl: process.env.MONGO_URL || 'mongodb://localhost/cboard-api', + supportEmail: process.env.EMAIL_SUPPORT || 'support@cboard.io', session: { secret: process.env.API_SESSION_SECRET || 's3Cur3' }, @@ -36,7 +37,7 @@ module.exports = { ] }, emailTransport: { - from: 'cboard@cboard.io', + from: process.env.EMAIL_FROM || 'cboard@cboard.io', host: 'smtp.sendgrid.net', port: 465, secure: false, From 9919c91dc91b2a5a959f1b45c4234647c2c3f714 Mon Sep 17 00:00:00 2001 From: lutangar Date: Mon, 7 Nov 2022 11:39:17 +0100 Subject: [PATCH 05/38] create a simple file storage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows to upload the picture on a the file system if an Azure storage isn't configured. This is a naïve implementation which follows `azure-storage-node` API in order to minimize the impact on the CBoard API codebase. More work should be done to secure the endpoint and only allow images to be uploaded. --- .gitignore | 5 +- api/controllers/user.js | 1 - api/helpers/blob.js | 5 +- api/helpers/file-storage.js | 107 +++++++++++++++++++++++++++++++++ api/mail/email-verification.js | 7 --- app.js | 1 + public/uploads/.gitkeep | 0 7 files changed, 115 insertions(+), 11 deletions(-) create mode 100644 api/helpers/file-storage.js create mode 100644 public/uploads/.gitkeep diff --git a/.gitignore b/.gitignore index c83d1ec0..ff989fbb 100644 --- a/.gitignore +++ b/.gitignore @@ -46,4 +46,7 @@ config/env/production.js *.sln /.vs -test-results.xml \ No newline at end of file +test-results.xml + +# Uploaded images +public/uploads/ diff --git a/api/controllers/user.js b/api/controllers/user.js index d9d21746..b35c15ea 100644 --- a/api/controllers/user.js +++ b/api/controllers/user.js @@ -88,7 +88,6 @@ async function createUser(req, res) { 'An email has been sent to you. Please check it to verify your account.' }); }); - // user already exists in temporary collection! } else { return res.status(409).json({ diff --git a/api/helpers/blob.js b/api/helpers/blob.js index 0010f4ae..c6b5169e 100644 --- a/api/helpers/blob.js +++ b/api/helpers/blob.js @@ -1,8 +1,9 @@ const uuidv1 = require('uuid/v1'); const azure = require('azure-storage'); -const blobService = azure.createBlobService( +const file = require('./file-storage'); +const blobService = process.env.AZURE_STORAGE_CONNECTION_STRING ? azure.createBlobService( process.env.AZURE_STORAGE_CONNECTION_STRING -); +) : file.createBlobService(); module.exports = { createBlockBlobFromText diff --git a/api/helpers/file-storage.js b/api/helpers/file-storage.js new file mode 100644 index 00000000..6a9d3f71 --- /dev/null +++ b/api/helpers/file-storage.js @@ -0,0 +1,107 @@ +const fs = require('fs'); +const path = require('path'); + +// https://github.com/Azure/azure-storage-node/blob/v3.0.100/lib/common/util/util.js#L366-L375 +function normalizeArgs(optionsOrCallback, callback) { + let options = {}; + if (typeof optionsOrCallback === 'function' && !callback) { + callback = optionsOrCallback; + } else if (optionsOrCallback) { + options = optionsOrCallback; + } + + return { callback, options }; +} + +class FileSystemBlobService { + constructor(fileStorageFolder, baseUrl) { + this.fileStorageFolder = fileStorageFolder; + this.baseUrl = baseUrl; + this.fileStoragePath = path.join( + __dirname, + '../../public/', + fileStorageFolder + ); + } + + createContainerIfNotExists(container, optionsOrCallback, callbackArgument) { + const { callback } = normalizeArgs(optionsOrCallback, callbackArgument); + const result = { created: false }; + const response = { isSuccessful: false }; + + fs.mkdir( + this.resolveContainerPath(container), + { recursive: true }, + function(e) { + if (e) { + callback(e, result, response); + } + + result.created = true; + response.isSuccessful = true; + + callback(null, result, response); + } + ); + } + + createBlockBlobFromText( + container, + fileName, + blob, + optionsOrCallback, + callbackArgument + ) { + const { callback } = normalizeArgs(optionsOrCallback, callbackArgument); + + fs.writeFile( + path.join(this.resolveContainerPath(container), fileName), + blob, + e => { + if (e) { + callback(e, {}, {}); + } + const file = { + container, + name: fileName + }; + callback(null, file, {}); + } + ); + } + + getUrl(container, name) { + console.log( + path.join('/', this.fileStorageFolder, container, name), + this.baseUrl + ); + const url = new URL( + path.join('/', this.fileStorageFolder, container, name), + this.baseUrl + ); + return url.href; + } + + resolveContainerPath(container) { + return path.resolve(this.fileStoragePath, container); + } +} + +const createBlobService = () => { + const apiUrl = new URL('http://localhost:10010'); + if (process.env.DEV_ENV_WITH_HTTPS) { + apiUrl.protocol = 'https'; + } + if (process.env.PORT) { + apiUrl.port = process.env.PORT; + } + if (process.env.API_HOST) { + apiUrl.host = process.env.API_HOST; + } + + return new FileSystemBlobService('uploads', apiUrl); +}; + +module.exports = { + createBlobService +}; diff --git a/api/mail/email-verification.js b/api/mail/email-verification.js index de3fb2a1..398b0c3b 100644 --- a/api/mail/email-verification.js +++ b/api/mail/email-verification.js @@ -74,13 +74,6 @@ module.exports = function(mongoose) { text: 'Please verify your account by clicking the following link, or by copying and pasting it into your browser: ${URL}' }, - verifySendMailCallback: function(err, info) { - if (err) { - throw err; - } else { - console.log(info.response); - } - }, shouldSendConfirmation: true, confirmMailOptions: { from: `Do Not Reply<${config.emailTransport.from}>`, diff --git a/app.js b/app.js index ce7fb97d..5a22a89b 100644 --- a/app.js +++ b/app.js @@ -21,6 +21,7 @@ const morgan = require('morgan'); const config = require('./config'); const app = express(); +app.use(express.static('public')); if (config.appInsightConnectionString && config.env === 'production') { appInsights diff --git a/public/uploads/.gitkeep b/public/uploads/.gitkeep new file mode 100644 index 00000000..e69de29b From 3800c8d05d007fa170b54c7aac64a4f7577b20ae Mon Sep 17 00:00:00 2001 From: lutangar Date: Tue, 8 Nov 2022 10:04:36 +0100 Subject: [PATCH 06/38] wip test ci / cd --- .github/workflows/ci.yml | 34 ++++++++++++++++++++ .github/workflows/publish-image.yml | 48 +++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish-image.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..f258b4a0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: Node.js CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run build --if-present + - run: npm test + - name: Run Unitests + run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit + - name: Archive code coverage results + uses: actions/upload-artifact@v3 + with: + name: code-coverage-report + path: ~/junit/test-results.xml diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml new file mode 100644 index 00000000..53acad7a --- /dev/null +++ b/.github/workflows/publish-image.yml @@ -0,0 +1,48 @@ +name: Publish Docker image + +on: + release: + types: [published] + +jobs: + push_to_registries: + name: Push Docker image to multiple registries + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + +# - name: Log in to Docker Hub +# uses: docker/login-action +# with: +# username: ${{ secrets.DOCKER_USERNAME }} +# password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Log in to the Container registry + uses: docker/login-action + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action + with: + images: | + ghcr.io/${{ github.repository }} + +# images: | +# my-docker-hub-namespace/my-docker-hub-repository +# ghcr.io/${{ github.repository }} + + - name: Build and push Docker images + uses: docker/build-push-action + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From dab3466ab4cf0aede9f87233bd7afe199119be20 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 15:19:26 +0100 Subject: [PATCH 07/38] test fix --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f258b4a0..24905a23 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,9 +24,7 @@ jobs: cache: 'npm' - run: npm ci - run: npm run build --if-present - - run: npm test - - name: Run Unitests - run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit + - run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit - name: Archive code coverage results uses: actions/upload-artifact@v3 with: From 92ec053f440770e555e50f357852f14e11f80d83 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 15:21:55 +0100 Subject: [PATCH 08/38] fix test --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24905a23..68a70c8b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,8 +25,8 @@ jobs: - run: npm ci - run: npm run build --if-present - run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit - - name: Archive code coverage results - uses: actions/upload-artifact@v3 - with: - name: code-coverage-report - path: ~/junit/test-results.xml +# - name: Archive code coverage results +# uses: actions/upload-artifact@v3 +# with: +# name: code-coverage-report +# path: ~/junit/test-results.xml From a85d8008817870320c0b5aa32d1442934c773777 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 15:22:27 +0100 Subject: [PATCH 09/38] fix test --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68a70c8b..35b243b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: cache: 'npm' - run: npm ci - run: npm run build --if-present - - run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit +# - run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit # - name: Archive code coverage results # uses: actions/upload-artifact@v3 # with: From 55d55f7233ca93f0959756f46dd611b204fc4fe3 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 15:27:59 +0100 Subject: [PATCH 10/38] is this ? --- .github/workflows/ci.yml | 13 +++++++------ .github/workflows/publish-image.yml | 14 +++++++------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35b243b2..cf30d60c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,9 +24,10 @@ jobs: cache: 'npm' - run: npm ci - run: npm run build --if-present -# - run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit -# - name: Archive code coverage results -# uses: actions/upload-artifact@v3 -# with: -# name: code-coverage-report -# path: ~/junit/test-results.xml + - name: Run Unitests + run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit + - name: Archive code coverage results + uses: actions/upload-artifact@v3 + with: + name: code-coverage-report + path: ~/junit/test-results.xml diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index 53acad7a..89ffe7b2 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -39,10 +39,10 @@ jobs: # my-docker-hub-namespace/my-docker-hub-repository # ghcr.io/${{ github.repository }} - - name: Build and push Docker images - uses: docker/build-push-action - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} +# - name: Build and push Docker images +# uses: docker/build-push-action +# with: +# context: . +# push: true +# tags: ${{ steps.meta.outputs.tags }} +# labels: ${{ steps.meta.outputs.labels }} From f4a94eddaa80d1761a6d6319c5a9134ca3f66b36 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 15:28:07 +0100 Subject: [PATCH 11/38] or that ? --- .github/workflows/publish-image.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index 89ffe7b2..eef5e72b 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -28,12 +28,12 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action - with: - images: | - ghcr.io/${{ github.repository }} +# - name: Extract metadata (tags, labels) for Docker +# id: meta +# uses: docker/metadata-action +# with: +# images: | +# ghcr.io/${{ github.repository }} # images: | # my-docker-hub-namespace/my-docker-hub-repository From f8fb283297b7eb88e4e527da779a28f2e4fccb57 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 15:28:15 +0100 Subject: [PATCH 12/38] or else ? --- .github/workflows/publish-image.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index eef5e72b..96634fe8 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -21,12 +21,12 @@ jobs: # username: ${{ secrets.DOCKER_USERNAME }} # password: ${{ secrets.DOCKER_PASSWORD }} - - name: Log in to the Container registry - uses: docker/login-action - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} +# - name: Log in to the Container registry +# uses: docker/login-action +# with: +# registry: ghcr.io +# username: ${{ github.actor }} +# password: ${{ secrets.GITHUB_TOKEN }} # - name: Extract metadata (tags, labels) for Docker # id: meta From 58125bcb41b0369c3d8dcbf5fc26fbf435f9f11c Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 15:28:50 +0100 Subject: [PATCH 13/38] ok thtat ? --- .github/workflows/publish-image.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index 96634fe8..ee316aa8 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -15,11 +15,11 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 -# - name: Log in to Docker Hub -# uses: docker/login-action -# with: -# username: ${{ secrets.DOCKER_USERNAME }} -# password: ${{ secrets.DOCKER_PASSWORD }} + - name: Log in to Docker Hub + uses: docker/login-action + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} # - name: Log in to the Container registry # uses: docker/login-action From 08488d756d72334e5361e5c94611c5c99903467c Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 15:29:02 +0100 Subject: [PATCH 14/38] or mayber it ? --- .github/workflows/publish-image.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index ee316aa8..a8229967 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -21,12 +21,12 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} -# - name: Log in to the Container registry -# uses: docker/login-action -# with: -# registry: ghcr.io -# username: ${{ github.actor }} -# password: ${{ secrets.GITHUB_TOKEN }} + - name: Log in to the Container registry + uses: docker/login-action + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} # - name: Extract metadata (tags, labels) for Docker # id: meta From 250cc501a1bb1a314af9b5e5939ffe39cd2ef627 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 15:30:14 +0100 Subject: [PATCH 15/38] evnt tat ffailing? --- .github/workflows/publish-image.yml | 31 ----------------------------- 1 file changed, 31 deletions(-) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index a8229967..65ba7e55 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -15,34 +15,3 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Log in to Docker Hub - uses: docker/login-action - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Log in to the Container registry - uses: docker/login-action - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - -# - name: Extract metadata (tags, labels) for Docker -# id: meta -# uses: docker/metadata-action -# with: -# images: | -# ghcr.io/${{ github.repository }} - -# images: | -# my-docker-hub-namespace/my-docker-hub-repository -# ghcr.io/${{ github.repository }} - -# - name: Build and push Docker images -# uses: docker/build-push-action -# with: -# context: . -# push: true -# tags: ${{ steps.meta.outputs.tags }} -# labels: ${{ steps.meta.outputs.labels }} From eb0bad4c325ac37cf06eb6825d0465c3d4364fe6 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 15:31:20 +0100 Subject: [PATCH 16/38] evnt tat ffailing? --- .github/workflows/publish-image.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index 65ba7e55..b1c16180 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -14,4 +14,3 @@ jobs: steps: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - From 05c6322bdf9808ef1b741cfc50ced390d1c95aff Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 15:38:30 +0100 Subject: [PATCH 17/38] change event --- .github/workflows/ci.yml | 4 ++-- .github/workflows/publish-image.yml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf30d60c..c083fc5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,9 @@ name: Node.js CI on: push: - branches: [ main ] + branches: [ interpretable ] pull_request: - branches: [ main ] + branches: [ interpretable ] jobs: build: diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index b1c16180..aced052d 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -3,6 +3,8 @@ name: Publish Docker image on: release: types: [published] + push: + branches: [ publish-image ] jobs: push_to_registries: From 9c6bec134d957f82ceeef7b23db83f9e414cfc5a Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 15:43:16 +0100 Subject: [PATCH 18/38] tet --- .github/workflows/publish-image.yml | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index aced052d..55394c11 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -16,3 +16,35 @@ jobs: steps: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + +# - name: Log in to Docker Hub +# uses: docker/login-action +# with: +# username: ${{ secrets.DOCKER_USERNAME }} +# password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Log in to the Container registry + uses: docker/login-action + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action + with: + images: | + ghcr.io/${{ github.repository }} + +# images: | +# my-docker-hub-namespace/my-docker-hub-repository +# ghcr.io/${{ github.repository }} + + - name: Build and push Docker images + uses: docker/build-push-action + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 277ac3ca18f7cfed06f1b48a2c2000ab1ae3f2bd Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 15:53:29 +0100 Subject: [PATCH 19/38] yarn --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c083fc5c..b9a14b8f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,9 +21,9 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npm ci - - run: npm run build --if-present + cache: 'yarn' + - name: Install dependencies + run: yarn --frozen-lockfile - name: Run Unitests run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit - name: Archive code coverage results From d86bdadcb567cfff5e4be6dc946e0e77d54a94a5 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 16:14:55 +0100 Subject: [PATCH 20/38] expose port --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9a14b8f..0834d2ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,12 @@ jobs: matrix: node-version: [16.x] + services: + mongo: + image: mongo:4.0 + ports: + - 27017:27017 + steps: - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} From 9bc198f1434662aad8eb1abed025961aac430feb Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 16:36:59 +0100 Subject: [PATCH 21/38] without reporeter --- .github/workflows/ci.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0834d2ab..8246739d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: node-version: [16.x] services: - mongo: + mongodb: image: mongo:4.0 ports: - 27017:27017 @@ -30,10 +30,14 @@ jobs: cache: 'yarn' - name: Install dependencies run: yarn --frozen-lockfile + - name: Run Unitests - run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit - - name: Archive code coverage results - uses: actions/upload-artifact@v3 - with: - name: code-coverage-report - path: ~/junit/test-results.xml + run: ./node_modules/.bin/mocha test --recursive --exit + +# - name: Run Unitests +# run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit +# - name: Archive code coverage results +# uses: actions/upload-artifact@v3 +# with: +# name: code-coverage-report +# path: ~/junit/test-results.xml From a684cf22032c21fec78fc3da6471733b050eaf26 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 16:43:17 +0100 Subject: [PATCH 22/38] attempt raise timetout ccli --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8246739d..58fd48bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,9 +30,8 @@ jobs: cache: 'yarn' - name: Install dependencies run: yarn --frozen-lockfile - - name: Run Unitests - run: ./node_modules/.bin/mocha test --recursive --exit + run: ./node_modules/.bin/mocha test --recursive --exit --timeout 10s # - name: Run Unitests # run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit From 342a51963c75a0d7f7a92f1962dc50d117c0a058 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 16:47:17 +0100 Subject: [PATCH 23/38] disable tiemouet --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58fd48bf..bc50e0b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: - name: Install dependencies run: yarn --frozen-lockfile - name: Run Unitests - run: ./node_modules/.bin/mocha test --recursive --exit --timeout 10s + run: ./node_modules/.bin/mocha test --recursive --exit --timeout 0 # - name: Run Unitests # run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit From 043e8717a0881eb7e11979c5a4f15141510f19b4 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 16:56:47 +0100 Subject: [PATCH 24/38] ip info token --- .github/workflows/ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bc50e0b3..9dcd295a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,13 +2,12 @@ name: Node.js CI on: push: - branches: [ interpretable ] + branches: [interpretable] pull_request: - branches: [ interpretable ] + branches: [interpretable] jobs: build: - runs-on: ubuntu-latest strategy: @@ -32,7 +31,7 @@ jobs: run: yarn --frozen-lockfile - name: Run Unitests run: ./node_modules/.bin/mocha test --recursive --exit --timeout 0 - + env: IP_INFO_TOKEN:${{ secrets.IP_INFO_TOKEN }} # - name: Run Unitests # run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit # - name: Archive code coverage results From 005109fb5b41835f77099990f13341496b08eff0 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 16:57:46 +0100 Subject: [PATCH 25/38] remove unltmed tiemout --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9dcd295a..3dee172c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: - name: Install dependencies run: yarn --frozen-lockfile - name: Run Unitests - run: ./node_modules/.bin/mocha test --recursive --exit --timeout 0 + run: ./node_modules/.bin/mocha test --recursive --exit env: IP_INFO_TOKEN:${{ secrets.IP_INFO_TOKEN }} # - name: Run Unitests # run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit From 1bb57c630040b440038efb18ac0bbb682a3c51a7 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 16:58:29 +0100 Subject: [PATCH 26/38] env --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3dee172c..7576ef4d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,8 @@ jobs: run: yarn --frozen-lockfile - name: Run Unitests run: ./node_modules/.bin/mocha test --recursive --exit - env: IP_INFO_TOKEN:${{ secrets.IP_INFO_TOKEN }} + env: + IP_INFO_TOKEN: ${{ secrets.IP_INFO_TOKEN }} # - name: Run Unitests # run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit # - name: Archive code coverage results From 385b115c4c937ebc6bdadd250a04eeccf0735a49 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 17:13:20 +0100 Subject: [PATCH 27/38] ga --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7576ef4d..c245ceea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,8 @@ jobs: run: ./node_modules/.bin/mocha test --recursive --exit env: IP_INFO_TOKEN: ${{ secrets.IP_INFO_TOKEN }} + DEFAULT_GA_VIEW: 162469865 + MOBILE_GA_VIEW: 205673218 # - name: Run Unitests # run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit # - name: Archive code coverage results From 98bf8a7a9ab56ac440c9794a53d31c4c58e23f44 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 17:19:39 +0100 Subject: [PATCH 28/38] humm --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c245ceea..41baae0b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,8 +33,8 @@ jobs: run: ./node_modules/.bin/mocha test --recursive --exit env: IP_INFO_TOKEN: ${{ secrets.IP_INFO_TOKEN }} - DEFAULT_GA_VIEW: 162469865 - MOBILE_GA_VIEW: 205673218 + DEFAULT_GA_VIEW: "162469865" + MOBILE_GA_VIEW: "205673218" # - name: Run Unitests # run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit # - name: Archive code coverage results From b57ad36a63df495a0901e50885cec5197729158f Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 17:20:54 +0100 Subject: [PATCH 29/38] d --- .github/workflows/publish-image.yml | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index 55394c11..134a3d7b 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -29,22 +29,22 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action - with: - images: | - ghcr.io/${{ github.repository }} - +# +# - name: Extract metadata (tags, labels) for Docker +# id: meta +# uses: docker/metadata-action +# with: # images: | -# my-docker-hub-namespace/my-docker-hub-repository # ghcr.io/${{ github.repository }} - - - name: Build and push Docker images - uses: docker/build-push-action - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} +# +## images: | +## my-docker-hub-namespace/my-docker-hub-repository +## ghcr.io/${{ github.repository }} +# +# - name: Build and push Docker images +# uses: docker/build-push-action +# with: +# context: . +# push: true +# tags: ${{ steps.meta.outputs.tags }} +# labels: ${{ steps.meta.outputs.labels }} From 3ffe12147be49e12a234565b31bd9f5c10b938cf Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 17:34:48 +0100 Subject: [PATCH 30/38] dzad --- .github/workflows/ci.yml | 4 ++-- .github/workflows/publish-image.yml | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41baae0b..c245ceea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,8 +33,8 @@ jobs: run: ./node_modules/.bin/mocha test --recursive --exit env: IP_INFO_TOKEN: ${{ secrets.IP_INFO_TOKEN }} - DEFAULT_GA_VIEW: "162469865" - MOBILE_GA_VIEW: "205673218" + DEFAULT_GA_VIEW: 162469865 + MOBILE_GA_VIEW: 205673218 # - name: Run Unitests # run: MOCHA_FILE=~/junit/test-results.xml ./node_modules/.bin/mocha test --recursive --reporter mocha-junit-reporter --exit # - name: Archive code coverage results diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index 134a3d7b..5247545e 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -4,7 +4,7 @@ on: release: types: [published] push: - branches: [ publish-image ] + branches: [publish-image] jobs: push_to_registries: @@ -23,13 +23,13 @@ jobs: # username: ${{ secrets.DOCKER_USERNAME }} # password: ${{ secrets.DOCKER_PASSWORD }} - - name: Log in to the Container registry - uses: docker/login-action - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} -# +# - name: Log in to the Container registry +# uses: docker/login-action +# with: +# registry: ghcr.io +# username: ${{ github.actor }} +# password: ${{ secrets.GITHUB_TOKEN }} + # - name: Extract metadata (tags, labels) for Docker # id: meta # uses: docker/metadata-action From 489f7cda3a866591a674784a22cd94374a3fbc15 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 17:35:22 +0100 Subject: [PATCH 31/38] login --- .github/workflows/publish-image.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index 5247545e..04460d7b 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -17,11 +17,11 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 -# - name: Log in to Docker Hub -# uses: docker/login-action -# with: -# username: ${{ secrets.DOCKER_USERNAME }} -# password: ${{ secrets.DOCKER_PASSWORD }} + - name: Log in to Docker Hub + uses: docker/login-action + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} # - name: Log in to the Container registry # uses: docker/login-action From 0529cb5cf32b40c8cb758f1f6d1f7c47b5e8ad55 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 17:35:37 +0100 Subject: [PATCH 32/38] login 1 --- .github/workflows/publish-image.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index 04460d7b..b60c17a4 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -17,18 +17,18 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Log in to Docker Hub - uses: docker/login-action - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - -# - name: Log in to the Container registry +# - name: Log in to Docker Hub # uses: docker/login-action # with: -# registry: ghcr.io -# username: ${{ github.actor }} -# password: ${{ secrets.GITHUB_TOKEN }} +# username: ${{ secrets.DOCKER_USERNAME }} +# password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Log in to the Container registry + uses: docker/login-action + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} # - name: Extract metadata (tags, labels) for Docker # id: meta From 35566b25b0961c561a30be2057d9ca0e21da775c Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 17:38:07 +0100 Subject: [PATCH 33/38] login 3 --- .github/workflows/publish-image.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index b60c17a4..c4db542e 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -17,18 +17,21 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - + name: Login to Docker Hub + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + # - name: Log in to Docker Hub # uses: docker/login-action # with: # username: ${{ secrets.DOCKER_USERNAME }} # password: ${{ secrets.DOCKER_PASSWORD }} - - name: Log in to the Container registry - uses: docker/login-action - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + # - name: Extract metadata (tags, labels) for Docker # id: meta From 6a5b30270021ac8e65d526eee1e5d0bff49b6243 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 17:39:00 +0100 Subject: [PATCH 34/38] restore --- .github/workflows/publish-image.yml | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index c4db542e..458ebc7b 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -18,7 +18,7 @@ jobs: uses: docker/setup-buildx-action@v2 - - name: Login to Docker Hub + name: Log in to the Container registry uses: docker/login-action@v2 with: registry: ghcr.io @@ -33,21 +33,21 @@ jobs: -# - name: Extract metadata (tags, labels) for Docker -# id: meta -# uses: docker/metadata-action -# with: + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action + with: + images: | + ghcr.io/${{ github.repository }} + # images: | +# my-docker-hub-namespace/my-docker-hub-repository # ghcr.io/${{ github.repository }} -# -## images: | -## my-docker-hub-namespace/my-docker-hub-repository -## ghcr.io/${{ github.repository }} -# -# - name: Build and push Docker images -# uses: docker/build-push-action -# with: -# context: . -# push: true -# tags: ${{ steps.meta.outputs.tags }} -# labels: ${{ steps.meta.outputs.labels }} + + - name: Build and push Docker images + uses: docker/build-push-action + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From be03a64a2d0904ca630c5c8f0946d31552f5bfd0 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 17:40:16 +0100 Subject: [PATCH 35/38] teqs --- .github/workflows/publish-image.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index 458ebc7b..fada66ef 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -31,9 +31,8 @@ jobs: # username: ${{ secrets.DOCKER_USERNAME }} # password: ${{ secrets.DOCKER_PASSWORD }} - - - - name: Extract metadata (tags, labels) for Docker + - + name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action with: @@ -44,7 +43,8 @@ jobs: # my-docker-hub-namespace/my-docker-hub-repository # ghcr.io/${{ github.repository }} - - name: Build and push Docker images + - + name: Build and push Docker images uses: docker/build-push-action with: context: . From e44b4d346bd339e5b4233002fb229a81a11ab82b Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 17:41:41 +0100 Subject: [PATCH 36/38] rly? --- .github/workflows/publish-image.yml | 38 ++++++++++++----------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index fada66ef..e9fea25c 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -17,37 +17,29 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - - name: Log in to the Container registry + - name: Log in to the Container registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} -# - name: Log in to Docker Hub -# uses: docker/login-action +# - name: Extract metadata (tags, labels) for Docker +# id: meta +# uses: docker/metadata-action # with: -# username: ${{ secrets.DOCKER_USERNAME }} -# password: ${{ secrets.DOCKER_PASSWORD }} - - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action - with: - images: | - ghcr.io/${{ github.repository }} +# images: | +# ghcr.io/${{ github.repository }} # images: | # my-docker-hub-namespace/my-docker-hub-repository # ghcr.io/${{ github.repository }} - - - - name: Build and push Docker images - uses: docker/build-push-action - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} +# +# - +# name: Build and push Docker images +# uses: docker/build-push-action +# with: +# context: . +# push: true +# tags: ${{ steps.meta.outputs.tags }} +# labels: ${{ steps.meta.outputs.labels }} From fec8feec8aca2905c390ad4b896bd4f6ea50bc76 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 17:42:39 +0100 Subject: [PATCH 37/38] add veriosn number --- .github/workflows/publish-image.yml | 35 +++++++++++++++++------------ 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index e9fea25c..6ce3ae08 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -24,22 +24,29 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} -# - name: Extract metadata (tags, labels) for Docker -# id: meta -# uses: docker/metadata-action +# - name: Log in to Docker Hub +# uses: docker/login-action@v2 # with: -# images: | -# ghcr.io/${{ github.repository }} +# username: ${{ secrets.DOCKER_USERNAME }} +# password: ${{ secrets.DOCKER_PASSWORD }} + + - + name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ghcr.io/${{ github.repository }} # images: | # my-docker-hub-namespace/my-docker-hub-repository # ghcr.io/${{ github.repository }} -# -# - -# name: Build and push Docker images -# uses: docker/build-push-action -# with: -# context: . -# push: true -# tags: ${{ steps.meta.outputs.tags }} -# labels: ${{ steps.meta.outputs.labels }} + + - + name: Build and push Docker images + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 547a4664b22993f43b8dc48ce155539c24e04034 Mon Sep 17 00:00:00 2001 From: lutangar Date: Wed, 9 Nov 2022 17:47:35 +0100 Subject: [PATCH 38/38] udpate buil verison --- .github/workflows/publish-image.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index 6ce3ae08..a771f84b 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -43,10 +43,9 @@ jobs: # ghcr.io/${{ github.repository }} - - name: Build and push Docker images - uses: docker/build-push-action@v2 + name: Build and push + uses: docker/build-push-action@v3 with: - context: . push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}