forked from AzuraCast/AzuraCast
-
Notifications
You must be signed in to change notification settings - Fork 0
200 lines (172 loc) · 5.29 KB
/
default.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: Build, Test and Publish
on:
pull_request:
branches:
- main
push:
paths-ignore:
- '*.md'
- '.github/*.yml'
- '.github/ISSUE_TEMPLATE/*.md'
- 'install.sh' # Ansible-only scripts and folders
- 'update.sh'
- 'util/ansible/**'
branches:
- ci-testing
- main
- stable
tags:
- '*'
schedule:
- cron: '0 2 * * 0' # Weekly on Sundays at 02:00
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
env:
APPLICATION_ENV: testing
NODE_ENV: production
steps:
- uses: actions/checkout@master
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: intl, xdebug
tools: composer:v2, cs2pr
- name: Cache PHP dependencies
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.OS }}-build-${{ hashFiles('composer.lock') }}
- name: Run Composer install
run: |
composer install --no-interaction --ignore-platform-reqs
- name: Run PHP Linter
run: |
vendor/bin/parallel-lint . --exclude vendor --checkstyle | cs2pr
- name: Run PHPStan
run: |
vendor/bin/phpstan analyze --memory-limit=-1 --error-format=checkstyle | cs2pr
- name: Run PHP Code Sniffer
run: |
vendor/bin/phpcs --report=checkstyle | cs2pr
prepare:
name: Prepare Codebase
needs: test
runs-on: ubuntu-latest
env:
APPLICATION_ENV: testing
NODE_ENV: production
if: github.event_name == 'push' || github.event_name == 'schedule'
steps:
- uses: actions/checkout@master
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: intl, xdebug
tools: composer:v2, cs2pr
- name: Cache PHP dependencies
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.OS }}-build-${{ hashFiles('composer.lock') }}
- name: Set console permissions and clear static assets.
run: |
rm -rf web/static/vite_dist
rm -rf translations/*.UTF-8
chmod a+x bin/console
- name: Run Composer install
run: |
composer install --no-interaction --ignore-platform-reqs
- name: Generate new translations from existing code.
run: |
cd frontend
npm ci --include=dev
cd ..
bin/console locale:generate
- name: Pull latest translations.
uses: crowdin/[email protected]
with:
upload_sources: true
download_translations: true
export_only_approved: false
push_translations: false
crowdin_branch_name: main
config: crowdin.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
- name: Import locales, build static assets.
run: |
bin/console locale:import
cd frontend
npm run build
- name: Build OpenAPI Docs
run: bin/console azuracast:api:docs
- name: Write .gitinfo File
run: |
bash util/write_git_info.sh
chmod 777 .gitinfo
- name: Upload built static assets and translations
uses: actions/upload-artifact@v4
with:
name: assets
if-no-files-found: error
path: |
.gitinfo
translations
web/static/vite_dist
web/static/api/openapi.yml
build:
name: Build & Publish
needs: prepare
permissions:
contents: read
id-token: write
packages: write
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'schedule'
steps:
- uses: actions/checkout@master
- name: Download built static assets from previous step
uses: actions/download-artifact@v4
with:
name: assets
- name: Set up Depot
uses: depot/setup-action@v1
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
azuracast/azuracast
ghcr.io/azuracast/azuracast
tags: |
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
type=ref,event=branch
type=semver,pattern={{version}}
- name: Publish to Docker Hub
uses: depot/build-push-action@v1
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}