2021-02-12 00:27:32 +00:00
|
|
|
name : Build, Test and Publish
|
|
|
|
on :
|
|
|
|
pull_request :
|
|
|
|
branches :
|
2021-02-11 02:52:15 +00:00
|
|
|
- main
|
2021-02-12 00:27:32 +00:00
|
|
|
push :
|
|
|
|
paths-ignore :
|
2020-07-06 16:59:45 +00:00
|
|
|
- '.github/*.yml'
|
|
|
|
- '.github/ISSUE_TEMPLATE/*.md'
|
|
|
|
- 'install.sh' # Ansible-only scripts and folders
|
|
|
|
- 'update.sh'
|
|
|
|
- 'util/ansible/**'
|
2021-02-12 00:27:32 +00:00
|
|
|
branches :
|
2020-05-30 01:36:49 +00:00
|
|
|
- ci-testing
|
2021-02-11 02:52:15 +00:00
|
|
|
- main
|
2020-05-21 07:17:16 +00:00
|
|
|
- stable
|
2021-02-12 00:27:32 +00:00
|
|
|
schedule :
|
|
|
|
- cron : '0 2 * * 0' # Weekly on Sundays at 02:00
|
|
|
|
|
|
|
|
jobs :
|
|
|
|
build :
|
2021-03-26 22:00:30 +00:00
|
|
|
name : Build and Test
|
2021-02-12 00:27:32 +00:00
|
|
|
runs-on : ubuntu-latest
|
|
|
|
steps :
|
|
|
|
- uses : actions/checkout@master
|
|
|
|
|
|
|
|
- name : Reduce Git repository size.
|
|
|
|
run : |
|
2020-01-31 06:55:24 +00:00
|
|
|
git gc --prune=now --aggressive
|
2020-05-29 01:01:29 +00:00
|
|
|
|
2021-02-12 00:27:32 +00:00
|
|
|
- name : Cache PHP dependencies
|
|
|
|
uses : actions/cache@v2
|
|
|
|
with :
|
|
|
|
path : vendor
|
|
|
|
key : ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }}
|
|
|
|
|
|
|
|
- name : Set console permissions and clear static assets.
|
|
|
|
run : |
|
2020-09-20 17:49:41 +00:00
|
|
|
rm -rf web/static/dist
|
2021-03-26 22:44:13 +00:00
|
|
|
rm -rf web/static/webpack.json
|
2020-09-20 17:49:41 +00:00
|
|
|
rm -rf web/static/assets.json
|
|
|
|
chmod a+x bin/console
|
|
|
|
|
2021-02-12 00:27:32 +00:00
|
|
|
- name : Clear existing locales.
|
|
|
|
if : github.event_name == 'push' || github.event_name == 'schedule'
|
|
|
|
run : |
|
2020-05-29 01:01:29 +00:00
|
|
|
rm -rf resources/locale/compiled
|
|
|
|
rm -rf resources/locale/*.UTF-8
|
|
|
|
rm -rf resources/locale/translations.json
|
|
|
|
mkdir -p resources/locale/compiled
|
2020-05-30 01:36:49 +00:00
|
|
|
|
2021-02-12 00:27:32 +00:00
|
|
|
- name : Generate new translations from existing code.
|
|
|
|
if : github.event_name == 'push' || github.event_name == 'schedule'
|
|
|
|
uses : ./.github/actions/generate-locales
|
|
|
|
|
|
|
|
- name : Pull latest translations.
|
|
|
|
if : github.event_name == 'push' || github.event_name == 'schedule'
|
|
|
|
uses : crowdin/github-action@1.0.18
|
|
|
|
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.
|
|
|
|
uses : ./.github/actions/build
|
|
|
|
|
|
|
|
- name : Set up functional test environment.
|
|
|
|
run : |
|
2021-02-12 16:36:36 +00:00
|
|
|
docker pull azuracast/azuracast_web_v2:latest
|
|
|
|
docker build --cache-from azuracast/azuracast_web_v2:latest -t azuracast/azuracast_web_v2:latest .
|
|
|
|
|
2020-05-29 01:01:29 +00:00
|
|
|
cp azuracast.sample.env azuracast.env
|
|
|
|
cp docker-compose.sample.yml docker-compose.yml
|
|
|
|
cp docker-compose.testing.yml docker-compose.override.yml
|
|
|
|
|
2020-05-30 01:36:49 +00:00
|
|
|
docker-compose build web
|
2020-08-25 21:21:25 +00:00
|
|
|
docker-compose run --rm --user="azuracast" web azuracast_install
|
2020-05-29 01:01:29 +00:00
|
|
|
|
2021-02-12 00:27:32 +00:00
|
|
|
- name : Run functional test suite.
|
|
|
|
run : |
|
2020-05-29 01:01:29 +00:00
|
|
|
chmod 777 tests/_output/
|
2021-03-11 03:26:47 +00:00
|
|
|
chmod 777 tests/_support/_generated
|
2020-08-25 21:21:25 +00:00
|
|
|
docker-compose run --rm --user="azuracast" web composer dev-test
|
2020-08-25 19:44:22 +00:00
|
|
|
|
2021-02-12 00:27:32 +00:00
|
|
|
- name : Stop all running containers.
|
|
|
|
run : |
|
2020-08-25 19:44:22 +00:00
|
|
|
docker-compose down
|
2020-05-29 01:01:29 +00:00
|
|
|
|
2021-02-12 00:27:32 +00:00
|
|
|
- name : Echo test output directory
|
|
|
|
if : failure()
|
|
|
|
run : |
|
2020-05-29 01:01:29 +00:00
|
|
|
cat tests/_output/*
|
|
|
|
|
2021-03-26 22:00:30 +00:00
|
|
|
- name : Upload built static assets and translations
|
|
|
|
uses : actions/upload-artifact@v2
|
|
|
|
with :
|
|
|
|
name : assets
|
|
|
|
if-no-files-found : error
|
|
|
|
path : |
|
|
|
|
resources/locale/compiled
|
|
|
|
resources/locale/translations.json
|
|
|
|
web/static/dist
|
2021-03-26 22:44:13 +00:00
|
|
|
web/static/webpack.json
|
2021-03-26 22:00:30 +00:00
|
|
|
web/static/assets.json
|
|
|
|
|
|
|
|
publish :
|
|
|
|
name : Publish
|
2021-03-26 22:01:45 +00:00
|
|
|
needs : build
|
2021-03-26 22:00:30 +00:00
|
|
|
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@v2
|
|
|
|
with :
|
|
|
|
name : assets
|
|
|
|
|
2021-03-26 20:50:34 +00:00
|
|
|
- name : Set up QEMU
|
|
|
|
uses : docker/setup-qemu-action@v1
|
|
|
|
|
|
|
|
- name : Set up Docker Buildx
|
|
|
|
uses : docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
- name : Login to DockerHub
|
|
|
|
uses : docker/login-action@v1
|
|
|
|
with :
|
|
|
|
username : ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password : ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
2021-02-12 00:43:51 +00:00
|
|
|
- name : Determine Tag Name
|
|
|
|
id : tag
|
|
|
|
run : |
|
2021-02-12 00:55:53 +00:00
|
|
|
BRANCH_NAME=${GITHUB_REF#refs/heads/}
|
2021-02-12 00:43:51 +00:00
|
|
|
if [ $BRANCH_NAME == 'main' ]; then
|
2021-02-12 01:46:36 +00:00
|
|
|
BRANCH_NAME="latest"
|
2021-02-12 00:43:51 +00:00
|
|
|
fi
|
2021-02-12 00:27:32 +00:00
|
|
|
|
2021-02-12 01:46:36 +00:00
|
|
|
echo "::set-output name=TAG::${BRANCH_NAME}"
|
|
|
|
|
2021-02-12 00:55:53 +00:00
|
|
|
- name : Publish to Docker Hub
|
2021-03-26 20:50:34 +00:00
|
|
|
uses : docker/build-push-action@v2
|
2021-02-12 00:27:32 +00:00
|
|
|
with :
|
2021-03-26 20:50:34 +00:00
|
|
|
context : .
|
|
|
|
platforms : linux/amd64,linux/arm64
|
|
|
|
cache-from : type=registry,ref=azuracast/azuracast_web_v2:${{ steps.tag.outputs.TAG }}
|
|
|
|
tags : azuracast/azuracast_web_v2:${{ steps.tag.outputs.TAG }}
|
2021-02-12 00:27:32 +00:00
|
|
|
push : true
|