-
Notifications
You must be signed in to change notification settings - Fork 3
110 lines (94 loc) · 3.32 KB
/
test_feature_branches_push.yml
File metadata and controls
110 lines (94 loc) · 3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Webapp-test on feature branches
# The workflow event listens to push requests for every branch except main and developer
on:
push:
branches:
- '*'
- '!main'
- '!developer'
paths:
- 'client/**'
workflow_dispatch:
# Jobes executed
jobs:
test-web-application:
name: 'Run unit tests for web-application'
runs-on: ubuntu-latest
env:
VITE_POSTGREST_URL: ${{ secrets.POSTGREST_URL }}
VITE_UPLOAD_URL: ${{ secrets.UPLOAD_URL }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Dependencies
run: npm install
working-directory: ./client
- name: Install Playwright Browsers
run: npx playwright install
working-directory: ./client
- name: Run Tests
run: npm run test
working-directory: ./client
lint-web-application:
name: 'Lint code for web-application'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Dependencies
run: npm install
working-directory: ./client
- name: Auto-fix linting issues
run: npm run lint -- --fix
working-directory: ./client
- name: Check if there are linting changes
id: git-check-lint
run: |
git diff --exit-code || echo "::set-output name=changed::true"
working-directory: ./client
- name: Commit linting changes
if: steps.git-check-lint.outputs.changed == 'true'
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
changed_files=$(git diff --name-only)
git commit -am "style: lint fix $changed_files"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ./client
Format-web-application:
name: 'Prettify code for web-application' # Cheks prettify issues and beautifies code following the StandardJS coding convention
runs-on: ubuntu-latest
needs: lint-web-application
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensures all branches and tags are fetched
- name: Install Dependencies
run: npm install
working-directory: ./client
- name: Pull latest changes
run: |
git pull origin ${GITHUB_REF#refs/heads/} --rebase
working-directory: ./client
- name: Prettify code
run: npm run format
working-directory: ./client
- name: Check if there are changes
id: git-check
run: |
git diff --exit-code || echo "::set-output name=changed::true"
working-directory: ./client
- name: Commit changes
if: steps.git-check.outputs.changed == 'true'
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
changed_files=$(git diff --name-only)
git commit -am "style: prettify fix $changed_files"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ./client