From 004e8ec64556f9903e1fe5edd3006670ab84f86f Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Thu, 6 Feb 2025 16:34:16 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=90(CI)=20build=20mails=20when=20crowd?= =?UTF-8?q?in=5Fupload=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we were executing the crowdin_upload workflow, we were not building the mail template to dispatch it to the backend. It resulted in the mail not being totally translated. This commit fixes that issue by adding the build mail step to the crowdin_upload. To do so, we added it to the dependencies workflow. "dependencies" workflow is callable by other workflows that need a specific job. --- .github/workflows/crowdin_download.yml | 5 +- .github/workflows/crowdin_upload.yml | 15 +++- .github/workflows/dependencies.yml | 85 +++++++++++++++++++ .../front-dependencies-installation.yml | 36 -------- .github/workflows/impress-frontend.yml | 11 +-- .github/workflows/impress.yml | 48 ++--------- CHANGELOG.md | 4 + 7 files changed, 117 insertions(+), 87 deletions(-) create mode 100644 .github/workflows/dependencies.yml delete mode 100644 .github/workflows/front-dependencies-installation.yml diff --git a/.github/workflows/crowdin_download.yml b/.github/workflows/crowdin_download.yml index 6d9355cb..84a075bb 100644 --- a/.github/workflows/crowdin_download.yml +++ b/.github/workflows/crowdin_download.yml @@ -7,10 +7,11 @@ on: - 'release/**' jobs: - install-front: - uses: ./.github/workflows/front-dependencies-installation.yml + install-dependencies: + uses: ./.github/workflows/dependencies.yml with: node_version: '20.x' + with-front-dependencies-installation: true synchronize-with-crowdin: runs-on: ubuntu-latest diff --git a/.github/workflows/crowdin_upload.yml b/.github/workflows/crowdin_upload.yml index e35731f2..9ffb383b 100644 --- a/.github/workflows/crowdin_upload.yml +++ b/.github/workflows/crowdin_upload.yml @@ -7,13 +7,15 @@ on: - main jobs: - install-front: - uses: ./.github/workflows/front-dependencies-installation.yml + install-dependencies: + uses: ./.github/workflows/dependencies.yml with: node_version: '20.x' + with-front-dependencies-installation: true + with-build_mails: true synchronize-with-crowdin: - needs: install-front + needs: install-dependencies runs-on: ubuntu-latest steps: @@ -29,6 +31,13 @@ jobs: - name: Install development dependencies run: pip install --user . working-directory: src/backend + - name: Restore the mail templates + uses: actions/cache@v4 + id: mail-templates + with: + path: "src/backend/core/templates/mail" + key: mail-templates-${{ hashFiles('src/mail/mjml') }} + fail-on-cache-miss: true - name: Install gettext run: | sudo apt-get update diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml new file mode 100644 index 00000000..31097644 --- /dev/null +++ b/.github/workflows/dependencies.yml @@ -0,0 +1,85 @@ +name: Dependency reusable workflow + +on: + workflow_call: + inputs: + node_version: + required: false + default: '20.x' + type: string + with-front-dependencies-installation: + type: boolean + default: false + with-build_mails: + type: boolean + default: false + +jobs: + front-dependencies-installation: + if: ${{ inputs.with-front-dependencies-installation == true }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore the frontend cache + uses: actions/cache@v4 + id: front-node_modules + with: + path: "src/frontend/**/node_modules" + key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }} + - name: Setup Node.js + if: steps.front-node_modules.outputs.cache-hit != 'true' + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node_version }} + - name: Install dependencies + if: steps.front-node_modules.outputs.cache-hit != 'true' + run: cd src/frontend/ && yarn install --frozen-lockfile + - name: Cache install frontend + if: steps.front-node_modules.outputs.cache-hit != 'true' + uses: actions/cache@v4 + with: + path: "src/frontend/**/node_modules" + key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }} + + build-mails: + if: ${{ inputs.with-build_mails == true }} + runs-on: ubuntu-latest + defaults: + run: + working-directory: src/mail + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Restore the mail templates + uses: actions/cache@v4 + id: mail-templates + with: + path: "src/backend/core/templates/mail" + key: mail-templates-${{ hashFiles('src/mail/mjml') }} + + - name: Setup Node.js + if: steps.mail-templates.outputs.cache-hit != 'true' + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node_version }} + + - name: Install yarn + if: steps.mail-templates.outputs.cache-hit != 'true' + run: npm install -g yarn + + - name: Install node dependencies + if: steps.mail-templates.outputs.cache-hit != 'true' + run: yarn install --frozen-lockfile + + - name: Build mails + if: steps.mail-templates.outputs.cache-hit != 'true' + run: yarn build + + - name: Cache mail templates + if: steps.mail-templates.outputs.cache-hit != 'true' + uses: actions/cache@v4 + with: + path: "src/backend/core/templates/mail" + key: mail-templates-${{ hashFiles('src/mail/mjml') }} diff --git a/.github/workflows/front-dependencies-installation.yml b/.github/workflows/front-dependencies-installation.yml deleted file mode 100644 index 33bb3c43..00000000 --- a/.github/workflows/front-dependencies-installation.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Install frontend installation reusable workflow - -on: - workflow_call: - inputs: - node_version: - required: false - default: '20.x' - type: string - -jobs: - front-dependencies-installation: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore the frontend cache - uses: actions/cache@v4 - id: front-node_modules - with: - path: "src/frontend/**/node_modules" - key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }} - - name: Setup Node.js - if: steps.front-node_modules.outputs.cache-hit != 'true' - uses: actions/setup-node@v4 - with: - node-version: ${{ inputs.node_version }} - - name: Install dependencies - if: steps.front-node_modules.outputs.cache-hit != 'true' - run: cd src/frontend/ && yarn install --frozen-lockfile - - name: Cache install frontend - if: steps.front-node_modules.outputs.cache-hit != 'true' - uses: actions/cache@v4 - with: - path: "src/frontend/**/node_modules" - key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }} diff --git a/.github/workflows/impress-frontend.yml b/.github/workflows/impress-frontend.yml index c5d17c90..f869517d 100644 --- a/.github/workflows/impress-frontend.yml +++ b/.github/workflows/impress-frontend.yml @@ -10,13 +10,14 @@ on: jobs: - install-front: - uses: ./.github/workflows/front-dependencies-installation.yml + install-dependencies: + uses: ./.github/workflows/dependencies.yml with: node_version: '20.x' + with-front-dependencies-installation: true test-front: - needs: install-front + needs: install-dependencies runs-on: ubuntu-latest steps: - name: Checkout repository @@ -39,7 +40,7 @@ jobs: lint-front: runs-on: ubuntu-latest - needs: install-front + needs: install-dependencies steps: - name: Checkout repository uses: actions/checkout@v4 @@ -60,7 +61,7 @@ jobs: test-e2e-chromium: runs-on: ubuntu-latest - needs: install-front + needs: install-dependencies timeout-minutes: 20 steps: - name: Checkout repository diff --git a/.github/workflows/impress.yml b/.github/workflows/impress.yml index 385aa633..97182a57 100644 --- a/.github/workflows/impress.yml +++ b/.github/workflows/impress.yml @@ -9,6 +9,11 @@ on: - "*" jobs: + install-dependencies: + uses: ./.github/workflows/dependencies.yml + with: + with-build_mails: true + lint-git: runs-on: ubuntu-latest if: github.event_name == 'pull_request' # Makes sense only for pull requests @@ -56,46 +61,6 @@ jobs: exit 1 fi - build-mails: - runs-on: ubuntu-latest - defaults: - run: - working-directory: src/mail - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: "18" - - - name: Restore the mail templates - uses: actions/cache@v4 - id: mail-templates - with: - path: "src/backend/core/templates/mail" - key: mail-templates-${{ hashFiles('src/mail/mjml') }} - - - name: Install yarn - if: steps.mail-templates.outputs.cache-hit != 'true' - run: npm install -g yarn - - - name: Install node dependencies - if: steps.mail-templates.outputs.cache-hit != 'true' - run: yarn install --frozen-lockfile - - - name: Build mails - if: steps.mail-templates.outputs.cache-hit != 'true' - run: yarn build - - - name: Cache mail templates - if: steps.mail-templates.outputs.cache-hit != 'true' - uses: actions/cache@v4 - with: - path: "src/backend/core/templates/mail" - key: mail-templates-${{ hashFiles('src/mail/mjml') }} - lint-back: runs-on: ubuntu-latest defaults: @@ -121,7 +86,7 @@ jobs: test-back: runs-on: ubuntu-latest - needs: build-mails + needs: install-dependencies defaults: run: @@ -169,6 +134,7 @@ jobs: with: path: "src/backend/core/templates/mail" key: mail-templates-${{ hashFiles('src/mail/mjml') }} + fail-on-cache-miss: true - name: Start MinIO run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index a29f4cf8..e7b8e01a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ and this project adheres to ## Added - 📝(doc) Add security.md and codeofconduct.md #604 +## Fixed + +🌐(CI) Fix email partially translated #616 + ## [2.1.0] - 2025-01-29 ## Added