fix: improve packages compatibility + better testing #12
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: | ||
main: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: '${{ secrets.TOLGEE_MACHINE_PAT }}' | ||
- name: Build | ||
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 | ||
- run: | | ||
echo "" >> .npmrc | ||
echo "registry=https://npm.pkg.github.com/tolgee" >> .npmrc | ||
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc | ||
- 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: Turbo Cache | ||
id: turbo-cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: .turbo | ||
key: turbo-cypress-${{ github.sha }} | ||
restore-keys: | | ||
turbo-cypress- | ||
- name: Install | ||
run: pnpm install --no-frozen-lockfile --filter='./packages/*' | ||
- name: Update version locally | ||
run: | | ||
lerna version prerelease --yes --conventional-prerelease --preid test.$(git rev-parse --short HEAD) \ | ||
--force-publish --no-push --no-git-tag-version --exact | ||
# Set TOLGEE_UI_VERSION for @tolgee/core build | ||
- name: Set env | ||
run: | | ||
echo "TOLGEE_UI_VERSION=$(pnpm run --silent ui-version)" >> $GITHUB_ENV | ||
pnpm run --silent ui-version | ||
- name: Build all packages | ||
run: pnpm build-packages | ||
- name: Recreate release with push | ||
run: pnpm publish -r --no-git-checks | ||
- name: Build e2e | ||
run: pnpm build:e2e | ||
- 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: 'Cypress with published packages' | ||
# cypress-prepare will install and build everything into cache | ||
needs: cypress-prepare | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
app: ${{ fromJson(needs.cypress-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 | ||
- run: | | ||
echo "" >> .npmrc | ||
echo "link-workspace-packages=false" >> .npmrc | ||
echo "registry=https://npm.pkg.github.com/tolgee" >> .npmrc | ||
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc | ||
- 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: Turbo Cache | ||
id: turbo-cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: .turbo | ||
key: turbo-cypress-${{ github.sha }} | ||
restore-keys: | | ||
turbo-cypress- | ||
- name: Install | ||
run: pnpm install --no-frozen-lockfile | ||
- name: Update version locally | ||
run: | | ||
lerna version prerelease --yes --conventional-prerelease --preid test.$(git rev-parse --short HEAD) \ | ||
--force-publish --no-push --no-git-tag-version --exact | ||
- name: Cypress | ||
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/**/* |