Přidána záložka rozpočtu pro vzdělávací akce #3120
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: main | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
workdir: | |
name: "Prepare working directory" | |
runs-on: ubuntu-22.04 | |
container: | |
image: skaut/lebeda:8.1 | |
steps: | |
- uses: actions/checkout@v3 | |
# Copy & paste from https://github.com/actions/cache/blob/master/examples.md#php---composer | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- run: composer install | |
- name: Remove development docker-compose override | |
run: rm docker-compose.override.yml | |
- name: Fix permissions | |
run: chown 1000:1000 . -R && chmod 777 . -R | |
- name: Create tarball | |
run: tar -czpf /tmp/workdir.tar.gz . && mv /tmp/workdir.tar.gz . | |
- name: Upload workdir | |
uses: actions/upload-artifact@v1 | |
with: | |
name: workdir | |
path: workdir.tar.gz | |
tests-unit: | |
name: "Run unit tests" | |
runs-on: ubuntu-22.04 | |
container: | |
image: skaut/lebeda:8.1 | |
needs: workdir | |
steps: | |
- name: Download workdir | |
uses: actions/download-artifact@v1 | |
with: | |
name: workdir | |
path: . | |
- name: Extract workdir | |
run: tar -xzpf workdir.tar.gz | |
- run: phing tests-unit | |
tests-integration: | |
name: "Run integration tests" | |
runs-on: ubuntu-22.04 | |
needs: workdir | |
steps: | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
- name: Download workdir | |
uses: actions/download-artifact@v1 | |
with: | |
name: workdir | |
path: . | |
- name: Extract workdir | |
run: tar -xzpf workdir.tar.gz | |
- name: Start application containers | |
run: docker-compose up -d mysql-test | |
- run: docker-compose run -T -u www-data app phing tests-integration | |
collect-code-coverage: | |
name: "Collect code coverage" | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-22.04 | |
needs: workdir | |
steps: | |
- name: Download workdir | |
uses: actions/download-artifact@v1 | |
with: | |
name: workdir | |
path: . | |
- name: Extract workdir | |
run: tar -xzpf workdir.tar.gz | |
- name: Start application containers | |
run: docker-compose up -d app mysql-test | |
- name: Run tests with coverage | |
run: docker-compose exec -T -u www-data app phing tests-with-coverage | |
- name: Upload code coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: tests/_output/coverage.xml | |
fail_ci_if_error: true | |
tests-acceptance: | |
name: "Run acceptance tests" | |
runs-on: ubuntu-22.04 | |
needs: workdir | |
steps: | |
- name: Download workdir | |
uses: actions/download-artifact@v1 | |
with: | |
name: workdir | |
path: . | |
- name: Extract workdir | |
run: tar -xzpf workdir.tar.gz | |
- name: Start application containers | |
run: docker-compose up -d | |
- run: mv app/config/config.ci.local.neon app/config/config.local.neon | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
# Copy & paste from https://github.com/actions/cache/blob/master/examples.md#node---yarn | |
- name: Get yarn cache | |
id: yarn-cache | |
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ steps.yarn-cache.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- run: npm install -g yarn | |
- name: Build frontend assets | |
run: yarn install && yarn build | |
- name: Prepare database | |
run: docker-compose exec -T -u www-data app bin/console migrations:migrate --no-interaction | |
- run: docker-compose exec -T -u www-data app phing tests-acceptance | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: error-output | |
path: tests/_output | |
static-analysis: | |
name: "Run PHPStan analysis" | |
runs-on: ubuntu-22.04 | |
container: | |
image: skaut/lebeda:8.1 | |
needs: workdir | |
steps: | |
- name: Download workdir | |
uses: actions/download-artifact@v1 | |
with: | |
name: workdir | |
path: . | |
- name: Extract workdir | |
run: tar -xzpf workdir.tar.gz | |
- name: Generate Codeception helper code | |
run: vendor/bin/codecept build | |
- run: phing static-analysis | |
coding-standard: | |
name: "Check coding standard" | |
runs-on: ubuntu-22.04 | |
container: | |
image: skaut/lebeda:8.1 | |
needs: workdir | |
steps: | |
- name: Download workdir | |
uses: actions/download-artifact@v1 | |
with: | |
name: workdir | |
path: . | |
- name: Extract workdir | |
run: tar -xzpf workdir.tar.gz | |
- run: phing coding-standard | |
latte-lint: | |
name: "Lint Latte templates" | |
runs-on: ubuntu-22.04 | |
container: | |
image: skaut/lebeda:8.1 | |
needs: workdir | |
env: | |
DEVELOPMENT_MACHINE: true | |
steps: | |
- name: Download workdir | |
uses: actions/download-artifact@v1 | |
with: | |
name: workdir | |
path: . | |
- name: Extract workdir | |
run: tar -xzf workdir.tar.gz | |
- run: mv app/config/config.ci.local.neon app/config/config.local.neon | |
- run: vendor/bin/latte-lint app | |
validate-mapping: | |
name: "Validate mapping against migrations" | |
runs-on: ubuntu-22.04 | |
container: | |
image: skaut/lebeda:8.1 | |
needs: workdir | |
services: | |
mysql-test: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: 'root' | |
MYSQL_DATABASE: hskauting | |
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 | |
env: | |
DEVELOPMENT_MACHINE: true | |
steps: | |
- name: Download workdir | |
uses: actions/download-artifact@v1 | |
with: | |
name: workdir | |
path: . | |
- name: Extract workdir | |
run: tar -xzf workdir.tar.gz | |
- run: mv app/config/config.ci.local.neon app/config/config.local.neon | |
- run: bin/console migrations:migrate --no-interaction | |
- run: "! bin/console migrations:diff && bin/console migrations:diff --allow-empty-diff" | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: migrations | |
path: migrations | |
checks-passed: | |
name: "Wait for all checks" | |
needs: | |
- tests-unit | |
- tests-integration | |
- tests-acceptance | |
- coding-standard | |
- static-analysis | |
- latte-lint | |
- validate-mapping | |
runs-on: ubuntu-22.04 | |
container: | |
image: skaut/lebeda:8.1-ci | |
steps: | |
- run: true | |
deploy-test: | |
name: "Deploy to test-h.skauting.cz" | |
if: github.ref == 'refs/heads/master' | |
needs: [checks-passed] | |
runs-on: ubuntu-22.04 | |
container: | |
image: skaut/lebeda:8.1-ci | |
steps: | |
- name: Download workdir | |
uses: actions/download-artifact@v1 | |
with: | |
name: workdir | |
path: . | |
- name: Extract workdir | |
run: tar -xzpf workdir.tar.gz | |
- name: Setup SSH authentication | |
run: .github/workflows/setup_ssh.sh "$DEPLOY_SSH_KEY" "$SSH_KEY_FILE" | |
env: | |
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }} | |
SSH_KEY_FILE: /root/.ssh/id_key | |
# Copy & paste from https://github.com/actions/cache/blob/master/examples.md#node---yarn | |
- name: Get yarn cache | |
id: yarn-cache | |
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ steps.yarn-cache.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Setup git safe dir | |
run: git config --global --add safe.directory /__w/${GITHUB_REPOSITORY#*/}/${GITHUB_REPOSITORY#*/} | |
- name: Deploy to test-h.skauting.cz | |
run: phing deploy | |
env: | |
ENVIRONMENT: test | |
ROOT_DIR: /home/vu009010 | |
SSH_USERNAME: vu009010 | |
SSH_KEY_FILE: /root/.ssh/id_key | |
CONFIG_DATABASE_PASSWORD: ${{ secrets.CONFIG_TEST_DATABASE_PASSWORD }} | |
CONFIG_GOOGLE_CREDENTIALS: ${{ secrets.CONFIG_TEST_GOOGLE_CREDENTIALS }} | |
deploy-production: | |
name: "Deploy to h.skauting.cz" | |
if: github.ref == 'refs/heads/master' | |
needs: [checks-passed] | |
runs-on: ubuntu-22.04 | |
container: | |
image: skaut/lebeda:8.1-ci | |
steps: | |
- name: Download workdir | |
uses: actions/download-artifact@v1 | |
with: | |
name: workdir | |
path: . | |
- name: Extract workdir | |
run: tar -xzpf workdir.tar.gz | |
- name: Setup SSH authentication | |
run: .github/workflows/setup_ssh.sh "$DEPLOY_SSH_KEY" "$SSH_KEY_FILE" | |
env: | |
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }} | |
SSH_KEY_FILE: /root/.ssh/id_key | |
# Copy & paste from https://github.com/actions/cache/blob/master/examples.md#node---yarn | |
- name: Get yarn cache | |
id: yarn-cache | |
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ steps.yarn-cache.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Setup git safe dir | |
run: git config --global --add safe.directory /__w/${GITHUB_REPOSITORY#*/}/${GITHUB_REPOSITORY#*/} | |
- name: Deploy to h.skauting.cz | |
run: phing deploy | |
env: | |
ENVIRONMENT: production | |
ROOT_DIR: /home/vu008930 | |
SSH_USERNAME: vu008930 | |
SSH_KEY_FILE: /root/.ssh/id_key | |
CONFIG_DATABASE_PASSWORD: ${{ secrets.CONFIG_PRODUCTION_DATABASE_PASSWORD }} | |
CONFIG_SENTRY_DSN: ${{ secrets.CONFIG_SENTRY_DSN }} | |
CONFIG_GOOGLE_CREDENTIALS: ${{ secrets.CONFIG_PRODUCTION_GOOGLE_CREDENTIALS }} |