Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve packages compatibility + better testing #3233

Merged
merged 62 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
6f497b1
chore: add test-published workflow
stepan662 Aug 21, 2023
d86674a
chore: add test-published workflow
stepan662 Aug 21, 2023
0b44990
chore: add test-published workflow
stepan662 Aug 21, 2023
225e1b7
chore: add test-published workflow
stepan662 Aug 21, 2023
315470a
chore: add test-published workflow
stepan662 Aug 21, 2023
a930742
chore: add test-published workflow
stepan662 Aug 21, 2023
d553459
chore: add test-published workflow
stepan662 Aug 21, 2023
38afd6d
chore: add test-published workflow
stepan662 Aug 21, 2023
e6715aa
chore: add test-published workflow
stepan662 Aug 21, 2023
7091da6
chore: add test-published workflow
stepan662 Aug 21, 2023
b90f968
chore: add tests using registry
stepan662 Aug 21, 2023
4358e65
chore: add tests using registry
stepan662 Aug 21, 2023
1e45247
chore: add tests using registry
stepan662 Aug 21, 2023
707b3bc
chore: add tests using registry
stepan662 Aug 21, 2023
08067bb
chore: add tests using registry
stepan662 Aug 21, 2023
ea577a7
chore: add tests using registry
stepan662 Aug 21, 2023
0333e81
chore: add tests using registry
stepan662 Aug 21, 2023
9a73a8d
chore: add tests using registry
stepan662 Aug 21, 2023
2734264
chore: add tests using registry
stepan662 Aug 21, 2023
c0dbff9
chore: add tests using registry
stepan662 Aug 21, 2023
4fc72af
chore: add tests using registry
stepan662 Aug 21, 2023
48654f7
chore: add tests using registry
stepan662 Aug 21, 2023
16dbd21
chore: add tests using registry
stepan662 Aug 21, 2023
6973156
chore: add tests using registry
stepan662 Aug 21, 2023
884c290
chore: add tests using registry
stepan662 Aug 21, 2023
3f524ca
chore: add tests using registry
stepan662 Aug 21, 2023
8e41eb0
chore: add tests using registry
stepan662 Aug 22, 2023
39eb343
chore: add tests using registry
stepan662 Aug 22, 2023
7a527e0
chore: add tests using registry
stepan662 Aug 22, 2023
543717f
chore: add tests using registry
stepan662 Aug 22, 2023
50ca4e3
chore: add tests using registry
stepan662 Aug 22, 2023
613b8c4
chore: add tests using registry
stepan662 Aug 22, 2023
4444f52
chore: add tests using registry
stepan662 Aug 22, 2023
88e6c84
chore: add caching
stepan662 Aug 22, 2023
58f5f18
chore: fix npm installation
stepan662 Aug 22, 2023
a09eeed
chore: fix npm caching
stepan662 Aug 22, 2023
4b8b2a4
chore: cleanup + fix link issue
stepan662 Aug 22, 2023
a436cb1
fix: solve nextjs reeport issue
stepan662 Aug 22, 2023
113aa25
chore: remove unnecessary stuff
stepan662 Aug 22, 2023
1cba5b8
chore: test with multiple node versions
stepan662 Aug 22, 2023
f21bd11
chore: test only node 18 for now
stepan662 Aug 22, 2023
687f3cf
chore: fix customLinks scripts
stepan662 Aug 22, 2023
29a3f72
chore: upgrade pnpm version
stepan662 Aug 22, 2023
aa010cd
chore: upgrade turbo
stepan662 Aug 22, 2023
7ae00c3
chore: fix test-publishchore: fix test-publish
stepan662 Aug 22, 2023
7b6cc47
chore: give svelte more retries
stepan662 Aug 22, 2023
1151f51
chore: remove .only from e2e tests
stepan662 Aug 22, 2023
85d260d
chore: fix react test
stepan662 Aug 22, 2023
f460853
chore: add multiple node versions
stepan662 Aug 23, 2023
4693518
chore: refactor test
stepan662 Aug 23, 2023
9ae3f3d
chore: test with node 16
stepan662 Aug 23, 2023
8ddce68
fix: next app-router-app
stepan662 Aug 23, 2023
1097048
chore: rename testapp and fix e2e test
stepan662 Aug 23, 2023
027e0da
chore: add eslint to e2e
stepan662 Aug 23, 2023
8f25c01
chore: fix next-app
stepan662 Aug 23, 2023
0a08bf0
chore: fix next-app
stepan662 Aug 23, 2023
07973a1
chore: test on node 16 and 18
stepan662 Aug 23, 2023
b7bc98e
chore: add retries to next tests
stepan662 Aug 23, 2023
2d99ddb
chore: build caching
stepan662 Aug 23, 2023
273c546
chore: add more cache
stepan662 Aug 23, 2023
74c6272
chore: update cache names
stepan662 Aug 23, 2023
77d5e97
chore: next-app to publish examples
stepan662 Aug 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"*.js",
"**/lib",
"**/src/serviceWorker.ts",
"*.d.ts"
"*.d.ts",
"dist-e2e"
],
"extends": [
"eslint:recommended",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prerelease-tolgee-5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
name: Install pnpm
id: pnpm-install
with:
version: 7.16.0
version: 8.6.12
run_install: false

- name: Set git globals
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
name: Install pnpm
id: pnpm-install
with:
version: 7.16.0
version: 8.6.12
run_install: false

- name: Create branch
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-examples-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
[
'react',
'next',
'next-app',
'vue',
'svelte',
'ngx',
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
'react',
'next',
'vue',
'next-app',
'svelte',
'ngx',
'react-i18next',
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
name: Install pnpm
id: pnpm-install
with:
version: 7.16.0
version: 8.6.12
run_install: false

- name: Set git globals
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/report-intermittent-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
name: Install pnpm
id: pnpm-install
with:
version: 7.16.0
version: 8.6.12
run_install: false

- uses: actions/cache@v3
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
name: Install pnpm
id: pnpm-install
with:
version: 7.16.0
version: 8.6.12
run_install: false

- uses: actions/cache@v3
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
name: Install pnpm
id: pnpm-install
with:
version: 7.16.0
version: 8.6.12
run_install: false

- uses: actions/cache@v3
Expand Down
163 changes: 80 additions & 83 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,68 +2,25 @@ name: Test

on:
pull_request:
push:
branches: [main]

jobs:
test:
name: 'Test'
prepare:
name: Prepare packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '18'

- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
version: 7.16.0
run_install: false

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: .pnpm-store/v3
key: ${{ runner.os }}-pnpm-test-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-test-
token: '${{ secrets.TOLGEE_MACHINE_PAT }}'

- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ github.job }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-

- name: Install
run: pnpm install --no-frozen-lockfile

- name: Build all packages
run: pnpm build || pnpm build

- name: Test
run: pnpm run test

cypress-prepare:
name: 'Cypress prepare'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
- uses: actions/setup-node@v3
with:
node-version: '18'

- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
version: 7.16.0
version: 8.6.12
run_install: false

- uses: actions/cache@v3
Expand All @@ -72,27 +29,50 @@ jobs:
path: |
.pnpm-store/v3
~/.cache/Cypress
key: ${{ runner.os }}-pnpm-cypress-${{ hashFiles('**/pnpm-lock.yaml') }}
key: ${{ runner.os }}-pnpm-prepare-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-cypress-
${{ runner.os }}-pnpm-prepare-

- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-cypress-${{ github.sha }}
key: turbo-prepare-${{ github.job }}-${{ github.sha }}
restore-keys: |
turbo-cypress-
turbo-prepare-${{ github.job }}-

- name: Install
run: pnpm install --no-frozen-lockfile
- name: Create branch
run: git checkout -b test.$(git ls-files -s packages | git hash-object --stdin)

- name: Install root and packages dependencies
run: |
pnpm install --ignore-workspace
pnpm install --no-frozen-lockfile --filter='./packages/*'

- name: Update version with lerna
run: |
lerna version prerelease --yes --conventional-prerelease --preid test.$(git ls-files -s packages | git hash-object --stdin) --ignore-scripts \
--force-publish --no-push --no-git-tag-version --exact

- name: Set TOLGEE_UI_VERSION
run: |
echo "TOLGEE_UI_VERSION=$(pnpm run --silent ui-version)" >> $GITHUB_ENV
pnpm run --silent ui-version

- name: Build
run: pnpm build || pnpm build
- name: Build packages
run: pnpm build-packages

- name: Build e2e
run: pnpm build:e2e
- name: Set npm registry to GitHub Packages
run: |
echo "" >> .npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.TOLGEE_MACHINE_PAT }}" >> .npmrc
echo "@tolgee:registry=https://npm.pkg.github.com" >> .npmrc

