feat: přidání testů – Jest unit testy + Playwright E2E + CI pipeline #54
+28
-18
@@ -3,7 +3,7 @@ name: CI
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
- "**"
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
@@ -22,7 +22,7 @@ jobs:
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
node-version: "22"
|
||||
|
||||
- run: npm install -g yarn
|
||||
|
||||
@@ -42,14 +42,14 @@ jobs:
|
||||
env:
|
||||
NODE_ENV: test
|
||||
JWT_SECRET: test-secret-min-32-chars-aaaaaaa!
|
||||
MOCK_DATA: 'true'
|
||||
MOCK_DATA: "true"
|
||||
STORAGE: json
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
node-version: "22"
|
||||
|
||||
- run: npm install -g yarn
|
||||
|
||||
@@ -71,7 +71,7 @@ jobs:
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
node-version: "22"
|
||||
|
||||
- run: npm install -g yarn
|
||||
|
||||
@@ -100,7 +100,7 @@ jobs:
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
node-version: "22"
|
||||
|
||||
- run: npm install -g yarn
|
||||
|
||||
@@ -131,16 +131,16 @@ jobs:
|
||||
env:
|
||||
REDIS_ARGS: "--save '' --loglevel warning"
|
||||
env:
|
||||
CI: 'true'
|
||||
CI: "true"
|
||||
NODE_ENV: test
|
||||
JWT_SECRET: test-secret-min-32-chars-aaaaaaa!
|
||||
MOCK_DATA: 'true'
|
||||
MOCK_DATA: "true"
|
||||
STORAGE: redis
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: '6379'
|
||||
HTTP_REMOTE_USER_ENABLED: 'true'
|
||||
REDIS_PORT: "6379"
|
||||
HTTP_REMOTE_USER_ENABLED: "true"
|
||||
HTTP_REMOTE_USER_HEADER_NAME: remote-user
|
||||
HTTP_REMOTE_TRUSTED_IPS: '127.0.0.1,::1,::ffff:127.0.0.1'
|
||||
HTTP_REMOTE_TRUSTED_IPS: "127.0.0.1,::1,::ffff:127.0.0.1"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -161,7 +161,8 @@ jobs:
|
||||
run: cp -r client/dist server/public
|
||||
|
||||
- name: Install e2e dependencies and browsers
|
||||
run: cd e2e && yarn install --frozen-lockfile && yarn playwright install firefox --with-deps
|
||||
run: cd e2e && yarn install --frozen-lockfile && yarn playwright install firefox
|
||||
--with-deps
|
||||
|
||||
- name: Run Playwright tests
|
||||
run: cd e2e && yarn test
|
||||
@@ -186,7 +187,7 @@ jobs:
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
node-version: "22"
|
||||
|
||||
- run: npm install -g yarn
|
||||
|
||||
@@ -219,28 +220,32 @@ jobs:
|
||||
push: true
|
||||
tags: ${{ secrets.REPO_URL }}/${{ secrets.REPO_NAME }}:latest
|
||||
|
||||
# ─── 5. Discord notification (master only, always) ────────────────────────
|
||||
# ─── 5. Notifications ────────────────────────
|
||||
|
||||
discord-notify:
|
||||
name: Discord notification
|
||||
notify:
|
||||
name: Notify
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ server-build, client-build, server-test, e2e, docker-build ]
|
||||
if: always() && github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
if: always() && github.event_name == 'push'
|
||||
steps:
|
||||
- name: Send webhook
|
||||
env:
|
||||
DISCORD_WEBHOOK_ID: ${{ secrets.DISCORD_WEBHOOK_ID }}
|
||||
DISCORD_WEBHOOK_TOKEN: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
|
||||
NTFY_URL: ${{ secrets.NTFY_URL }}
|
||||
BUILD_RESULT: ${{ needs.docker-build.result }}
|
||||
RUN_NUMBER: ${{ github.run_number }}
|
||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{
|
||||
github.run_id }}
|
||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||
COMMIT_AUTHOR: ${{ github.event.head_commit.author.name }}
|
||||
run: |
|
||||
if [ "$BUILD_RESULT" = "success" ]; then
|
||||
MSG="✅ Sestavení #${RUN_NUMBER} proběhlo úspěšně."
|
||||
NTFY_TAGS="white_check_mark"
|
||||
else
|
||||
MSG="❌ Sestavení #${RUN_NUMBER} selhalo."
|
||||
NTFY_TAGS="x"
|
||||
fi
|
||||
FULL_MSG="$(printf '%s\n\nPipeline: %s\nPoslední commit: %sAutor: %s' \
|
||||
"$MSG" "$RUN_URL" "$COMMIT_MESSAGE" "$COMMIT_AUTHOR")"
|
||||
@@ -248,3 +253,8 @@ jobs:
|
||||
"https://discord.com/api/webhooks/${DISCORD_WEBHOOK_ID}/${DISCORD_WEBHOOK_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data "$(jq -n --arg content "$FULL_MSG" '{content: $content}')"
|
||||
curl -s -X POST "${NTFY_URL}" \
|
||||
-H "Title: Luncher CI #${RUN_NUMBER}" \
|
||||
-H "Tags: ${NTFY_TAGS}" \
|
||||
-H "Click: ${RUN_URL}" \
|
||||
-d "${FULL_MSG}"
|
||||
|
||||
Reference in New Issue
Block a user