Skip to content

Novieten filter aan #1755

Novieten filter aan

Novieten filter aan #1755

Workflow file for this run

name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
name: Build JavaScript
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 🗃 Cache Yarn
id: yarn-cache
uses: actions/cache@v3
with:
path: |
.yarn
.pnp.cjs
.pnp.loader.mjs
!.yarn/.cache
# De cache wordt alleen naderhand opgeslagen als yarn.lock veranderd is
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
# De cache wordt opgehaald als os hetzelfde is (altijd)
restore-keys: ${{ runner.os }}-yarn-
- name: Install yarn dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
- name: 🗃 Cache cache-loader
uses: actions/cache@v3
with:
path: .yarn/.cache
# De cache wordt alleen naderhand opgeslagen als yarn.lock + alle assets zijn veranderd
key: ${{ runner.os }}-cache-loader-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}-${{ hashFiles('assets/**') }}
# De cache wordt opgehaald als yarn.lock niet veranderd is
restore-keys: ${{ runner.os }}-cache-loader-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}-
- name: 🔧 Run yarn build
run: yarn run production
- name: 📤 Upload dist
uses: actions/upload-artifact@v3
with:
name: js
path: htdocs/dist
test:
name: Voer tests uit
runs-on: ubuntu-latest
needs: build
steps:
- name: 💤 Shutdown Ubuntu MySQL (SUDO)
run: sudo service mysql stop # Shutdown the Default MySQL, "sudo" is necessary, please not remove it
- uses: getong/[email protected]
with:
mariadb version: '10.3'
mysql root password: ''
- uses: actions/checkout@v3
- name: 🗃 Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-composer-dev-${{ hashFiles('**/composer.lock', '**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-dev-
- name: 🗃 Cache phpunit installatie
id: phpunit-cache
uses: actions/cache@v3
with:
path: bin/.phpunit
key: ${{ runner.os }}-phpunit-dev-${{ hashFiles('**/composer.lock', '**/composer.json') }}
restore-keys: |
${{ runner.os }}-phpunit-dev-
- name: Install Composer packages
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install
- name: 📥 Download JS
uses: actions/download-artifact@v3
with:
name: js
path: htdocs/dist
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.3
tools: composer:v2
extensions: pdo_mysql
- name: 💽 Setup database
run: |
php bin/console doctrine:database:create -n
php bin/console doctrine:migrations:migrate -n
php bin/console doctrine:fixtures:load -n
- name: Valideer schema
run: php bin/console doctrine:schema:validate
- name: Dump schema SQL fouten
if: ${{ failure() }}
run: php bin/console doctrine:schema:update --dump-sql
- name: 🧪 Run PhpUnit
env:
PANTHER_CHROME_ARGUMENTS: '--disable-dev-shm-usage'
PANTHER_CHROME_DRIVER_BINARY: '/usr/bin/chromedriver'
PANTHER_NO_SANDBOX: '1'
run: php bin/phpunit
- name: 📤 Upload screenshot van fout
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: screenshot
path: screenshot
deploy:
name: Push naar productie
runs-on: ubuntu-latest
needs: build
# Deze workflow gebruikt een geheime token: PRODUCTIE_KEY en kan niet van een fork gerund worden.
if: github.repository == 'csrdelft/csrdelft.nl' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
with:
submodules: true
path: main
- name: 🗃 Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: main/vendor
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock', '**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Composer packages
working-directory: main
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --no-dev --optimize-autoloader
- name: 📥 Pull productie
uses: actions/checkout@v3
with:
path: productie
repository: csrdelft/productie
token: ${{ secrets.PRODUCTIE_KEY }}
- name: Prepareer productie repo
working-directory: productie
run: |
rm -r *
rsync --archive --exclude-from=../main/bin/ci/rsync-exclude.txt ../main/ ./
mv bin/ci/.gitignore.prod .gitignore
- name: 📥 Download JS
uses: actions/download-artifact@v3
with:
name: js
path: productie/htdocs/dist
- name: 📩 Push naar productie
if: github.ref == 'refs/heads/master' # dubbel check
working-directory: productie
run: |
git config user.name "PubCie"
git config user.email "[email protected]"
git add -A
git diff-index --quiet HEAD || git commit -m "Stek deploy $GITHUB_RUN_NUMBER van csrdelft/csrdelft.nl@$GITHUB_SHA"
git push --force --quiet --set-upstream origin master
translation:
name: Controleer vertalingen
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 🗃 Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-composer-dev-${{ hashFiles('**/composer.lock', '**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-dev-
- name: Install Composer packages
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.3
tools: composer:v2
extensions: pdo_mysql
- name: Check translations
run: |
php bin/console translation:update en --force
git diff --exit-code || exit 1