Skip to content

Merge pull request #61 from zhangcongcobo/main #144

Merge pull request #61 from zhangcongcobo/main

Merge pull request #61 from zhangcongcobo/main #144

Workflow file for this run

name: PHP Unittest
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to run tests against'
default: develop
type: choice
options:
- develop
- prod
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Validate composer.json and composer.lock
run: composer validate
- name: Github Action for wget
uses: wei/wget@v1.1.1
with:
args: -O sample.html https://httpbin.org/html
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
php-version: 7.4
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
- name: Install dependencies
run: composer update --ignore-platform-reqs
- name: Install phpunit.phar
run: wget https://phar.phpunit.de/phpunit-9.6.phar
- name: Run test suite for ClientTest
env:
ENV: "${{ github.event.inputs.environment == 'prod' && 'prod' || 'develop'}}"
SECRET: "${{ github.event.inputs.environment == 'prod' && secrets.PRODSECRET || secrets.DEVELOPSECRET}}"
MPCSECRET: "${{secrets.DEVELOPMPCSECRET}}"
run:
php -denv=$ENV -dsecret=$SECRET phpunit-9.6.phar ClientTest.php
- name: Run test suite for MPCClientTest
env:
ENV: "${{ github.event.inputs.environment == 'prod' && 'prod' || 'develop'}}"
SECRET: "${{ github.event.inputs.environment == 'prod' && secrets.PRODSECRET || secrets.DEVELOPSECRET}}"
MPCSECRET: "${{secrets.DEVELOPMPCSECRET}}"
run:
php -denv=$ENV -dMPCApiSecret=$MPCSECRET phpunit-9.6.phar MPCClientTest.php