Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance workflows #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
name: "Markdown link check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-verbose-mode: 'yes'
Expand All @@ -20,7 +20,7 @@ jobs:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
Expand All @@ -30,7 +30,7 @@ jobs:
name: 'Yamllint'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: 'Yamllint'
uses: karancode/yamllint-github-action@master
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/php-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ on:
jobs:
checks:
runs-on: ubuntu-latest
name: PHP 8.1 - checks
name: Check application
steps:
# Setup
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: '[PHP] Setup'
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -58,10 +58,10 @@ jobs:

selenium-checks:
runs-on: ubuntu-latest
name: PHP 8.1 - selenium checks
name: Check selenium
steps:
# Setup
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: '[PHP] Setup'
uses: shivammathur/setup-php@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Block fixup commits

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Block fixup commit merge
uses: 13rac1/[email protected]
19 changes: 11 additions & 8 deletions .github/workflows/release-to-devel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ on:
jobs:
checks:
runs-on: ubuntu-latest
name: PHP checks
name: Check application
steps:
# Setup
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: '[PHP] Setup'
uses: shivammathur/setup-php@v2
Expand All @@ -38,10 +38,10 @@ jobs:

selenium-checks:
runs-on: ubuntu-latest
name: PHP 8.1 - selenium checks
name: Check selenium
steps:
# Setup
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: '[PHP] Setup'
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
environment: devel
steps:
# Setup
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# Prepare .env file
- name: '[ENV] Prepare configuration file'
Expand Down Expand Up @@ -125,14 +125,17 @@ jobs:
release:
runs-on: ubuntu-latest
name: Release deb package
timeout-minutes: 5
needs:
- checks
- download-deploy-console
- build
concurrency:
group: ${{ format('{0}-{1}', github.workflow, github.job) }}
environment: devel
steps:
# Setup
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: '[PHP] Setup PHP'
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -193,7 +196,7 @@ jobs:
# Release to devel
- name: '[RELEASE] Release deb to devel'
run: |
./deploy-console.phar d:release devel "Github release - ${{ github.ref_type }}: ${{ github.ref_name }}"
./deploy-console.phar d:release devel "Github release - ${{ github.ref_type }}: ${{ github.ref_name }}" -P

# Notify
- name: Slack Notification - success
Expand Down Expand Up @@ -229,7 +232,7 @@ jobs:
environment: devel
steps:
# Setup
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: '[PHP] Setup PHP'
uses: shivammathur/setup-php@v2
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/release-to-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ on:
jobs:
checks:
runs-on: ubuntu-latest
name: PHP checks
name: Check application
steps:
# Setup
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: '[PHP] Setup'
uses: shivammathur/setup-php@v2
Expand All @@ -41,10 +41,10 @@ jobs:

selenium-checks:
runs-on: ubuntu-latest
name: PHP 8.1 - selenium checks
name: Check selenium
steps:
# Setup
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: '[PHP] Setup'
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
environment: prod
steps:
# Setup
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# Prepare .env file
- name: '[ENV] Prepare configuration file'
Expand Down Expand Up @@ -128,14 +128,17 @@ jobs:
release:
runs-on: ubuntu-latest
name: Release deb package
timeout-minutes: 5
needs:
- checks
- download-deploy-console
- build
concurrency:
group: ${{ format('{0}-{1}', github.workflow, github.job) }}
environment: prod
steps:
# Setup
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: '[PHP] Setup PHP'
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -232,7 +235,7 @@ jobs:
environment: prod
steps:
# Setup
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: '[PHP] Setup PHP'
uses: shivammathur/setup-php@v2
Expand Down
89 changes: 89 additions & 0 deletions .github/workflows/selenium.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Selenium

on:
schedule:
- cron: '0 3 * * *'

jobs:
selenium-tests:
runs-on: ubuntu-latest
strategy:
matrix:
env: [ 'devel' ]
group: [ '' ]
include:
- { env: 'prod', group: '--group=prod-safe' }

name: Selenium tests - ${{ matrix.env }}
concurrency:
group: ${{ format('{0}-{1}', github.workflow, github.job) }}
environment: ${{ matrix.env }}
steps:
# Setup
- uses: actions/checkout@v3

- name: '[PHP] Setup PHP'
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: mbstring, intl

- name: '[INIT] Install dependencies'
working-directory: ./selenium-tests
run: composer install

# Connect to VPN
- name: '[VPN] Install Open VPN'
run: sudo apt-get install openvpn

- name: '[VPN] Connect'
uses: golfzaptw/action-connect-ovpn@master
id: connect_vpn
with:
PING_URL: '172.27.128.47'
FILE_OVPN: '.github/vpn/config.ovpn'
SECRET: ${{ secrets.VPN_USERNAME_PASSWORD }}
TLS_KEY: ''
env:
CA_CRT: ${{ secrets.VPN_CA }}
USER_CRT: ${{ secrets.VPN_CRT }}
USER_KEY: ${{ secrets.VPN_KEY }}

- name: '[VPN] Check Connection'
run: echo ${{ steps.connect_vpn.outputs.STATUS }}

# Run selenium tests
- name: '[SELENIUM] Start server'
working-directory: ./selenium-tests
run: bin/selenium-server-start

- name: '[SELENIUM] Run all ${{ matrix.env }} tests'
working-directory: ./selenium-tests
env:
API_KEY: ${{ secrets.IMAGE_API_APIKEY }}
run: ./vendor/bin/steward run -vv ${{ matrix.group }} ${{ matrix.env }} chrome

- name: '[SELENIUM] Stop server'
if: success() || failure()
working-directory: ./selenium-tests
run: bin/selenium-server-start

- name: '[ARTIFACT] Upload a result'
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: selenium-results-${{ matrix.env }}.xml
path: './selenium-tests/logs/results.xml'

# Notify
- name: Slack Notification - fail
if: failure()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: error-log
SLACK_COLOR: ${{ job.status }} # or a specific color like 'good' or '#ff00ff'
#SLACK_ICON: https://github.com/rtCamp.png?size=48
SLACK_MESSAGE: 'Selenium tests have failed :boom:'
SLACK_TITLE: Image Api - Selenium tests on ${{ matrix.env }}
SLACK_USERNAME: Github Action
SLACK_WEBHOOK: ${{ secrets.SLACK_ERROR_WEBHOOK }}
2 changes: 1 addition & 1 deletion RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function buildDeb(ConsoleIO $io, $options = ['dev-build' => false])
}

// Create prod .env file
$this->_copy($sourceDir . '/.env.prod', $appInstallDir . '/.env');
$this->_copy($sourceDir . self::ENV_PROD, $appInstallDir . '/.env');

// Generate buildinfo.xml
$this->taskBuildinfo($appInstallDir . '/var/buildinfo.xml')
Expand Down