91 lines
2.8 KiB
YAML
91 lines
2.8 KiB
YAML
name: Build, Test and Publish
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
push:
|
|
paths-ignore:
|
|
- '.github'
|
|
branches:
|
|
- ci-testing
|
|
- master
|
|
- stable
|
|
schedule:
|
|
- cron: '0 2 * * 0' # Weekly on Sundays at 02:00
|
|
|
|
jobs:
|
|
build:
|
|
name: Build, Test and Publish
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@master
|
|
- name: Reduce Git repository size.
|
|
run: |
|
|
git gc --prune=now --aggressive
|
|
|
|
- name: Cache PHP dependencies
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: vendor
|
|
key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }}
|
|
|
|
- name: Clear existing assets and set permissions.
|
|
run: |
|
|
rm -rf resources/locale/compiled
|
|
rm -rf resources/locale/*.UTF-8
|
|
rm -rf resources/locale/translations.json
|
|
rm -rf web/static/dist
|
|
rm -rf web/static/assets.json
|
|
mkdir -p resources/locale/compiled
|
|
chmod a+x bin/console
|
|
|
|
- name: Pull latest translations.
|
|
uses: crowdin/github-action@1.0.6
|
|
with:
|
|
upload_translations: false
|
|
download_translations: true
|
|
export_only_approved: false
|
|
push_translations: false
|
|
crowdin_branch_name: master
|
|
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: |
|
|
docker pull azuracast/azuracast_web_v2:latest
|
|
docker build --cache-from azuracast/azuracast_web_v2:latest -t azuracast/azuracast_web_v2:latest .
|
|
|
|
cp azuracast.sample.env azuracast.env
|
|
cp docker-compose.sample.yml docker-compose.yml
|
|
cp docker-compose.testing.yml docker-compose.override.yml
|
|
|
|
docker-compose build web
|
|
docker-compose run --rm --user="azuracast" web azuracast_install
|
|
|
|
- name: Run functional test suite.
|
|
run: |
|
|
chmod 777 tests/_output/
|
|
docker-compose run --rm --user="azuracast" web composer dev-test
|
|
|
|
- name: Echo test output directory
|
|
if: failure()
|
|
run: |
|
|
cat tests/_output/*
|
|
|
|
- name: Publish to Docker Hub
|
|
uses: docker/build-push-action@v1
|
|
if: github.event_name == 'push' || github.event_name == 'schedule'
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
repository: azuracast/azuracast_web_v2
|
|
cache_froms: azuracast/azuracast_web_v2:latest
|
|
tag_with_ref: true
|
|
push: true
|