-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (90 loc) · 3.15 KB
/
pull_request.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: CI
on: [ push ]
# [ ] Проверить зависимости при помощи OWASP Dependency Check
# 4. Собрать docker образ
# 5. Подключиться по SSH до dev.muse.kiryuxa.com
# 6. Поднять докер контейнер на порту + поменять реверс проксю чтобы перекидывало с dev.muse.kiryuxa.com -> localhost:59195
# Готово!
jobs:
linter:
runs-on: ubuntu-22.04
steps:
- name: Set up JDK 17 (Temurin)
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0'
- name: Checkout Code
uses: actions/checkout@v4
- name: Run linter
run: ./tools/scripts/runLinter.sh
static-analyzer:
runs-on: ubuntu-22.04
steps:
- name: Set up JDK 17 (Temurin)
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0'
- name: Checkout Code
uses: actions/checkout@v4
- name: Run static analyzer
run: ./tools/scripts/runStaticAnalyzer.sh
unit-tests:
runs-on: ubuntu-22.04
permissions:
contents: read
issues: read
checks: write
pull-requests: write
steps:
- name: Set up JDK 17 (Temurin)
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0'
- name: Checkout Code
uses: actions/checkout@v4
- name: Run Unit Tests
run: ./tools/scripts/runUnitTests.sh
- name: Publish Unit Test Results
if: always()
uses: EnricoMi/[email protected]
with:
files: ./**/**/build/test-results/**/*.xml
report_individual_runs: true
- name: Gather reports
uses: actions/upload-artifact@v2
if: always()
with:
name: reports
path: ./**/**/build/reports
deploy:
runs-on: ubuntu-22.04
needs: [ "linter", "static-analyzer", "unit-tests" ]
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub via token
run: sudo docker login -u myshx -p ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build Server Docker Image
run: |
./tools/scripts/buildJar.sh
sudo docker build . -t myshx/muse-server:${{ github.sha }}
- name: Push Server Docker Image
run: sudo docker push myshx/muse-server:${{ github.sha }}
- name: Run Server docker image at home lab
uses: appleboy/[email protected]
env:
COMMIT_SHA: ${{ github.sha }}
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
port: ${{ secrets.SERVER_PORT }}
envs: COMMIT_SHA
script: |
sudo docker stop $(sudo docker ps --filter ancestor=muse-server -q)
sudo docker rm $(sudo docker ps --filter ancestor=muse-server -q)
sudo docker rmi $(sudo docker ps --filter ancestor=muse-server -q)
sudo docker run "myshx/muse-server:COMMIT_SHA" -p 50505:80