Skip to content

Migration of One tap to FedCM #303

Migration of One tap to FedCM

Migration of One tap to FedCM #303

on: pull_request
name: PHPUnit
jobs:
unit: #-----------------------------------------------------------------------
name: Unit test / PHP ${{ matrix.php }}
strategy:
fail-fast: false
matrix:
php: ['7.3', '7.4', '8.0']
runs-on: ubuntu-20.04
steps:
- name: Check out source code
uses: actions/checkout@v2
- name: Check existence of composer.json file
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "composer.json, phpunit.xml.dist"
- name: Set up PHP environment
if: steps.check_files.outputs.files_exists == 'true'
uses: shivammathur/setup-php@v2
with:
php-version: '${{ matrix.php }}'
coverage: xdebug
tools: composer,cs2pr
- name: Get Composer cache Directory
if: steps.check_files.outputs.files_exists == 'true'
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Use Composer cache
if: steps.check_files.outputs.files_exists == 'true'
uses: actions/cache@master
with:
path: ${{ steps['composer-cache'].outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
if: steps.check_files.outputs.files_exists == 'true'
run: COMPOSER_ROOT_VERSION=dev-master composer install --prefer-dist --no-progress --ignore-platform-reqs
- name: Setup problem matcher to provide annotations for PHPUnit
if: steps.check_files.outputs.files_exists == 'true'
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Run PHPUnit
if: steps.check_files.outputs.files_exists == 'true'
run: composer update && composer tests:unit
- name: Archive code coverage results
uses: actions/upload-artifact@v2
with:
name: code-coverage-report
path: /tmp/report/html
artifact-upload: #-----------------------------------------------------------------------
name: Push artifact to static site
runs-on: ubuntu-latest
needs: [unit]
steps:
- name: Check out gh-reports repository
uses: actions/checkout@v2
with:
repository: rtCamp/gh-reports.rt.gw
token: ${{ secrets.RTBOT_TOKEN }}
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: code-coverage-report
path: /tmp/report/html
- name: Move report into correct location
run: |
repo=$(echo ${GITHUB_REPOSITORY#rtCamp/})
rm -rf "$repo/$GITHUB_REF"
mkdir -p "$repo/$GITHUB_REF"
rsync -avhP /tmp/report/html/ "$repo/$GITHUB_REF/"
- name: Commit files
run: |
repo=$(echo ${GITHUB_REPOSITORY#rtCamp/})
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add "$repo"
git commit -m "artifcat report build: $GITHUB_REPOSITORY@$GITHUB_SHA"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.RTBOT_TOKEN }}
branch: main
repository: rtCamp/gh-reports.rt.gw
- name: Comment URL on PR
uses: unsplash/comment-on-pr@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: "Code coverage report: https://gh-reports.rt.gw/login-with-google/${{ github.ref }}/"
check_for_duplicate_msg: true