Skip to content

Commit 3002daf

Browse files
committed
Migrate from Travis to Github Actions
1 parent d1ca432 commit 3002daf

3 files changed

Lines changed: 208 additions & 48 deletions

File tree

.github/workflows/php.yml

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ '**' ]
6+
pull_request:
7+
branches: [ master, development, release-* ]
8+
9+
jobs:
10+
basic-tests:
11+
name: Syntax and unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}
12+
runs-on: ${{ matrix.operating-system }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
operating-system: [ubuntu-latest, windows-latest]
17+
php-versions: ['7.4', '8.0']
18+
19+
steps:
20+
- name: Setup PHP, with composer and extensions
21+
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
22+
with:
23+
php-version: ${{ matrix.php-versions }}
24+
extensions: ldap, mbstring, xml
25+
tools: composer:v2
26+
coverage: pcov
27+
28+
- name: Setup problem matchers for PHP
29+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
30+
31+
- name: Setup problem matchers for PHPUnit
32+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
33+
34+
- name: Set git to use LF
35+
run: |
36+
git config --global core.autocrlf false
37+
git config --global core.eol lf
38+
39+
- uses: actions/checkout@v2
40+
41+
- name: Get composer cache directory
42+
id: composer-cache
43+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
44+
45+
- name: Cache composer dependencies
46+
uses: actions/cache@v1
47+
with:
48+
path: ${{ steps.composer-cache.outputs.dir }}
49+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
50+
restore-keys: ${{ runner.os }}-composer-
51+
52+
- name: Validate composer.json and composer.lock
53+
run: composer validate
54+
55+
- name: Install Composer dependencies
56+
run: composer install --no-progress --prefer-dist --optimize-autoloader
57+
58+
- name: Syntax check PHP
59+
run: bash vendor/bin/check-syntax-php.sh
60+
61+
- name: Decide whether to run code coverage or not
62+
if: ${{ matrix.php-versions != '7.4' || matrix.operating-system != 'ubuntu-latest' }}
63+
run: |
64+
echo "NO_COVERAGE=--no-coverage" >> $GITHUB_ENV
65+
66+
- name: Run unit tests
67+
run: |
68+
echo $NO_COVERAGE
69+
./vendor/bin/phpunit $NO_COVERAGE
70+
71+
- name: Save coverage data
72+
if: ${{ matrix.php-versions == '7.4' && matrix.operating-system == 'ubuntu-latest' }}
73+
uses: actions/upload-artifact@v1
74+
with:
75+
name: build-data
76+
path: ${{ github.workspace }}/build
77+
78+
security:
79+
name: Security checks
80+
runs-on: [ubuntu-latest]
81+
steps:
82+
- name: Setup PHP, with composer and extensions
83+
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
84+
with:
85+
php-version: '7.4'
86+
tools: composer:v2
87+
extensions: ldap, mbstring, xml
88+
coverage: none
89+
90+
- name: Setup problem matchers for PHP
91+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
92+
93+
- uses: actions/checkout@v2
94+
95+
- name: Get composer cache directory
96+
id: composer-cache
97+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
98+
99+
- name: Cache composer dependencies
100+
uses: actions/cache@v1
101+
with:
102+
path: ${{ steps.composer-cache.outputs.dir }}
103+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
104+
restore-keys: ${{ runner.os }}-composer-
105+
106+
- name: Install Composer dependencies
107+
run: composer install --no-progress --prefer-dist --optimize-autoloader
108+
109+
- name: Security check for locked dependencies
110+
uses: symfonycorp/security-checker-action@v2
111+
112+
- name: Update Composer dependencies
113+
run: composer update --no-progress --prefer-dist --optimize-autoloader
114+
115+
- name: Security check for updated dependencies
116+
uses: symfonycorp/security-checker-action@v2
117+
118+
sanity-check:
119+
name: Sanity checks
120+
runs-on: [ubuntu-latest]
121+
122+
steps:
123+
- name: Setup PHP, with composer and extensions
124+
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
125+
with:
126+
php-version: '7.4'
127+
tools: composer:v2
128+
extensions: ldap, mbstring, xml
129+
coverage: none
130+
131+
- name: Setup problem matchers for PHP
132+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
133+
134+
- uses: actions/checkout@v2
135+
136+
- name: Get composer cache directory
137+
id: composer-cache
138+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
139+
140+
- name: Cache composer dependencies
141+
uses: actions/cache@v1
142+
with:
143+
path: ${{ steps.composer-cache.outputs.dir }}
144+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
145+
restore-keys: ${{ runner.os }}-composer-
146+
147+
- name: Install Composer dependencies
148+
run: composer install --no-progress --prefer-dist --optimize-autoloader
149+
150+
- name: Syntax check YAML / XML / JSON
151+
run: |
152+
bash vendor/bin/check-syntax-yaml.sh
153+
bash vendor/bin/check-syntax-xml.sh
154+
bash vendor/bin/check-syntax-json.sh
155+
156+
quality:
157+
name: Quality control
158+
runs-on: [ubuntu-latest]
159+
needs: [basic-tests]
160+
161+
steps:
162+
- name: Setup PHP, with composer and extensions
163+
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
164+
with:
165+
php-version: '7.4'
166+
tools: composer:v2
167+
extensions: ldap, mbstring, xml
168+
169+
- name: Setup problem matchers for PHP
170+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
171+
172+
- uses: actions/checkout@v2
173+
174+
- name: Get composer cache directory
175+
id: composer-cache
176+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
177+
178+
- name: Cache composer dependencies
179+
uses: actions/cache@v1
180+
with:
181+
path: ${{ steps.composer-cache.outputs.dir }}
182+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
183+
restore-keys: ${{ runner.os }}-composer-
184+
185+
- name: Install Composer dependencies
186+
run: composer install --no-progress --prefer-dist --optimize-autoloader
187+
188+
- uses: actions/download-artifact@v1
189+
with:
190+
name: build-data
191+
path: ${{ github.workspace }}/build
192+
193+
- name: Codecov
194+
uses: codecov/codecov-action@v1
195+
196+
- name: PHP Code Sniffer
197+
continue-on-error: true
198+
run: php vendor/bin/phpcs
199+
200+
- name: Psalm
201+
continue-on-error: true
202+
run: php vendor/bin/psalm --show-info=true
203+
204+
- name: Psalter
205+
continue-on-error: true
206+
run: php vendor/bin/psalter --issues=UnnecessaryVarAnnotation --dry-run

.travis.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
sqlattribs:AttributeFromSQL
22
===========================
3-
[![Build Status](https://travis-ci.org/tenet-ac-za/simplesamlphp-module-sqlattribs.svg?branch=master)](https://travis-ci.org/tenet-ac-za/simplesamlphp-module-sqlattribs)
4-
[![Coverage Status](https://img.shields.io/coveralls/tenet-ac-za/simplesamlphp-module-sqlattribs.svg)](https://coveralls.io/r/tenet-ac-za/simplesamlphp-module-sqlattribs)
3+
![Build Status](https://github.com/tenet-ac-za/simplesamlphp-module-sqlattribs/workflows/CI/badge.svg?branch=master)
4+
[![Coverage Status](https://codecov.io/gh/tenet-ac-za/simplesamlphp-module-sqlattribs/branch/master/graph/badge.svg)](https://codecov.io/gh/tenet-ac-za/simplesamlphp-module-sqlattribs)
55

66
This SimpleSAMLphp auth proc filter allows you to provides additional
77
attributes from a SQL datastore. It is useful in situations where your

0 commit comments

Comments
 (0)