-
Notifications
You must be signed in to change notification settings - Fork 4
151 lines (123 loc) · 4.76 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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
unit-tests:
name: "Unit tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: docker-compose up -d qualix db node mail
- uses: ./.github/actions/wait-for-container-startup
- run: docker-compose exec -T qualix php artisan config:clear --env=testing
- run: docker-compose exec -T qualix vendor/bin/phpunit
frontend-tests:
name: "Frontend tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: docker-compose up -d qualix db node mail
- uses: ./.github/actions/wait-for-container-startup
- run: docker-compose exec -T node npm run test
e2e-tests:
name: "End-to-end tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: docker-compose up -d qualix db node mail e2e-mocks
- uses: ./.github/actions/wait-for-container-startup
- run: docker-compose run e2e run
- uses: actions/upload-artifact@v2
if: always()
with:
name: cypress-output
path: |
./cypress/screenshots
./cypress/videos
ci-passed-event:
name: "Send out CI success event"
if: ${{ github.event_name == 'push' }}
needs:
- unit-tests
- frontend-tests
- e2e-tests
runs-on: ubuntu-latest
steps:
- uses: peter-evans/repository-dispatch@v1
env:
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
if: env.REPO_ACCESS_TOKEN != null
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: ci-passed
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
get-environment-name:
name: "Extract environment name"
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.extract.outputs.environment }}
steps:
- id: extract
run: echo "environment=$(echo $GITHUB_REF | sed -e '/^refs\/heads\/deploy-\(.*\)$/!d;s//\1/')" >> $GITHUB_OUTPUT
- env:
EXTRACTED: ${{ steps.extract.outputs.environment }}
run: 'echo "Extracted environment name: $EXTRACTED"'
deploy:
name: "Deploy"
if: ${{ github.event_name == 'push' && needs.get-environment-name.outputs.environment }}
needs:
- unit-tests
- frontend-tests
- e2e-tests
- get-environment-name
environment: ${{ needs.get-environment-name.outputs.environment }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: sudo apt-get update -y && sudo apt-get install -y lftp
- uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
- run: sudo apt-get update -y && sudo apt-get install -y lftp
- uses: ./.github/actions/deploy
with:
ssh-username: ${{ secrets.SSH_USERNAME }}
ssh-host: ${{ secrets.SSH_HOST }}
ssh-directory: ${{ secrets.SSH_DIRECTORY }}
app-name: ${{ secrets.APP_NAME }}
app-key: ${{ secrets.APP_KEY }}
app-url: ${{ secrets.APP_URL }}
app-contact-link: ${{ secrets.APP_CONTACT_LINK }}
app-contact-text: ${{ secrets.APP_CONTACT_TEXT }}
db-host: ${{ secrets.DB_HOST }}
db-database: ${{ secrets.DB_DATABASE }}
db-username: ${{ secrets.DB_USERNAME }}
db-password: ${{ secrets.DB_PASSWORD }}
mail-mailer: ${{ secrets.MAIL_MAILER }}
mail-host: ${{ secrets.MAIL_HOST }}
mail-port: ${{ secrets.MAIL_PORT }}
mail-username: ${{ secrets.MAIL_USERNAME }}
mail-password: ${{ secrets.MAIL_PASSWORD }}
mail-from-address: ${{ secrets.MAIL_FROM_ADDRESS }}
hitobito-base-url: ${{ secrets.HITOBITO_BASE_URL }}
hitobito-client-uid: ${{ secrets.HITOBITO_CLIENT_UID }}
hitobito-client-secret: ${{ secrets.HITOBITO_CLIENT_SECRET }}
collaboration-enabled: ${{ secrets.COLLABORATION_ENABLED }}
collaboration-signaling-servers: ${{ secrets.COLLABORATION_SIGNALING_SERVERS }}
sentry-laravel-dsn: ${{ secrets.SENTRY_LARAVEL_DSN }}
sentry-user-feedback-url: ${{ secrets.SENTRY_USER_FEEDBACK_URL }}
sentry-csp-report-uri: ${{ secrets.SENTRY_CSP_REPORT_URI }}
sentry-vue-dsn: ${{ secrets.SENTRY_VUE_DSN }}
- uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_RELEASE_TRACKING_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
if: env.SENTRY_AUTH_TOKEN != null
with:
environment: ${{ needs.get-environment-name.outputs.environment }}
projects: ${{ secrets.SENTRY_PROJECTS }}
ignore_missing: true
ignore_empty: true