-
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (78 loc) · 2.68 KB
/
ci.yml
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
name: CI pipeline
on: [ push, pull_request ]
permissions:
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Run Linter
run: npm run lint
unit:
name: Unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Run frontend Unit tests
run: npm run test
e2e:
name: E2E tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Run End to End tests
run: npm run e2e
- name: Upload videos
uses: actions/upload-artifact@v4
with:
name: e2e-videos
path: cypress/videos
build:
name: Build UI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Build UI
run: npm run build
- name: Stash bundle
uses: actions/upload-artifact@v4
with:
name: bundle
path: dist/upcoming-analyzer/
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [unit, e2e, build]
if: github.ref == 'refs/heads/main'
steps:
- name: Unstash bundle
uses: actions/download-artifact@v4
with:
name: bundle
path: ./
- name: Install lftp
run: sudo apt-get install lftp
- name: Pull .well-known
continue-on-error: true
run: lftp -u ${{ secrets.FTP_USER }},${{ secrets.FTP_PASSWORD }} -e "set ssl:verify-certificate no; mirror ${{ secrets.FTP_SERVER_DIR }}/.well-known ./; quit;" ${{ secrets.FTP_URL }}
- name: Push new bundle to remote
run: lftp -u ${{ secrets.FTP_USER }},${{ secrets.FTP_PASSWORD }} -e "set ssl:verify-certificate no; mirror --reverse ./ ${{ secrets.FTP_SERVER_DIR }}-${{ github.sha }} --verbose --parallel=10; quit;" ${{ secrets.FTP_URL }}
- name: Remove old backup
continue-on-error: true
run: lftp -u ${{ secrets.FTP_USER }},${{ secrets.FTP_PASSWORD }} -e "set ssl:verify-certificate no; rm -r ${{ secrets.FTP_SERVER_DIR }}.bak; quit;" ${{ secrets.FTP_URL }}
- name: Backup current bundle and deploy new bundle
run: lftp -u ${{ secrets.FTP_USER }},${{ secrets.FTP_PASSWORD }} -e "set ssl:verify-certificate no; mv ${{ secrets.FTP_SERVER_DIR }} ${{ secrets.FTP_SERVER_DIR }}.bak; mv ${{ secrets.FTP_SERVER_DIR }}-${{ github.sha }} ${{ secrets.FTP_SERVER_DIR }}; quit;" ${{ secrets.FTP_URL }}