- name: Publish to GitHub Packages
run: pnpm publish -r --no-git-checks --tag test
env:
NODE_AUTH_TOKEN: ${{secrets.TOLGEE_MACHINE_PAT}}

- id: set-dirs
run: echo "dirs=$(ls | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
Expand All @@ -102,27 +82,27 @@ jobs:
dirs: ${{ steps.set-dirs.outputs.dirs }}

cypress:
name: 'Cypress'
# cypress-prepare will install and build everything into cache
needs: cypress-prepare
name: E2e
needs: prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
app: ${{ fromJson(needs.cypress-prepare.outputs.dirs) }}
app: ${{ fromJson(needs.prepare.outputs.dirs) }}
node: [16, 18]

steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: ${{ matrix.node }}

- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
version: 7.16.0
version: 8.6.12
run_install: false

- uses: actions/cache@v3
Expand All @@ -135,20 +115,36 @@ jobs:
restore-keys: |
${{ runner.os }}-pnpm-cypress-

- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-cypress-${{ github.sha }}
restore-keys: |
turbo-cypress-
- name: Install for root and for e2e
run: |
pnpm install --ignore-workspace
pnpm install --no-frozen-lockfile --filter='./e2e'

- name: Install
run: pnpm install --no-frozen-lockfile
- name: Create branch
run: git checkout -b test.$(git ls-files -s packages | git hash-object --stdin)

