From 1da9d430a51de78f88793b1f017d135649a43441 Mon Sep 17 00:00:00 2001 From: ogerly Date: Sat, 10 Apr 2021 17:51:19 +0200 Subject: [PATCH 01/25] fix register --- frontend/src/locales/de.json | 11 +- frontend/src/locales/en.json | 9 +- frontend/src/views/Pages/Register.vue | 159 ++++++++++++++++++++------ 3 files changed, 136 insertions(+), 43 deletions(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 3b9d2e217..8f6975889 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -24,7 +24,7 @@ "sender":"Absender", "firstname":"Vorname", "lastname":"Nachname", - "email":"eMail", + "email":"E-Mail", "email_repeat":"eMail wiederholen", "password":"Passwort", "password_repeat":"Passwort wiederholen", @@ -59,9 +59,12 @@ "signup": { "title": "Erstelle dein Gradido-Konto", "subtitle": "Werde Teil der Gemeinschaft!", - "strength":"Passwortsicherheit:", - "strong":"stark", - "agree":"habe ich gelesen und verstanden und stimme diesen zu." + "agree":"Ich stimme der Datenschutzerklärung zu.", + "lowercase":"Ein Kleinbuchstabe erforderlich.", + "uppercase":"Ein Großbuchstabe erforderlich.", + "minimum":"Mindestens 8 Zeichen.", + "one_number":"Eine Zahl erforderlich.", + "dont_match":"Die Passwörter stimmen nicht überein." }, "password": { "title": "Passwort zurücksetzen", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index d05a9e0d5..849873cae 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -59,9 +59,12 @@ "signup": { "title": "Create your Gradido account", "subtitle": "Become a part of the community!", - "strength":"Password strength:", - "strong":"strong", - "agree":"I have read and understood and agree to them" + "agree":"I agree to the privacy policy.", + "lowercase":"One lowercase letter required.", + "uppercase":"One uppercase letter required.", + "minimum":"8 characters minimum.", + "one_number":"One number required.", + "dont_match":"Passwords don't match." }, "password": { "title": "Reset password", diff --git a/frontend/src/views/Pages/Register.vue b/frontend/src/views/Pages/Register.vue index d207404d2..addafca1d 100755 --- a/frontend/src/views/Pages/Register.vue +++ b/frontend/src/views/Pages/Register.vue @@ -26,52 +26,79 @@ +
+ + + + + + + + + + + + -
- - {{ $t('site.signup.strength') }} - - {{ $t('site.signup.strong') }} - - -
+ :placeholder="$t('form.password_repeat')" + prepend-icon="ni ni-lock-circle-open" + v-model.lazy="checkPassword" + :class="{ valid: passwordValidation.valid }" + /> + + +
+
    +
  • + {{ error }} +
  • +
+
+
+

+ {{ $t('site.signup.dont_match') }} + +

+
+
+ - - - {{ $t('privacy_policy') }} - - - {{ $t('site.signup.agree') }} - + -
+
{{ $t('signup') }} @@ -115,13 +147,32 @@ export default { firstname: '', lastname: '', email: '', - password: '', - password2: '', agree: false, }, + rules: [ + { message: this.$t('site.signup.lowercase'), regex: /[a-z]+/ }, + { message: this.$t('site.signup.uppercase'), regex: /[A-Z]+/ }, + { message: this.$t('site.signup.minimum'), regex: /.{8,}/ }, + { message: this.$t('site.signup.one_number'), regex: /[0-9]+/ }, + ], + password: '', + checkPassword: '', + passwordVisible: false, + submitted: false, } }, methods: { + resetPasswords() { + this.password = '' + this.checkPassword = '' + this.submitted = true + setTimeout(() => { + this.submitted = false + }, 2000) + }, + togglePasswordVisibility() { + this.passwordVisible = !this.passwordVisible + }, onSubmit() { // console.log("this.modals =>", this.modals) this.$store.dispatch('createUser', { @@ -138,6 +189,42 @@ export default { this.$router.push('/thx') }, }, + computed: { + notSamePasswords() { + if (this.passwordsFilled) { + return this.password !== this.checkPassword + } else { + return false + } + }, + passwordsFilled() { + return this.password !== '' && this.checkPassword !== '' + }, + namesFilled() { + return ( + this.model.firstname !== '' && + this.model.firstname.length > 2 && + this.model.lastname !== '' && + this.model.lastname.length > 1 + ) + }, + emailFilled() { + return this.model.email !== '' + }, + passwordValidation() { + let errors = [] + for (let condition of this.rules) { + if (!condition.regex.test(this.password)) { + errors.push(condition.message) + } + } + if (errors.length === 0) { + return { valid: true, errors } + } else { + return { valid: false, errors } + } + }, + }, } From c28910994eeeba1d96d3dc405553455cf031587f Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 14 Apr 2021 23:39:44 +0200 Subject: [PATCH 02/25] implemented @Mogge 's idea to shorten code --- frontend/src/views/Pages/Register.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/views/Pages/Register.vue b/frontend/src/views/Pages/Register.vue index addafca1d..f5b3e817d 100755 --- a/frontend/src/views/Pages/Register.vue +++ b/frontend/src/views/Pages/Register.vue @@ -220,9 +220,8 @@ export default { } if (errors.length === 0) { return { valid: true, errors } - } else { - return { valid: false, errors } } + return { valid: false, errors } }, }, } From e1e92c6ea86af9cd0f2572eb9d1d97c374834f60 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 15 Apr 2021 01:22:31 +0200 Subject: [PATCH 03/25] Pages Register.vue Tests Increase coverage requirement to 11% --- .github/workflows/test.yml | 2 +- frontend/src/views/Pages/Register.spec.js | 107 ++++++++++++++++++++++ frontend/src/views/Pages/Register.vue | 29 ++---- 3 files changed, 117 insertions(+), 21 deletions(-) create mode 100644 frontend/src/views/Pages/Register.spec.js diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 78d381820..e43fd92ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -159,7 +159,7 @@ jobs: with: type: lcov result_path: ./coverage/lcov.info - min_coverage: 10 + min_coverage: 11 token: ${{ github.token }} #test: diff --git a/frontend/src/views/Pages/Register.spec.js b/frontend/src/views/Pages/Register.spec.js new file mode 100644 index 000000000..e9d09a242 --- /dev/null +++ b/frontend/src/views/Pages/Register.spec.js @@ -0,0 +1,107 @@ +import { mount, RouterLinkStub } from '@vue/test-utils' +import Vuex from 'vuex' +import flushPromises from 'flush-promises' + +import Register from './Register' + +const localVue = global.localVue + +describe('Register', () => { + let wrapper + + let mocks = { + $i18n: { + locale: 'en', + }, + $t: jest.fn((t) => t), + } + + let state = { + // loginfail: false, + } + + let store = new Vuex.Store({ + state, + }) + + let stubs = { + RouterLink: RouterLinkStub, + } + + const Wrapper = () => { + return mount(Register, { localVue, mocks, store, stubs }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders the Register form', () => { + expect(wrapper.find('div.register-form').exists()).toBeTruthy() + }) + + describe('Register header', () => { + it('has a welcome message', () => { + expect(wrapper.find('div.header').text()).toBe('site.signup.title site.signup.subtitle') + }) + }) + + describe('links', () => { + it('has a link "Back"', () => { + expect(wrapper.findAllComponents(RouterLinkStub).at(0).text()).toEqual('back') + }) + + it('links to /login when clicking "Back"', () => { + expect(wrapper.findAllComponents(RouterLinkStub).at(0).props().to).toBe('/login') + }) + }) + + describe('Register form', () => { + it('has a register form', () => { + expect(wrapper.find('form').exists()).toBeTruthy() + }) + + it('has 3 text input fields', () => { + expect(wrapper.findAll('input[type="text"]').length).toBe(3) + }) + + it('has 2 password input fields', () => { + expect(wrapper.findAll('input[type="password"]').length).toBe(2) + }) + + it('has 1 checkbox input fields', () => { + expect(wrapper.findAll('input[type="checkbox"]').length).toBe(1) + }) + + it('has no submit button when not completely filled', () => { + expect(wrapper.find('button[type="submit"]').exists()).toBe(false) + }) + + it('shows a warning when no valid Email is entered', async () => { + wrapper.findAll('input[type="text"]').at(2).setValue('no_valid@Email') + await flushPromises() + await expect(wrapper.find('.invalid-feedback').text()).toEqual( + 'The Email field must be a valid email', + ) + }) + + it('shows 4 warnings when no password is set', async () => { + const passwords = wrapper.findAll('input[type="password"]') + passwords.at(0).setValue('') + passwords.at(1).setValue('') + await flushPromises() + await expect(wrapper.find('div.hints').text()).toContain( + 'site.signup.lowercase', + 'site.signup.uppercase', + 'site.signup.minimum', + 'site.signup.one_number', + ) + }) + + // TODO test different invalid password combinations + }) + + // TODO test submit button + }) +}) diff --git a/frontend/src/views/Pages/Register.vue b/frontend/src/views/Pages/Register.vue index f5b3e817d..b651d8144 100755 --- a/frontend/src/views/Pages/Register.vue +++ b/frontend/src/views/Pages/Register.vue @@ -1,5 +1,5 @@ @@ -26,11 +26,15 @@ import { ParticlesBg } from 'particles-bg-vue' import icon from './icon.js' import { localeChanged } from 'vee-validate' +import DashboardLayout from '@/views/Layout/DashboardLayout_gdd.vue' +import AuthLayoutGDD from '@/views/Layout/AuthLayout_gdd.vue' export default { name: 'app', components: { ParticlesBg, + DashboardLayout, + AuthLayoutGDD, }, data() { return { diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index fba892f1a..b50f2a7b1 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -1,66 +1,49 @@ -import DashboardLayout from '@/views/Layout/DashboardLayout_gdd.vue' -import AuthLayoutGDD from '@/views/Layout/AuthLayout_gdd.vue' - import NotFound from '@/views/NotFoundPage.vue' const routes = [ { - path: '/login', - redirect: 'login', - component: AuthLayoutGDD, - children: [ - { - path: '/login', - component: () => import('../views/Pages/Login.vue'), - }, - { - path: '/thx', - component: () => import('../views/Pages/thx.vue'), - }, - { - path: '/register', - component: () => import('../views/Pages/Register.vue'), - }, - { - path: '/password', - component: () => import('../views/Pages/Password.vue'), - }, - { - path: '/explorer', - name: 'Explorer', - component: () => import('../views/Pages/Explorer.vue'), - }, - ], + path: '/overview', + component: () => import('../views/KontoOverview.vue'), + meta: { + requiresAuth: true, + }, }, { - path: '/overview', - redirect: 'overview', - component: DashboardLayout, - children: [ - { - path: '/overview', - component: () => import('../views/KontoOverview.vue'), - meta: { - requiresAuth: true, - }, - }, - { - path: '/profile', - component: () => import('../views/Pages/UserProfileCard.vue'), - }, - { - path: '/profileedit', - component: () => import('../views/Pages/UserProfileEdit.vue'), - }, - { - path: '/activity', - component: () => import('../views/Pages/UserProfileActivity.vue'), - }, - { - path: '/transactions', - component: () => import('../views/Pages/UserProfileTransactionList.vue'), - }, - ], + path: '/profile', + component: () => import('../views/Pages/UserProfileCard.vue'), + }, + { + path: '/profileedit', + component: () => import('../views/Pages/UserProfileEdit.vue'), + }, + { + path: '/activity', + component: () => import('../views/Pages/UserProfileActivity.vue'), + }, + { + path: '/transactions', + component: () => import('../views/Pages/UserProfileTransactionList.vue'), + }, + { + path: '/login', + component: () => import('../views/Pages/Login.vue'), + }, + { + path: '/thx', + component: () => import('../views/Pages/thx.vue'), + }, + { + path: '/register', + component: () => import('../views/Pages/Register.vue'), + }, + { + path: '/password', + component: () => import('../views/Pages/Password.vue'), + }, + { + path: '/explorer', + name: 'Explorer', + component: () => import('../views/Pages/Explorer.vue'), }, { path: '*', component: NotFound }, ] diff --git a/frontend/src/views/Layout/Content.vue b/frontend/src/views/Layout/Content.vue deleted file mode 100755 index d29de692c..000000000 --- a/frontend/src/views/Layout/Content.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js index 3625df05e..269ab2074 100644 --- a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js +++ b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js @@ -97,7 +97,9 @@ describe('DashboardLayoutGdd', () => { // to do: get this working! it.skip('has second item "transactions" linked to transactions in navbar', async () => { + //console.log(wrapper.html()) navbar.findAll('ul > li > a').at(1).trigger('click') + //console.log(wrapper.html()) await flushPromises() await jest.runAllTimers() await flushPromises() From c39f326ebadc23324900cdd7a3f315bf2b3d6495 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 16 Apr 2021 11:42:33 +0200 Subject: [PATCH 07/25] Update frontend/src/views/Layout/DashboardLayout_gdd.spec.js Co-authored-by: Ulf Gebhardt --- frontend/src/views/Layout/DashboardLayout_gdd.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js index 269ab2074..dcbe0d4b6 100644 --- a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js +++ b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js @@ -97,7 +97,6 @@ describe('DashboardLayoutGdd', () => { // to do: get this working! it.skip('has second item "transactions" linked to transactions in navbar', async () => { - //console.log(wrapper.html()) navbar.findAll('ul > li > a').at(1).trigger('click') //console.log(wrapper.html()) await flushPromises() From 94a51691f96a91988c3bfe8893653dff93b0a840 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 16 Apr 2021 11:42:41 +0200 Subject: [PATCH 08/25] Update frontend/src/views/Layout/DashboardLayout_gdd.spec.js Co-authored-by: Ulf Gebhardt --- frontend/src/views/Layout/DashboardLayout_gdd.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js index dcbe0d4b6..3625df05e 100644 --- a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js +++ b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js @@ -98,7 +98,6 @@ describe('DashboardLayoutGdd', () => { // to do: get this working! it.skip('has second item "transactions" linked to transactions in navbar', async () => { navbar.findAll('ul > li > a').at(1).trigger('click') - //console.log(wrapper.html()) await flushPromises() await jest.runAllTimers() await flushPromises() From 49d024c203baa49047a4996ac0f71b0f3e2c5caf Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 16 Apr 2021 12:42:00 +0200 Subject: [PATCH 09/25] adding link to whitepaper in content footer --- frontend/src/locales/de.json | 1 + frontend/src/locales/en.json | 1 + frontend/src/views/Layout/ContentFooter.spec.js | 12 ++++++++++++ frontend/src/views/Layout/ContentFooter.vue | 10 ++++++++++ 4 files changed, 24 insertions(+) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 8f6975889..12c3b6686 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -8,6 +8,7 @@ "imprint":"Impressum", "privacy_policy":"Datenschutzerklärung", "members_area": "Mitgliedsbereich", + "whitepaper": "Zum Whitepaper", "back":"Zurück", "send":"Senden", "transactions":"Transaktionen", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 849873cae..cf13915a3 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -8,6 +8,7 @@ "imprint":"Legal notice", "privacy_policy":"Privacy policy", "members_area": "Member's area", + "whitepaper": "To the whitepaper", "back":"Back", "send":"Send", "transactions":"Transactions", diff --git a/frontend/src/views/Layout/ContentFooter.spec.js b/frontend/src/views/Layout/ContentFooter.spec.js index 1fbdf1c1c..ec4d3ff74 100644 --- a/frontend/src/views/Layout/ContentFooter.spec.js +++ b/frontend/src/views/Layout/ContentFooter.spec.js @@ -92,6 +92,12 @@ describe('ContentFooter', () => { ) }) + it('links to the whitepaper', () => { + expect(wrapper.findAll('a.nav-link').at(3).attributes('href')).toEqual( + 'https://docs.google.com/document/d/1kcX1guOi6tDgnFHD9tf7fB_MneKTx-0nHJxzdN8ygNs/edit?usp=sharing', + ) + }) + describe('links are localized', () => { beforeEach(() => { mocks.$i18n.locale = 'de' @@ -120,6 +126,12 @@ describe('ContentFooter', () => { 'https://elopage.com/s/gradido/sign_in?locale=de', ) }) + + it('links to the German whitepaper when locale is de', () => { + expect(wrapper.findAll('a.nav-link').at(3).attributes('href')).toEqual( + 'https://docs.google.com/document/d/1jZp-DiiMPI9ZPNXmjsvOQ1BtnfDFfx8BX7CDmA8KKjY/edit?usp=sharing', + ) + }) }) }) }) diff --git a/frontend/src/views/Layout/ContentFooter.vue b/frontend/src/views/Layout/ContentFooter.vue index 1ce276f73..b261cafb3 100755 --- a/frontend/src/views/Layout/ContentFooter.vue +++ b/frontend/src/views/Layout/ContentFooter.vue @@ -29,6 +29,16 @@ > {{ $t('members_area') }} + + {{ $t('whitepaper') }} + From 914613cf38acb2d550e189b6e2b04ae9379100e9 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Fri, 16 Apr 2021 13:40:03 +0200 Subject: [PATCH 10/25] update gradido protocol commit --- login_server/src/proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/login_server/src/proto b/login_server/src/proto index ff412f735..924b51c87 160000 --- a/login_server/src/proto +++ b/login_server/src/proto @@ -1 +1 @@ -Subproject commit ff412f735667b30233c0ce00d461f209ac7dde7c +Subproject commit 924b51c87fea29d5aaf053af43251dab44c2eeb7 From e98b35102023d60d97bf9b8474d8010df0fe9395 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Fri, 16 Apr 2021 14:29:03 +0200 Subject: [PATCH 11/25] add Ufls suggested change --- login_server/src/cpp/SingletonManager/PendingTasksManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/login_server/src/cpp/SingletonManager/PendingTasksManager.cpp b/login_server/src/cpp/SingletonManager/PendingTasksManager.cpp index 3c1cdb965..619c6382b 100644 --- a/login_server/src/cpp/SingletonManager/PendingTasksManager.cpp +++ b/login_server/src/cpp/SingletonManager/PendingTasksManager.cpp @@ -193,7 +193,7 @@ void PendingTasksManager::checkForFinishedTasks(Poco::Timer& timer) bool removeIt = false; if (!json.isNull()) { auto state = json->get("state"); - if (!state.isEmpty() && json->get("state").toString() == "success") { + if (!state.isEmpty() && state.toString() == "success") { removeIt = true; } } From 2694004b2e2dca2d0e8acac844e5216b547f2a42 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 16 Apr 2021 15:05:00 +0200 Subject: [PATCH 12/25] Update frontend/src/locales/de.json Co-authored-by: Ulf Gebhardt --- frontend/src/locales/de.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 12c3b6686..0e60a3094 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -8,7 +8,7 @@ "imprint":"Impressum", "privacy_policy":"Datenschutzerklärung", "members_area": "Mitgliedsbereich", - "whitepaper": "Zum Whitepaper", + "whitepaper": "Whitepaper", "back":"Zurück", "send":"Senden", "transactions":"Transaktionen", From ffad2a01303ec127898858710dc47ef7c764b1fd Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 16 Apr 2021 15:05:08 +0200 Subject: [PATCH 13/25] Update frontend/src/locales/en.json Co-authored-by: Ulf Gebhardt --- frontend/src/locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index cf13915a3..1dc703f14 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -8,7 +8,7 @@ "imprint":"Legal notice", "privacy_policy":"Privacy policy", "members_area": "Member's area", - "whitepaper": "To the whitepaper", + "whitepaper": "Whitepaper", "back":"Back", "send":"Send", "transactions":"Transactions", From cf575ba6264867b201516cce1a4d5cfdf06c3214 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 16 Apr 2021 16:10:00 +0200 Subject: [PATCH 14/25] refactor workflows - adjust names - publish community_server - publish login_server - test build & publish nginx - test build & publish mariadb --- .github/workflows/publish.yml | 468 ++++++++++++++++++---------------- .github/workflows/test.yml | 72 +++++- 2 files changed, 308 insertions(+), 232 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7f252fe08..7fa2f64ec 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,38 +2,17 @@ name: gradido publish CI on: push: - branches: - - master + # branches: + # - master jobs: - ############################################################################## - # JOB: PREPARE ############################################################### - ############################################################################## - #prepare: - # name: Prepare - # runs-on: ubuntu-latest - # # needs: [nothing] - # steps: - # ########################################################################## - # # CHECKOUT CODE ########################################################## - # ########################################################################## - # - name: Checkout code - # uses: actions/checkout@v2 - # ########################################################################## - # # TODO: DO STUFF ??? ##################################################### - # ########################################################################## - # - name: Check translation files - # run: | - # scripts/translations/sort.sh - # scripts/translations/missing-keys.sh - ############################################################################## # JOB: DOCKER BUILD COMMUNITY NEO4J ########################################## ############################################################################## build_production_frontend: name: Docker Build Production - Frontend runs-on: ubuntu-latest - #needs: [prepare] [nothing] + #needs: [nothing] steps: ########################################################################## # CHECKOUT CODE ########################################################## @@ -65,116 +44,152 @@ jobs: path: /tmp/frontend.tar ############################################################################## - # JOB: DOCKER BUILD PRODUCTION BACKEND ####################################### + # JOB: DOCKER BUILD PRODUCTION LOGIN SERVER ################################## ############################################################################## - #build_production_backend: - # name: Docker Build Production - Backend - # runs-on: ubuntu-latest - # needs: [prepare] - # steps: - # ########################################################################## - # # CHECKOUT CODE ########################################################## - # ########################################################################## - # - name: Checkout code - # uses: actions/checkout@v2 - # ########################################################################## - # # SET ENVS ############################################################### - # ########################################################################## - # - name: ENV - VERSION - # run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV - # - name: ENV - BUILD_DATE - # run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV - # - name: ENV - BUILD_VERSION - # run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - # - name: ENV - BUILD_COMMIT - # run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV - # ########################################################################## - # # BUILD BACKEND DOCKER IMAGE (production) ################################ - # ########################################################################## - # - name: backend | Build `production` image - # run: | - # docker build --target production -t "ocelotsocialnetwork/backend:latest" -t "ocelotsocialnetwork/backend:${VERSION}" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" backend/ - # docker save "ocelotsocialnetwork/backend" > /tmp/backend.tar - # - name: Upload Artifact - # uses: actions/upload-artifact@v2 - # with: - # name: docker-backend-production - # path: /tmp/backend.tar + build_production_login_server: + name: Docker Build Production - Login Server + runs-on: ubuntu-latest + #needs: [nothing] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v2 + ########################################################################## + # SET ENVS ############################################################### + ########################################################################## + - name: ENV - VERSION + run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV + - name: ENV - BUILD_DATE + run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + - name: ENV - BUILD_VERSION + run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV + - name: ENV - BUILD_COMMIT + run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV + ########################################################################## + # LOGIN SERVER ########################################################### + ########################################################################## + - name: Login Server | Build `production` image + run: | + docker build -t "gradido/login_server:latest" -t "gradido/login_server:production" -t "gradido/login_server:${VERSION}" -t "gradido/login_server:${BUILD_VERSION}" login_server/ + docker save "gradido/login_server" > /tmp/login_server.tar + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: docker-login-server-production + path: /tmp/login_server.tar ############################################################################## - # JOB: DOCKER BUILD PRODUCTION WEBAPP ######################################## + # JOB: DOCKER BUILD PRODUCTION COMMUNITY SERVER ############################## ############################################################################## - #build_production_webapp: - # name: Docker Build Production - WebApp - # runs-on: ubuntu-latest - # needs: [prepare] - # steps: - # ########################################################################## - # # CHECKOUT CODE ########################################################## - # ########################################################################## - # - name: Checkout code - # uses: actions/checkout@v2 - # ########################################################################## - # # SET ENVS ############################################################### - # ########################################################################## - # - name: ENV - VERSION - # run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV - # - name: ENV - BUILD_DATE - # run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV - # - name: ENV - BUILD_VERSION - # run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - # - name: ENV - BUILD_COMMIT - # run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV - # ########################################################################## - # # BUILD WEBAPP DOCKER IMAGE (build) ###################################### - # ########################################################################## - # - name: webapp | Build `production` image - # run: | - # docker build --target production -t "ocelotsocialnetwork/webapp:latest" -t "ocelotsocialnetwork/webapp:${VERSION}" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" webapp/ - # docker save "ocelotsocialnetwork/webapp" > /tmp/webapp.tar - # - name: Upload Artifact - # uses: actions/upload-artifact@v2 - # with: - # name: docker-webapp-production - # path: /tmp/webapp.tar + build_production_community_server: + name: Docker Build Production - Community Server + runs-on: ubuntu-latest + #needs: [nothing] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v2 + ########################################################################## + # SET ENVS ############################################################### + ########################################################################## + - name: ENV - VERSION + run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV + - name: ENV - BUILD_DATE + run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + - name: ENV - BUILD_VERSION + run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV + - name: ENV - BUILD_COMMIT + run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV + ########################################################################## + # COMMUNITY SERVER ####################################################### + ########################################################################## + - name: Community Server | Build `production` image + run: | + docker build -t "gradido/community_server:latest" -t "gradido/community_server:production" -t "gradido/community_server:${VERSION}" -t "gradido/community_server:${BUILD_VERSION}" community_server/ + docker save "gradido/community_server" > /tmp/community_server.tar + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: docker-community-server-production + path: /tmp/community_server.tar ############################################################################## - # JOB: DOCKER BUILD PRODUCTION MAINTENANCE ################################### + # JOB: DOCKER BUILD PRODUCTION MARIADB ####################################### ############################################################################## - #build_production_maintenance: - # name: Docker Build Production - Maintenance - # runs-on: ubuntu-latest - # needs: [prepare] - # steps: - # ########################################################################## - # # CHECKOUT CODE ########################################################## - # ########################################################################## - # - name: Checkout code - # uses: actions/checkout@v2 - # ########################################################################## - # # SET ENVS ############################################################### - # ########################################################################## - # - name: ENV - VERSION - # run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV - # - name: ENV - BUILD_DATE - # run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV - # - name: ENV - BUILD_VERSION - # run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - # - name: ENV - BUILD_COMMIT - # run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV - # ########################################################################## - # # BUILD MAINTENANCE DOCKER IMAGE (build) ################################# - # ########################################################################## - # - name: maintenance | Build `production` image - # # TODO: --target production - # run: | - # docker build -t "ocelotsocialnetwork/maintenance:latest" -t "ocelotsocialnetwork/maintenance:${VERSION}" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" webapp/ -f webapp/Dockerfile.maintenance - # docker save "ocelotsocialnetwork/maintenance" > /tmp/maintenance.tar - # - name: Upload Artifact - # uses: actions/upload-artifact@v2 - # with: - # name: docker-maintenance-production - # path: /tmp/maintenance.tar + build_production_mariadb: + name: Docker Build Production - MariaDB + runs-on: ubuntu-latest + #needs: [nothing] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v2 + ########################################################################## + # SET ENVS ############################################################### + ########################################################################## + - name: ENV - VERSION + run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV + - name: ENV - BUILD_DATE + run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + - name: ENV - BUILD_VERSION + run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV + - name: ENV - BUILD_COMMIT + run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV + ########################################################################## + # MARIADB ################################################################ + ########################################################################## + - name: MariaDB | Build `production` image + run: | + docker build -t "gradido/mariadb:latest" -t "gradido/mariadb:production" -t "gradido/mariadb:${VERSION}" -t "gradido/mariadb:${BUILD_VERSION}" -f ./mariadb/Dockerfile ./ + docker save "gradido/mariadb" > /tmp/mariadb.tar + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: docker-mariadb-production + path: /tmp/mariadb.tar + + ############################################################################## + # JOB: DOCKER BUILD PRODUCTION NGINX ######################################### + ############################################################################## + build_production_nginx: + name: Docker Build Production - Nginx + runs-on: ubuntu-latest + #needs: [nothing] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v2 + ########################################################################## + # SET ENVS ############################################################### + ########################################################################## + - name: ENV - VERSION + run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV + - name: ENV - BUILD_DATE + run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + - name: ENV - BUILD_VERSION + run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV + - name: ENV - BUILD_COMMIT + run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV + ########################################################################## + # NGINX ################################################################## + ########################################################################## + - name: Nginx | Build `production` image + run: | + docker build -t "gradido/nginx:latest" -t "gradido/nginx:production" -t "gradido/nginx:${VERSION}" -t "gradido/nginx:${BUILD_VERSION}" -f ./nginx/Dockerfile ./ + docker save "gradido/nginx" > /tmp/nginx.tar + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: docker-nginx-production + path: /tmp/nginx.tar ############################################################################## # JOB: UPLOAD TO DOCKERHUB ################################################### @@ -202,27 +217,34 @@ jobs: path: /tmp - name: Load Docker Image run: docker load < /tmp/frontend.tar - #- name: Download Docker Image (Backend) - # uses: actions/download-artifact@v2 - # with: - # name: docker-backend-production - # path: /tmp - #- name: Load Docker Image - # run: docker load < /tmp/backend.tar - #- name: Download Docker Image (WebApp) - # uses: actions/download-artifact@v2 - # with: - # name: docker-webapp-production - # path: /tmp - #- name: Load Docker Image - # run: docker load < /tmp/webapp.tar - #- name: Download Docker Image (Maintenance) - # uses: actions/download-artifact@v2 - # with: - # name: docker-maintenance-production - # path: /tmp - #- name: Load Docker Image - # run: docker load < /tmp/maintenance.tar + - name: Download Docker Image (Login Server) + uses: actions/download-artifact@v2 + with: + name: docker-login-server-production + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/login_server.tar + - name: Download Docker Image (Community Server) + uses: actions/download-artifact@v2 + with: + name: docker-community-server-production + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/community_server.tar + - name: Download Docker Image (MariaDB) + uses: actions/download-artifact@v2 + with: + name: docker-mariadb-production + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/mariadb.tar + - name: Download Docker Image (Nginx) + uses: actions/download-artifact@v2 + with: + name: docker-nginx-production + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/nginx.tar ########################################################################## # Upload ################################################################# ########################################################################## @@ -230,78 +252,80 @@ jobs: run: echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin - name: Push frontend run: docker push --all-tags gradido/frontend - #- name: Push backend - # run: docker push --all-tags ocelotsocialnetwork/backend - #- name: Push webapp - # run: docker push --all-tags ocelotsocialnetwork/webapp - #- name: Push maintenance - # run: docker push --all-tags ocelotsocialnetwork/maintenance + - name: Push login_server + run: docker push --all-tags gradido/login_server + - name: Push community_server + run: docker push --all-tags gradido/community_server + - name: Push MariaDB + run: docker push --all-tags gradido/mariadb + - name: Push Nginx + run: docker push --all-tags gradido/nginx - ############################################################################## - # JOB: GITHUB TAG LATEST VERSION ############################################# - ############################################################################## - github_tag: - name: Tag latest version on Github - runs-on: ubuntu-latest - needs: [upload_to_dockerhub] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Fetch full History for changelog - ########################################################################## - # SET ENVS ############################################################### - ########################################################################## - - name: ENV - VERSION - run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV - - name: ENV - BUILD_DATE - run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV - - name: ENV - BUILD_VERSION - run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - - name: ENV - BUILD_COMMIT - run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV - ########################################################################## - # Push version tag to GitHub ############################################# - ########################################################################## - # TODO: this will error on duplicate - #- name: package-version-to-git-tag - # uses: pkgdeps/git-tag-action@v2 - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # github_repo: ${{ github.repository }} - # version: ${{ env.VERSION }} - # git_commit_sha: ${{ github.sha }} - # git_tag_prefix: "v" - ########################################################################## - # Push build tag to GitHub ############################################### - ########################################################################## - - name: package-version-to-git-tag + build number - uses: pkgdeps/git-tag-action@v2 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - github_repo: ${{ github.repository }} - version: ${{ env.BUILD_VERSION }} - git_commit_sha: ${{ github.sha }} - git_tag_prefix: "b" - ########################################################################## - # Push release tag to GitHub ############################################# - ########################################################################## - - name: yarn install - run: yarn install - - name: generate changelog - run: yarn auto-changelog --latest-version ${{ env.VERSION }} --unreleased-only - - name: package-version-to-git-release - continue-on-error: true # Will fail if tag exists - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: ${{ env.VERSION }} - release_name: ${{ env.VERSION }} - body_path: ./CHANGELOG.md - draft: false - prerelease: false \ No newline at end of file +# # JOB: GITHUB TAG LATEST VERSION ############################################# +# ############################################################################## +# ############################################################################## +# github_tag: +# name: Tag latest version on Github +# runs-on: ubuntu-latest +# needs: [upload_to_dockerhub] +# steps: +# ########################################################################## +# # CHECKOUT CODE ########################################################## +# ########################################################################## +# - name: Checkout code +# uses: actions/checkout@v2 +# with: +# fetch-depth: 0 # Fetch full History for changelog +# ########################################################################## +# # SET ENVS ############################################################### +# ########################################################################## +# - name: ENV - VERSION +# run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV +# - name: ENV - BUILD_DATE +# run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV +# - name: ENV - BUILD_VERSION +# run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV +# - name: ENV - BUILD_COMMIT +# run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV +# ########################################################################## +# # Push version tag to GitHub ############################################# +# ########################################################################## +# # TODO: this will error on duplicate +# #- name: package-version-to-git-tag +# # uses: pkgdeps/git-tag-action@v2 +# # with: +# # github_token: ${{ secrets.GITHUB_TOKEN }} +# # github_repo: ${{ github.repository }} +# # version: ${{ env.VERSION }} +# # git_commit_sha: ${{ github.sha }} +# # git_tag_prefix: "v" +# ########################################################################## +# # Push build tag to GitHub ############################################### +# ########################################################################## +# - name: package-version-to-git-tag + build number +# uses: pkgdeps/git-tag-action@v2 +# with: +# github_token: ${{ secrets.GITHUB_TOKEN }} +# github_repo: ${{ github.repository }} +# version: ${{ env.BUILD_VERSION }} +# git_commit_sha: ${{ github.sha }} +# git_tag_prefix: "b" +# ########################################################################## +# # Push release tag to GitHub ############################################# +# ########################################################################## +# - name: yarn install +# run: yarn install +# - name: generate changelog +# run: yarn auto-changelog --latest-version ${{ env.VERSION }} --unreleased-only +# - name: package-version-to-git-release +# continue-on-error: true # Will fail if tag exists +# id: create_release +# uses: actions/create-release@v1 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token +# with: +# tag_name: ${{ env.VERSION }} +# release_name: ${{ env.VERSION }} +# body_path: ./CHANGELOG.md +# draft: false +# prerelease: false \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e43fd92ee..1a591db60 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,17 +46,17 @@ jobs: with: submodules: recursive ########################################################################## - # BUILD LOGIN SERVER DOCKER IMAGE (build) ################################ + # BUILD LOGIN SERVER DOCKER IMAGE ######################################## ########################################################################## - name: login server | Build `test` image run: | - docker build --target login_server_debug -t "gradido/loginserver:test" -f ./login_server/Dockerfile.debug login_server/ - docker save "gradido/loginserver:test" > /tmp/loginserver.tar + docker build --target login_server_debug -t "gradido/login_server:test" -f ./login_server/Dockerfile.debug login_server/ + docker save "gradido/login_server:test" > /tmp/login_server.tar - name: Upload Artifact uses: actions/upload-artifact@v2 with: - name: docker-loginserver-test - path: /tmp/loginserver.tar + name: docker-login-server-test + path: /tmp/login_server.tar ############################################################################## # JOB: DOCKER BUILD TEST COMMUNITY SERVER #################################### @@ -72,17 +72,69 @@ jobs: - name: Checkout code uses: actions/checkout@v2 ########################################################################## - # BUILD COMMUNITY SERVER DOCKER IMAGE (build) ############################ + # BUILD COMMUNITY SERVER DOCKER IMAGE #################################### ########################################################################## - name: community server | Build `test` image run: | - docker build -t "gradido/communityserver:test" -f ./community_server/Dockerfile ./ - docker save "gradido/communityserver:test" > /tmp/communityserver.tar + docker build -t "gradido/community_server:test" -f ./community_server/Dockerfile ./ + docker save "gradido/community_server:test" > /tmp/community_server.tar - name: Upload Artifact uses: actions/upload-artifact@v2 with: - name: docker-communityserver-test - path: /tmp/communityserver.tar + name: docker-community-server-test + path: /tmp/community_server.tar + + ############################################################################## + # JOB: DOCKER BUILD TEST MARIADB ############################################# + ############################################################################## + build_test_mariadb: + name: Docker Build Test - MariaDB + runs-on: ubuntu-latest + #needs: [nothing] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v2 + ########################################################################## + # BUILD MARIADB DOCKER IMAGE ############################################# + ########################################################################## + - name: mariadb | Build `test` image + run: | + docker build -t "gradido/mariadb:test" -f ./mariadb/Dockerfile ./ + docker save "gradido/mariadb:test" > /tmp/mariadb.tar + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: docker-mariadb-test + path: /tmp/mariadb.tar + + ############################################################################## + # JOB: DOCKER BUILD TEST NGINX ############################################### + ############################################################################## + build_test_nginx: + name: Docker Build Test - Nginx + runs-on: ubuntu-latest + #needs: [nothing] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v2 + ########################################################################## + # BUILD NGINX DOCKER IMAGE ############################################# + ########################################################################## + - name: nginx | Build `test` image + run: | + docker build -t "gradido/nginx:test" -f ./nginx/Dockerfile ./ + docker save "gradido/nginx:test" > /tmp/nginx.tar + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: docker-nginx-test + path: /tmp/nginx.tar ############################################################################## # JOB: LINT FRONTEND ######################################################### From ef70f1bfeff4127fb4907c457ffaac5689026b4e Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 16 Apr 2021 16:18:09 +0200 Subject: [PATCH 15/25] fixes: - checkout submodules for login server - run docker build for community server in main folder --- .github/workflows/publish.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7fa2f64ec..88e5312ef 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -56,6 +56,8 @@ jobs: ########################################################################## - name: Checkout code uses: actions/checkout@v2 + with: + submodules: recursive ########################################################################## # SET ENVS ############################################################### ########################################################################## @@ -109,7 +111,7 @@ jobs: ########################################################################## - name: Community Server | Build `production` image run: | - docker build -t "gradido/community_server:latest" -t "gradido/community_server:production" -t "gradido/community_server:${VERSION}" -t "gradido/community_server:${BUILD_VERSION}" community_server/ + docker build -t "gradido/community_server:latest" -t "gradido/community_server:production" -t "gradido/community_server:${VERSION}" -t "gradido/community_server:${BUILD_VERSION}" -f ./community_server/Dockerfile ./ docker save "gradido/community_server" > /tmp/community_server.tar - name: Upload Artifact uses: actions/upload-artifact@v2 From 8382abbd2d9f732e665b807c5deade3c1222f348 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 16 Apr 2021 16:20:02 +0200 Subject: [PATCH 16/25] proper dependencies in dockerhub publish --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 88e5312ef..548f4798f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -199,7 +199,7 @@ jobs: upload_to_dockerhub: name: Upload to Dockerhub runs-on: ubuntu-latest - needs: [build_production_frontend] + needs: [build_production_frontend, build_production_login_server, build_production_community_server, build_production_mariadb, build_production_nginx] env: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} From 8573a8568fe6ad4daebad0f322090d13f220b87a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 16 Apr 2021 16:38:12 +0200 Subject: [PATCH 17/25] fixed login_server/Dockerfile --- login_server/Dockerfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/login_server/Dockerfile b/login_server/Dockerfile index 7d51a7ca4..851ad7faf 100644 --- a/login_server/Dockerfile +++ b/login_server/Dockerfile @@ -19,12 +19,12 @@ WORKDIR ${DOCKER_WORKDIR} COPY . . #RUN git submodule update --init --recursive RUN ls -la -RUN cd dependencies/iroha-ed25519 && \ - ls -la && \ - mkdir build && \ - cd build && \ - cmake .. -DEDIMPL=ref10 -DHASH=sha2_sphlib -DRANDOM=bcryptgen -DBUILD=STATIC && \ - make -j$(nproc) +# RUN cd dependencies/iroha-ed25519 && \ +# ls -la && \ +# mkdir build && \ +# cd build && \ +# cmake .. -DEDIMPL=ref10 -DHASH=sha2_sphlib -DRANDOM=bcryptgen -DBUILD=STATIC && \ +# make -j$(nproc) RUN cd dependencies/mariadb-connector-c && \ mkdir build && \ From cd1078407cf02bced84c6b63a5053399cb607aef Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Fri, 16 Apr 2021 17:17:37 +0200 Subject: [PATCH 18/25] fix linting error --- frontend/src/apis/communityAPI.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/apis/communityAPI.js b/frontend/src/apis/communityAPI.js index 1c90163d3..fb8696949 100644 --- a/frontend/src/apis/communityAPI.js +++ b/frontend/src/apis/communityAPI.js @@ -36,7 +36,9 @@ const communityAPI = { return apiGet(CONFIG.COMMUNITY_API_STATE_BALANCE_URL + 'getBalance/' + session_id) }, transactions: async (session_id) => { - return apiGet(CONFIG.COMMUNITY_API_STATE_BALANCE_URL + 'listTransactions/1/25/ASC/' + session_id) + return apiGet( + CONFIG.COMMUNITY_API_STATE_BALANCE_URL + 'listTransactions/1/25/ASC/' + session_id, + ) }, /*create: async (session_id, email, amount, memo, target_date = new Date() ) => { const payload = { From adb2635691fc46f3356f3245ae0e6a720929f723 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Fri, 16 Apr 2021 20:08:42 +0200 Subject: [PATCH 19/25] fix login server docker release build --- login_server/Dockerfile | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/login_server/Dockerfile b/login_server/Dockerfile index 851ad7faf..e6c2d6b89 100644 --- a/login_server/Dockerfile +++ b/login_server/Dockerfile @@ -1,47 +1,36 @@ ######################################################################################################### # Build release ######################################################################################################### -From conanio/gcc7 as release +From conanio/gcc9 as release ENV DOCKER_WORKDIR="/code" USER root -COPY --from=unicorny/protoc:3.9.1 /usr/bin/protoc /usr/bin/ -COPY --from=unicorny/protoc:3.9.1 /usr/lib/libprotobuf.so.20 /usr/lib/libprotobuf.so.20 -COPY --from=unicorny/protoc:3.9.1 /usr/lib/libprotoc.so.20 /usr/lib/libprotoc.so.20 -COPY --from=unicorny/protoc:3.9.1 /usr/include/google/protobuf/* /usr/include/google/protobuf/ - RUN mkdir -p ${DOCKER_WORKDIR} WORKDIR ${DOCKER_WORKDIR} COPY . . -#RUN git submodule update --init --recursive -RUN ls -la -# RUN cd dependencies/iroha-ed25519 && \ -# ls -la && \ -# mkdir build && \ -# cd build && \ -# cmake .. -DEDIMPL=ref10 -DHASH=sha2_sphlib -DRANDOM=bcryptgen -DBUILD=STATIC && \ -# make -j$(nproc) RUN cd dependencies/mariadb-connector-c && \ mkdir build && \ cd build && \ cmake -DWITH_SSL=OFF .. -RUN chmod +x compile_proto.sh -RUN chmod +x compile_pot.sh -RUN ls -la -RUN ./compile_pot.sh -RUN ./compile_proto.sh +RUN chmod +x compile_pot.sh && ./compile_pot.sh + RUN mkdir build && \ cd build && \ conan install .. --build=missing && \ cmake .. && \ - make -j$(nproc) Gradido_LoginServer + make -j$(nproc) protoc grpc_cpp_plugin +RUN chmod +x unix_parse_proto.sh && ./unix_parse_proto.sh + +RUN cd build && \ + cmake .. && \ + make -j$(nproc) Gradido_LoginServer CMD ["./code"] From f002c8dba1d390961020966c24d5fcce348a0589 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 16 Apr 2021 20:58:58 +0200 Subject: [PATCH 20/25] made the publish workflow only run on master enabled tagging again --- .github/workflows/publish.yml | 140 +++++++++++++++++----------------- 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 548f4798f..66bc2bbf8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,8 +2,8 @@ name: gradido publish CI on: push: - # branches: - # - master + branches: + - master jobs: ############################################################################## @@ -263,71 +263,71 @@ jobs: - name: Push Nginx run: docker push --all-tags gradido/nginx -# # JOB: GITHUB TAG LATEST VERSION ############################################# -# ############################################################################## -# ############################################################################## -# github_tag: -# name: Tag latest version on Github -# runs-on: ubuntu-latest -# needs: [upload_to_dockerhub] -# steps: -# ########################################################################## -# # CHECKOUT CODE ########################################################## -# ########################################################################## -# - name: Checkout code -# uses: actions/checkout@v2 -# with: -# fetch-depth: 0 # Fetch full History for changelog -# ########################################################################## -# # SET ENVS ############################################################### -# ########################################################################## -# - name: ENV - VERSION -# run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV -# - name: ENV - BUILD_DATE -# run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV -# - name: ENV - BUILD_VERSION -# run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV -# - name: ENV - BUILD_COMMIT -# run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV -# ########################################################################## -# # Push version tag to GitHub ############################################# -# ########################################################################## -# # TODO: this will error on duplicate -# #- name: package-version-to-git-tag -# # uses: pkgdeps/git-tag-action@v2 -# # with: -# # github_token: ${{ secrets.GITHUB_TOKEN }} -# # github_repo: ${{ github.repository }} -# # version: ${{ env.VERSION }} -# # git_commit_sha: ${{ github.sha }} -# # git_tag_prefix: "v" -# ########################################################################## -# # Push build tag to GitHub ############################################### -# ########################################################################## -# - name: package-version-to-git-tag + build number -# uses: pkgdeps/git-tag-action@v2 -# with: -# github_token: ${{ secrets.GITHUB_TOKEN }} -# github_repo: ${{ github.repository }} -# version: ${{ env.BUILD_VERSION }} -# git_commit_sha: ${{ github.sha }} -# git_tag_prefix: "b" -# ########################################################################## -# # Push release tag to GitHub ############################################# -# ########################################################################## -# - name: yarn install -# run: yarn install -# - name: generate changelog -# run: yarn auto-changelog --latest-version ${{ env.VERSION }} --unreleased-only -# - name: package-version-to-git-release -# continue-on-error: true # Will fail if tag exists -# id: create_release -# uses: actions/create-release@v1 -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token -# with: -# tag_name: ${{ env.VERSION }} -# release_name: ${{ env.VERSION }} -# body_path: ./CHANGELOG.md -# draft: false -# prerelease: false \ No newline at end of file + # JOB: GITHUB TAG LATEST VERSION ############################################# + ############################################################################## + ############################################################################## + github_tag: + name: Tag latest version on Github + runs-on: ubuntu-latest + needs: [upload_to_dockerhub] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 # Fetch full History for changelog + ########################################################################## + # SET ENVS ############################################################### + ########################################################################## + - name: ENV - VERSION + run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV + - name: ENV - BUILD_DATE + run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + - name: ENV - BUILD_VERSION + run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV + - name: ENV - BUILD_COMMIT + run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV + ########################################################################## + # Push version tag to GitHub ############################################# + ########################################################################## + # TODO: this will error on duplicate + #- name: package-version-to-git-tag + # uses: pkgdeps/git-tag-action@v2 + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # github_repo: ${{ github.repository }} + # version: ${{ env.VERSION }} + # git_commit_sha: ${{ github.sha }} + # git_tag_prefix: "v" + ########################################################################## + # Push build tag to GitHub ############################################### + ########################################################################## + - name: package-version-to-git-tag + build number + uses: pkgdeps/git-tag-action@v2 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + github_repo: ${{ github.repository }} + version: ${{ env.BUILD_VERSION }} + git_commit_sha: ${{ github.sha }} + git_tag_prefix: "b" + ########################################################################## + # Push release tag to GitHub ############################################# + ########################################################################## + - name: yarn install + run: yarn install + - name: generate changelog + run: yarn auto-changelog --latest-version ${{ env.VERSION }} --unreleased-only + - name: package-version-to-git-release + continue-on-error: true # Will fail if tag exists + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ env.VERSION }} + release_name: ${{ env.VERSION }} + body_path: ./CHANGELOG.md + draft: false + prerelease: false \ No newline at end of file From d7929835042c4bc8d58ac4a417846b6f2b1b9b48 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 16 Apr 2021 21:08:19 +0200 Subject: [PATCH 21/25] use webcraft coverage module to set a name fix some typos --- .github/workflows/test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1a591db60..9023a5df9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -140,7 +140,7 @@ jobs: # JOB: LINT FRONTEND ######################################################### ############################################################################## lint_frontend: - name: Lint frontend + name: Lint - Frontend runs-on: ubuntu-latest needs: [build_test_frontend] steps: @@ -207,8 +207,9 @@ jobs: # COVERAGE CHECK FRONTEND ################################################ ########################################################################## - name: frontend | Coverage check - uses: devmasx/coverage-check-action@v1.2.0 + uses: webcraftmedia/coverage-check-action@master with: + report_name: Coverage Frontend type: lcov result_path: ./coverage/lcov.info min_coverage: 11 From b4f1096048a31cdb313b49c8f7a01c7cca02dfdb Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 20 Apr 2021 07:55:42 +0200 Subject: [PATCH 22/25] reset pwd clear data files seperated --- frontend/src/App.vue | 5 +- frontend/src/apis/loginAPI.js | 9 ++ frontend/src/routes/router.js | 4 - frontend/src/routes/routes.js | 4 +- frontend/src/store/store.js | 9 -- .../{Password.vue => ForgotPassword.vue} | 26 ++-- .../views/{ => Pages}/KontoOverview.spec.js | 0 .../src/views/{ => Pages}/KontoOverview.vue | 6 +- frontend/src/views/Pages/Login.vue | 3 + frontend/src/views/Pages/ResetPassword.vue | 147 ++++++++++++++++++ 10 files changed, 180 insertions(+), 33 deletions(-) rename frontend/src/views/Pages/{Password.vue => ForgotPassword.vue} (79%) rename frontend/src/views/{ => Pages}/KontoOverview.spec.js (100%) rename frontend/src/views/{ => Pages}/KontoOverview.vue (88%) create mode 100644 frontend/src/views/Pages/ResetPassword.vue diff --git a/frontend/src/App.vue b/frontend/src/App.vue index fafd46b32..6cf78bb54 100755 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -60,7 +60,10 @@ export default { this.$router.push('overview') } else { //console.log('app.vue to Logout') - this.$store.dispatch('logout') + if (this.$route.path == '/reset') { + } else { + this.$store.dispatch('logout') + } } }, data() { diff --git a/frontend/src/apis/loginAPI.js b/frontend/src/apis/loginAPI.js index d422fe3ff..91020ddbb 100644 --- a/frontend/src/apis/loginAPI.js +++ b/frontend/src/apis/loginAPI.js @@ -63,6 +63,15 @@ const loginAPI = { } return apiPost(CONFIG.LOGIN_API_URL + 'createUser', payload) }, + sendEmail: async (email, email_text = 7, email_verification_code_type = 'resetPassword') => { + //console.log('api email', email) + const payload = { + email, + email_text, + email_verification_code_type, + } + return apiPost(CONFIG.LOGIN_API_URL + 'sendEmail', payload) + }, } export default loginAPI diff --git a/frontend/src/routes/router.js b/frontend/src/routes/router.js index cd3646fe0..571c64582 100644 --- a/frontend/src/routes/router.js +++ b/frontend/src/routes/router.js @@ -21,10 +21,6 @@ const router = new VueRouter({ }) router.beforeEach((to, from, next) => { - let language = to.params.lang - if (!language) { - language = 'de' - } next() }) diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index b50f2a7b1..d487ed05e 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -3,7 +3,7 @@ import NotFound from '@/views/NotFoundPage.vue' const routes = [ { path: '/overview', - component: () => import('../views/KontoOverview.vue'), + component: () => import('../views/Pages/KontoOverview.vue'), meta: { requiresAuth: true, }, @@ -38,7 +38,7 @@ const routes = [ }, { path: '/password', - component: () => import('../views/Pages/Password.vue'), + component: () => import('../views/Pages/ForgotPassword.vue'), }, { path: '/explorer', diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index 96b2c4be8..65463a3df 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -63,7 +63,6 @@ export const store = new Vuex.Store({ state.user.balance_gdt = balance / 10000 }, }, - // Asyncronous actions - used for api calls actions: { login: async ({ dispatch, commit }, data) => { const result = await loginAPI.login(data.email, data.password) @@ -74,19 +73,11 @@ export const store = new Vuex.Store({ $cookies.set('gdd_u', data.email) router.push('/overview') } else { - // Register failed, we perform a logout - //alert('>>>>> FAIl LOGIN') commit('loginfail', true) //dispatch('logout') } }, - passwordReset: async (data) => { - //console.log('<<<<<<<<<<< PASSWORT RESET TODO >>>>>>>>>>>', data.email) - }, - schoepfen: async (data) => { - // http://localhost/transaction-creations/ajaxCreate - }, createUser: async ({ commit, dispatch }, data) => { // console.log('action: createUser') const result = await loginAPI.create( diff --git a/frontend/src/views/Pages/Password.vue b/frontend/src/views/Pages/ForgotPassword.vue similarity index 79% rename from frontend/src/views/Pages/Password.vue rename to frontend/src/views/Pages/ForgotPassword.vue index 0db2a2725..d99d7731e 100644 --- a/frontend/src/views/Pages/Password.vue +++ b/frontend/src/views/Pages/ForgotPassword.vue @@ -26,17 +26,10 @@ :placeholder="$t('form.email')" name="Email" :rules="{ required: true, email: true }" - v-model="model.email" + v-model="form.email" > - {{ form }}
- + {{ $t('site.password.reset_now') }}
@@ -53,21 +46,26 @@
+ From 38a447f62d4dcee03f11b1c1790f8422a6221d84 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 20 Apr 2021 08:00:17 +0200 Subject: [PATCH 23/25] reset to router --- frontend/src/routes/routes.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index d487ed05e..f70afa1b5 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -41,9 +41,8 @@ const routes = [ component: () => import('../views/Pages/ForgotPassword.vue'), }, { - path: '/explorer', - name: 'Explorer', - component: () => import('../views/Pages/Explorer.vue'), + path: '/reset', + component: () => import('../views/Pages/ResetPassword.vue'), }, { path: '*', component: NotFound }, ] From 7fe5119783b1b4418cbc13bc75110746f3429e26 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 20 Apr 2021 09:27:35 +0200 Subject: [PATCH 24/25] add specs --- .../src/views/Pages/ResetPassword.spec.js | 107 ++++++++++++++++++ frontend/src/views/Pages/ResetPassword.vue | 2 +- 2 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 frontend/src/views/Pages/ResetPassword.spec.js diff --git a/frontend/src/views/Pages/ResetPassword.spec.js b/frontend/src/views/Pages/ResetPassword.spec.js new file mode 100644 index 000000000..ebff0fc20 --- /dev/null +++ b/frontend/src/views/Pages/ResetPassword.spec.js @@ -0,0 +1,107 @@ +import { mount, RouterLinkStub } from '@vue/test-utils' +import Vuex from 'vuex' +import flushPromises from 'flush-promises' + +import ResetPassword from './ResetPassword' + +const localVue = global.localVue + +describe('ResetPassword', () => { + let wrapper + + let mocks = { + $i18n: { + locale: 'en', + }, + $t: jest.fn((t) => t), + } + + let state = { + // loginfail: false, + } + + let store = new Vuex.Store({ + state, + }) + + let stubs = { + RouterLink: RouterLinkStub, + } + + const Wrapper = () => { + return mount(ResetPassword, { localVue, mocks, store, stubs }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders the Reset Password form', () => { + expect(wrapper.find('div.resetpwd-form').exists()).toBeTruthy() + }) + + //describe('Register header', () => { + // it('has a welcome message', () => { + // expect(wrapper.find('div.header').text()).toBe('site.signup.title site.signup.subtitle') + // }) + //}) + + //describe('links', () => { + // it('has a link "Back"', () => { + // expect(wrapper.findAllComponents(RouterLinkStub).at(0).text()).toEqual('back') + // }) + + // it('links to /login when clicking "Back"', () => { + // expect(wrapper.findAllComponents(RouterLinkStub).at(0).props().to).toBe('/login') + // }) + //}) + + //describe('Register form', () => { + // it('has a register form', () => { + // expect(wrapper.find('form').exists()).toBeTruthy() + // }) + + // it('has 3 text input fields', () => { + // expect(wrapper.findAll('input[type="text"]').length).toBe(3) + // }) + + // it('has 2 password input fields', () => { + // expect(wrapper.findAll('input[type="password"]').length).toBe(2) + // }) + + // it('has 1 checkbox input fields', () => { + // expect(wrapper.findAll('input[type="checkbox"]').length).toBe(1) + // }) + + // it('has no submit button when not completely filled', () => { + // expect(wrapper.find('button[type="submit"]').exists()).toBe(false) + // }) + + // it('shows a warning when no valid Email is entered', async () => { + // wrapper.findAll('input[type="text"]').at(2).setValue('no_valid@Email') + // await flushPromises() + // await expect(wrapper.find('.invalid-feedback').text()).toEqual( + // 'The Email field must be a valid email', + // ) + // }) + + // it('shows 4 warnings when no password is set', async () => { + // const passwords = wrapper.findAll('input[type="password"]') + // passwords.at(0).setValue('') + // passwords.at(1).setValue('') + // await flushPromises() + // await expect(wrapper.find('div.hints').text()).toContain( + // 'site.signup.lowercase', + // 'site.signup.uppercase', + // 'site.signup.minimum', + // 'site.signup.one_number', + // ) + // }) + + // //TODO test different invalid password combinations + //}) + + // TODO test submit button + }) +}) diff --git a/frontend/src/views/Pages/ResetPassword.vue b/frontend/src/views/Pages/ResetPassword.vue index 0923d57ba..145fba404 100644 --- a/frontend/src/views/Pages/ResetPassword.vue +++ b/frontend/src/views/Pages/ResetPassword.vue @@ -1,5 +1,5 @@