add condition to checkout #307
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: vaas-php-ci | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "php/**" | |
- ".github/workflows/ci-php.yaml" | |
tags: | |
- "php*" | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "php/**" | |
- ".github/workflows/ci-php.yaml" | |
workflow_dispatch: | |
jobs: | |
build-php: | |
name: Build & Test PHP SDK | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
version: ["7.4", "8.0", "8.1", "8.2"] | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: setup PHP with PECL extension | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.version }} | |
- name: install php dependencies | |
uses: php-actions/composer@v6 | |
with: | |
working_dir: php/tests/vaas | |
php_version: ${{ matrix.version }} | |
- name: run tests | |
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/php') | |
env: | |
CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | |
VAAS_URL: "wss://gateway.production.vaas.gdatasecurity.de" | |
TOKEN_URL: "https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token" | |
run: ./vendor/bin/phpunit --colors --testdox | |
working-directory: php/tests/vaas | |
- name: run tests staging | |
if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/php') | |
env: | |
CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
CLIENT_SECRET: ${{ secrets.STAGING_CLIENT_SECRET }} | |
VAAS_URL: "wss://gateway.staging.vaas.gdatasecurity.de" | |
TOKEN_URL: "https://account-staging.gdata.de/realms/vaas-staging/protocol/openid-connect/token" | |
run: ./vendor/bin/phpunit --colors --testdox | |
working-directory: php/tests/vaas | |
- name: install example requirements | |
run: composer install | |
working-directory: php/examples/VaasExample | |
- name: run example (scan file) | |
env: | |
CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | |
SCAN_PATH: "GetVerdictByFile.php" | |
run: php GetVerdictByFile.php | |
working-directory: php/examples/VaasExample | |
- name: run example (scan url) | |
env: | |
CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | |
run: php GetVerdictByUrl.php | |
working-directory: php/examples/VaasExample | |
- name: run example (scan hash) | |
env: | |
CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | |
run: php GetVerdictByHash.php | |
working-directory: php/examples/VaasExample | |
- name: Microsoft Teams Notification | |
uses: skitionek/notify-microsoft-teams@master | |
if: failure() | |
with: | |
webhook_url: ${{ secrets.MSTEAMS_WEBHOOK }} | |
overwrite: "{title: `Failed workflow on for VaaS-SDK ${workflow}`, sections: [{activityTitle: 'build failed', activitySubtitle: `Failed workflow on for VaaS-SDK ${workflow}`, activityImage: 'https://adaptivecards.io/content/cats/3.png'}], themeColor: '#ff0000'}" |