chore: remove playwright quiet #102
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: 'package.json' | |
cache: 'npm' | |
- name: Update npm version | |
run: npm update npm -g | |
- name: Install dependencies | |
run: npm ci | |
- name: Run linting | |
run: npm run lint | |
- name: Validate current commit (last commit) with commitlint | |
if: github.event_name == 'push' | |
run: npx commitlint --from HEAD~1 --to HEAD --verbose | |
- name: Validate PR commits with commitlint | |
if: github.event_name == 'pull_request' | |
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose | |
svelte-check: | |
name: Svelte check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: 'package.json' | |
cache: 'npm' | |
- name: Update npm version | |
run: npm update npm -g | |
- name: Install dependencies | |
run: npm ci | |
- name: Run Svelte check | |
run: npm run check | |
test: | |
name: Playwright test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: 'package.json' | |
cache: 'npm' | |
- name: Update npm version | |
run: npm update npm -g | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright dependencies | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
run: npm run test | |
check-deploy: | |
name: Check if deploy is needed | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
outputs: | |
deployNext: ${{ steps.checkCommitMessagesForNextChanges.outputs.deployNext }} | |
permissions: read-all | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get last workflow run SHA | |
id: lastWorkflowRun | |
run: | | |
export SHA=$(gh run list --json headSha | jq -r '.[1].headSha') | |
echo "lastWorkflowRunSha=$SHA" >> "$GITHUB_OUTPUT" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Check commit messages for Next changes | |
id: checkCommitMessagesForNextChanges | |
run: | | |
if git log --pretty=format:"%s" ${{ steps.lastWorkflowRun.outputs.lastWorkflowRunSha }}..HEAD | grep -q -E '\(next\):|^feat:|^fix:|^ci:|^refactor:|^chore:'; then | |
echo "Commit messages since last deploy contain a repo wide or Next change" | |
echo "deployNext=true" >> "$GITHUB_OUTPUT" | |
else | |
echo "Commit messages since last deploy do not contain a repo wide or Next change" | |
echo "deployNext=false" >> "$GITHUB_OUTPUT" | |
fi | |
changes-since-last-deploy: | |
name: Compare changes since last deploy | |
runs-on: ubuntu-latest | |
needs: [lint, svelte-check, test, check-deploy] | |
if: ${{ needs.check-deploy.outputs.deployNext == 'true' }} | |
environment: | |
name: github | |
url: ${{steps.changes.outputs.url}} | |
permissions: read-all | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Changes since last deploy | |
id: changes | |
run: | | |
export SHA=$(gh run list --json databaseId | jq -r ".[] | .databaseId" | while read -r run_id; do gh run view $run_id --json jobs,headSha | jq -r '. | select(.jobs[] | .name == "Deploy to production" and .status == "completed" and .conclusion == "success") | .headSha' | grep . && break; done | head -n 1) | |
echo "url=https://github.com/${{ github.repository }}/compare/$SHA...${{ github.sha }}" >> "$GITHUB_OUTPUT" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
deploy-production: | |
name: Deploy to production | |
runs-on: ubuntu-latest | |
needs: [changes-since-last-deploy] | |
if: github.ref == 'refs/heads/main' | |
environment: | |
name: production | |
url: https://epoxide.se | |
concurrency: | |
group: production | |
cancel-in-progress: true | |
steps: | |
- name: Trigger Coolify deployment | |
run: | | |
curl --request GET '${{ secrets.COOLIFY_WEBHOOK_URL }}' --header 'Authorization: Bearer ${{ secrets.COOLIFY_API_TOKEN }}' |