fix: improve packages compatibility + better testing #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test publish | |
on: | |
pull_request: | |
jobs: | |
prepare: | |
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 | |
- 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: | |
needs: prepare | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
app: ${{ fromJson(needs.prepare.outputs.dirs) }} | |
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 | |
- name: Set npm registry to GitHub Packages and prevent linking to local packages | |
run: | | |
echo "" >> .npmrc | |
echo "link-workspace-packages=false" >> .npmrc | |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.TOLGEE_MACHINE_PAT }}" >> .npmrc | |
echo "@tolgee:registry=https://npm.pkg.github.com" >> .npmrc | |
- name: Install for root and for testapps | |
run: | | |
pnpm install --ignore-workspace | |
pnpm install --no-frozen-lockfile --filter='./testapps/*' | |
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: Run e2e tests | |
run: pnpm run e2e run --headed ${{matrix.app}} --stdout prod,dev | |
- uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: cypress | |
path: | | |
e2e/cypress/videos/**/* | |
e2e/cypress/screenshots/**/* |