Repository navigation
106 lines (98 loc) · 3.52 KB
/
Copy pathci.yml
File metadata and controls
106 lines (98 loc) · 3.52 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
name: CI pipeline
on: [ push, pull_request ]
permissions:
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: npm ci --force
- name: Run Linter
run: npm run lint
validate-json:
name: Validate JSON
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get install jsonlint
sudo npm install -g ajv-cli
- name: Validate JSON structure
run: jsonlint-php src/assets/data.json
- name: Validate JSON schema
run: ajv validate -s src/assets/data.schema.json -d src/assets/data.json --spec=draft2020 --verbose
unit:
name: Unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: npm ci --force
- name: Run frontend Unit tests
run: npm run test
e2e:
name: E2E tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: npm ci --force
- name: Run End to End tests
run: npm run e2e
- name: Upload videos
uses: actions/upload-artifact@v3
with:
name: e2e-videos
path: cypress/videos
build:
name: Build UI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install dependencies
run: npm ci --force
- name: Print last modification date
run: echo $(git log -1 src/assets/data.json)
- name: Replace last modified date
run: sed -i "s/%LAST_MODIFIED%/$(git log -1 --pretty="format:%cI" src/assets/data.json)/g" src/environments/environment.prod.ts
- name: Build UI
run: npm run build
- name: Stash bundle
uses: actions/upload-artifact@v3
with:
name: bundle
path: dist/custom-rom-list/
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [validate-json, unit, e2e, build]
if: github.ref == 'refs/heads/master'
steps:
- name: Unstash bundle
uses: actions/download-artifact@v3
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 }}