Skip to content

Commit

Permalink
chore: cache playwright gh-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
riipandi committed Sep 5, 2024
1 parent 6bbca36 commit b0a6ab4
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .github/setup-sdk/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ runs:
- uses: pnpm/action-setup@v4
with:
version: ${{ inputs.pnpmVersion }}
run_install: false
run_install: |
- args: [--global, node-jq]
- name: Get pnpm store directory
shell: bash
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ jobs:

- if: ${{ steps.pnpm-cache.outputs.cache-hit != 'true' }}
name: Install and build
run: pnpm install && pnpm build
run: |
pnpm install --frozen-lockfile --ignore-scripts
pnpm build
- name: Release new version
uses: softprops/action-gh-release@v2
Expand Down
50 changes: 41 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,19 @@ jobs:
- if: ${{ steps.pnpm-cache.outputs.cache-hit != 'true' }}
name: Test and build
run: |
pnpm install
pnpm test
pnpm build
pnpm install --frozen-lockfile --ignore-scripts
pnpm test && pnpm test:coverage && pnpm build
- name: Upload tests-results if exists
run: echo "TEST_RESULTS_EXISTS=$([ -d "tests-results" ] && echo "true" || echo "false")" >> $GITHUB_ENV

- name: Upload tests-results
uses: actions/upload-artifact@v4
if: env.TEST_RESULTS_EXISTS == 'true'
with:
name: tests-results-${{ matrix.node-version }}
path: tests-results/
retention-days: 14

e2e-test:
name: E2E Test
Expand All @@ -54,18 +64,40 @@ jobs:
- name: Run actions/setup-sdk@local
uses: ./.github/setup-sdk

- name: Get installed Playwright version
id: playwright-version
# |
run: |
PLAYWRIGHT_VERSION=$(jq -r '.devDependencies["@playwright/test"]? // "Package not found"' package.json | sed 's/^[^0-9]*//')
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
echo "Playwright version: $PLAYWRIGHT_VERSION"
- name: Cache playwright binaries
uses: actions/cache@v4
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}

- name: Install dependencies
run: npm install -g pnpm && pnpm install
run: pnpm install --frozen-lockfile --ignore-scripts

- name: Install Playwright Browsers
- name: Playwright install
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: pnpm exec playwright install --with-deps

- name: Playwright install-deps
run: pnpm exec playwright install-deps

- name: Run Playwright tests
run: pnpm exec playwright test
run: |
NODE_ENV=production pnpm build
pnpm exec playwright test
- uses: actions/upload-artifact@v4
- name: Upload playwright-report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
name: playwright-report-${{ github.run_id }}
path: playwright-report/
retention-days: 30
retention-days: 14
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pnpm docker:images

```sh
# Run API Docker container in foreground
docker run --rm -it -p 3000:3000 --name sosialink --env-file .env sosialink
docker run --rm -it -p 3000:3000 --name remix-start --env-file .env remix-start
```

### Push Images
Expand All @@ -123,7 +123,7 @@ echo $REGISTRY_TOKEN | docker login ghcr.io --username YOUR_USERNAME --password-
Push docker image:

```sh
docker push ghcr.io/riipandi/sosialink:latest
docker push ghcr.io/riipandi/remix-start:latest
```

## 🚀 Deployment
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_auth+/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { clx } from '#/utils/ui-helper'

import { SocialLogin } from './__social'

export const meta: MetaFunction = () => [{ title: 'Sign in - Sosialink' }]
export const meta: MetaFunction = () => [{ title: 'Sign in - Remix Start' }]

export default function SignInPage() {
return (
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_auth+/register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { clx } from '#/utils/ui-helper'

import { SocialLogin } from './__social'

export const meta: MetaFunction = () => [{ title: 'Create Account - Sosialink' }]
export const meta: MetaFunction = () => [{ title: 'Create Account - Remix Start' }]

export default function SignUpPage() {
return (
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"e2e-test:safari": "playwright test --headed --project Safari",
"e2e-test:mobile": "playwright test --headed --project 'Mobile Chrome'",
"e2e-test:report": "playwright show-report playwright-report",
"e2e-test:install": "playwright install-deps",
"e2e-test:install": "playwright install --with-deps",
"e2e-test:ui": "playwright test --ui",
"preinstall": "npx only-allow pnpm",
"prepare": "lefthook install || true",
Expand Down

0 comments on commit b0a6ab4

Please sign in to comment.