Skip to content

fix: improve packages compatibility + better testing #41

fix: improve packages compatibility + better testing

fix: improve packages compatibility + better testing #41

Workflow file for this run

name: Test publish
on:
pull_request:
jobs:
prepare:
name: Prepare packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: '${{ secrets.TOLGEE_MACHINE_PAT }}'
- 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
~/.cache/Cypress
key: ${{ runner.os }}-pnpm-cypress-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-cypress-
- name: Create branch
run: git checkout -b test.$(git rev-parse --short HEAD)
- 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 rev-parse --short HEAD) --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 packages
run: pnpm build-packages
- 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
working-directory: e2e/cypress/e2e
outputs:
dirs: ${{ steps.set-dirs.outputs.dirs }}
cypress:
name: Run cypress on all testapps
needs: prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
app: ${{ fromJson(needs.prepare.outputs.dirs) }}
node: [20, 18, 16]
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
version: 7.16.0
run_install: false
- name: Install for root and for e2e
run: |
pnpm install --ignore-workspace
pnpm install --no-frozen-lockfile --filter='./e2e'
- name: Create branch
run: git checkout -b test.$(git rev-parse --short HEAD)
- name: Update version with lerna
run: |
lerna version prerelease --yes --conventional-prerelease --preid test.$(git rev-parse --short HEAD) --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
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,err --skip-build
- uses: actions/upload-artifact@v2
if: failure()
with:
name: cypress
path: |
e2e/cypress/videos/**/*
e2e/cypress/screenshots/**/*
code-checks:
name: Eslint 🪲
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-eslint-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-eslint-
- name: Install
run: pnpm install --no-frozen-lockfile --ignore-workspace
- name: Eslint
run: pnpm run eslint