Skip to content

Commit

Permalink
GH Actions workflow setup
Browse files Browse the repository at this point in the history
  • Loading branch information
dakujem committed Jan 17, 2022
1 parent 88d0d1b commit e678846
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 32 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/php-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Test Suite

on:
# Controls when the action will be triggered.
push: # A push to any branch.
pull_request: # A pull request to the main/master branch.
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "test"
php-tests:
# The type of runner that the job will run on
runs-on: ubuntu-latest

strategy:
matrix:
php-versions: [ '7.4', '8.0', '8.1' ]

# Steps represent a sequence of tasks that will be executed as part of the job
name: Run tests @ PHP ${{ matrix.php-versions }}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
# extensions: json
# ini-values: "post_max_size=256M" #optional

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run TEST suite
run: composer run-script test:ci -- -C

# Note to future dev:
# We don't need "lowest dependencies" because there are none.
# I gave up on Coveralls since I have no idea how to set it up. Pity.
#
# lowest-deps:
# name: Lowest dependencies
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: shivammathur/setup-php@v2
# with:
# php-version: 7.4
# coverage: none
# - run: composer update --prefer-dist --no-progress --prefer-lowest --prefer-stable
# - name: Run TEST suite
# run: composer run-script test:ci -- -C
#
#
# coverage:
# name: Coverage report
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: shivammathur/setup-php@v2
# with:
# php-version: 8.0
# coverage: none
# - name: Install dependencies
# run: composer install --prefer-dist --no-progress
# - name: Generate coverage report
# run: composer run-script test:ci -- -C -p phpdbg --coverage tests/output/clover.xml --coverage-src src
#
# # https://github.com/php-coveralls/php-coveralls/#github-actions
# - name: Upload coverage report to Coveralls
# env:
# COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# composer global require php-coveralls/php-coveralls
# php-coveralls --coverage_clover=tests/output/clover.xml -v --json_path=tests/output/
#
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"php": "^8.0 || ^7.4"
},
"require-dev": {
"nette/tester": "^2",
"nette/tester": "^2.4.1",
"tracy/tracy": "^2.3"
},
"autoload": {
Expand All @@ -25,6 +25,6 @@
"scripts": {
"test": "@test:local",
"test:local": "tester tests -C",
"test:ci": "tester tests -C --coverage tests/output/clover.xml --coverage-src src"
"test:ci": "tester tests"
}
}
4 changes: 3 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Oliva Tree

[![PHP from Packagist](https://img.shields.io/packagist/php-v/oliva/tree)](https://packagist.org/packages/oliva/tree)
[![Build Status](https://travis-ci.com/dakujem/oliva-tree.svg?branch=master)](https://travis-ci.com/dakujem/oliva-tree)
[![Tests](https://github.com/dakujem/oliva-tree/actions/workflows/php-test.yml/badge.svg)](https://github.com/dakujem/oliva-tree/actions/workflows/php-test.yml)
<!--
[![Coverage Status](https://coveralls.io/repos/github/dakujem/oliva-tree/badge.svg?branch=master)](https://coveralls.io/github/dakujem/oliva-tree?branch=master)
-->

Utility for handling tree data structures.

Expand Down

0 comments on commit e678846

Please sign in to comment.