Skip to content

Commit a8cfd39

Browse files
ozayr-zaviarmnoman09msohailhussain
authored
feat: updated for fsc git action (#251)
* Moving lint, unit test and FSC test to gitAction * Adding integration test yml * Delete travis.yml * Added fail-fast false * Commented coveralls for now as it requires token * Added source clear cron job * Updated service name * Added back coveralls coverage upload stage * variables and branch changed * Update .github/workflows/integration_test.yml Co-authored-by: Muhammad Noman <[email protected]> Co-authored-by: Mirza Sohail Hussain <[email protected]>
1 parent 6692337 commit a8cfd39

File tree

5 files changed

+127
-54
lines changed

5 files changed

+127
-54
lines changed

Diff for: .coveralls.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
service_name: travis-ci
1+
service_name: php-coveralls

Diff for: .github/workflows/integration_test.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Reusable action of running integration of production suite
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
CI_USER_TOKEN:
7+
required: true
8+
TRAVIS_COM_TOKEN:
9+
required: true
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
with:
16+
# You should create a personal access token and store it in your repository
17+
token: ${{ secrets.CI_USER_TOKEN }}
18+
repository: 'optimizely/travisci-tools'
19+
path: 'home/runner/travisci-tools'
20+
ref: 'master'
21+
- name: set SDK Branch if PR
22+
if: ${{ github.event_name == 'pull_request' }}
23+
run: |
24+
echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
25+
- name: set SDK Branch if not pull request
26+
if: ${{ github.event_name != 'pull_request' }}
27+
run: |
28+
echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
29+
echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
30+
- name: Trigger build
31+
env:
32+
SDK: php
33+
FULLSTACK_TEST_REPO: ${{ inputs.FULLSTACK_TEST_REPO }}
34+
BUILD_NUMBER: ${{ github.run_id }}
35+
TESTAPP_BRANCH: master
36+
GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }}
37+
EVENT_TYPE: ${{ github.event_name }}
38+
GITHUB_CONTEXT: ${{ toJson(github) }}
39+
#REPO_SLUG: ${{ github.repository }}
40+
PULL_REQUEST_SLUG: ${{ github.repository }}
41+
UPSTREAM_REPO: ${{ github.repository }}
42+
PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }}
43+
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
44+
UPSTREAM_SHA: ${{ github.sha }}
45+
TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
46+
EVENT_MESSAGE: ${{ github.event.message }}
47+
HOME: 'home/runner'
48+
run: |
49+
echo "$GITHUB_CONTEXT"
50+
home/runner/travisci-tools/trigger-script-with-status-update.sh

Diff for: .github/workflows/php.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: PHP
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
linting:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Set up PHP 7.0
15+
uses: shivammathur/setup-php@v2
16+
with:
17+
php-version: '7.0'
18+
- name: Install php code sniffer
19+
run: composer require "squizlabs/php_codesniffer=*"
20+
- name: Run linting
21+
run: composer lint
22+
23+
integration_tests:
24+
uses: optimizely/php-sdk/.github/workflows/integration_test.yml@uzair/test-with-fsc
25+
secrets:
26+
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
27+
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
28+
29+
unit_tests:
30+
runs-on: ubuntu-latest
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
php-versions: [ '5.5', '5.6', '7.0', '7.1', '7.2', '7.3' ]
35+
steps:
36+
- uses: actions/checkout@v3
37+
- name: Set up PHP ${{ matrix.ruby }}
38+
uses: shivammathur/setup-php@v2
39+
with:
40+
php-version: ${{ matrix.php-versions }}
41+
- name: Cache Composer packages
42+
id: composer-cache
43+
uses: actions/cache@v3
44+
with:
45+
path: vendor
46+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
47+
restore-keys: |
48+
${{ runner.os }}-php-
49+
- name: Install dependencies
50+
run: composer install
51+
- name: run tests
52+
run: |
53+
mkdir -p build/logs
54+
./vendor/bin/phpunit --coverage-clover build/logs/clover.xml
55+
- name: Upload coverage results to Coveralls
56+
env:
57+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
run: |
59+
composer global require php-coveralls/php-coveralls
60+
php-coveralls --coverage_clover=build/logs/clover.xml -v

Diff for: .github/workflows/source_clear_cron.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Source clear
2+
3+
on:
4+
schedule:
5+
# Runs "weekly"
6+
- cron: '0 0 * * 0'
7+
8+
jobs:
9+
source_clear:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Source clear scan
14+
env:
15+
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
16+
run: curl -sSL https://download.sourceclear.com/ci.sh | bash -s – scan

Diff for: .travis.yml

-53
This file was deleted.

0 commit comments

Comments
 (0)