- name: Cypress
run: pnpm run e2e run --headed ${{matrix.app}} --stdout prod,dev
- name: Update version with lerna
run: |
lerna version prerelease --yes --conventional-prerelease --preid test.$(git ls-files -s packages | git hash-object --stdin) --ignore-scripts \
--force-publish --no-push --no-git-tag-version --exact

- name: Remove 'workspace' field from package.json
run: node scripts/packageJsonRemoveWorkspaces.js

- name: Install testapp dependencies with npm
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.TOLGEE_MACHINE_PAT }}" >> .npmrc
echo "@tolgee:registry=https://npm.pkg.github.com" >> .npmrc
rm -rf node_modules
npm install --force
working-directory: testapps/${{matrix.app}}

- name: Build testapp
run: npm run build
working-directory: testapps/${{matrix.app}}

- name: Run e2e tests
run: pnpm run e2e run --headed ${{matrix.app}} --stdout prod,dev --skip-build

- uses: actions/upload-artifact@v2
if: failure()
Expand All @@ -158,8 +154,8 @@ jobs:
e2e/cypress/videos/**/*
e2e/cypress/screenshots/**/*

code-checks:
name: Eslint 🪲
static-checks:
name: Static check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -172,21 +168,22 @@ jobs:
name: Install pnpm
id: pnpm-install
with:
version: 7.16.0
version: 8.6.12
run_install: false

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: .pnpm-store/v3
key: ${{ runner.os }}-pnpm-eslint-${{ hashFiles('**/pnpm-lock.yaml') }}
key: ${{ runner.os }}-pnpm-lint-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-eslint-
${{ runner.os }}-pnpm-lint-

- name: Install
run: pnpm install --no-frozen-lockfile
working-directory: ./

- name: Eslint
run: pnpm run eslint
working-directory: ./

- name: Eslint
run: pnpm --prefix e2e run eslint
45 changes: 45 additions & 0 deletions e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"env": {
"es2021": true
},
"ignorePatterns": [
"**/*.generated.*",
"*.js"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint",
"prettier",
"no-only-tests"
],
"rules": {
"prettier/prettier": "error",
"no-console": "warn",
"no-only-tests/no-only-tests": "warn",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"args": "none",
"varsIgnorePattern": "^_"
}
],
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-empty-interface": "off"
}
}
2 changes: 1 addition & 1 deletion e2e/cypress/common/namespacesTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const namespacesTest = (
items: Record<string, { text: string; count: number; testId?: string }[]>,
options?: { skipLoading: boolean }
) =>
describe.only('translation methods test', () => {
describe('translation methods test', () => {
before(() => {
cy.visit(url + '/translation-methods');
cy.intercept('GET', '*', (req) => {
Expand Down
Loading