Skip to content

Commit a887389

Browse files
committed
replace the travis ci with github actions, and replace the vagrantfile with a dockerfile
1 parent 5738d73 commit a887389

File tree

10 files changed

+89
-108
lines changed

10 files changed

+89
-108
lines changed

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.github
2+
.dockerignore
3+
.gitattributes
4+
.gitignore
5+
.git
6+
CHANGELOG.md
7+
Dockerfile
8+
README.md

.github/workflows/php.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: PHP Composer
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Validate composer.json and composer.lock
21+
run: composer validate --strict
22+
23+
- name: Cache Composer packages
24+
id: composer-cache
25+
uses: actions/cache@v3
26+
with:
27+
path: vendor
28+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
29+
restore-keys: |
30+
${{ runner.os }}-php-
31+
32+
- name: Install dependencies
33+
run: composer install --prefer-dist --no-progress
34+
35+
- name: Run test suite
36+
run: composer run-script lint
37+
38+
- name: Run test suite
39+
run: composer run-script test

.travis.yml

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

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM php:7.4-cli
2+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin && ln -s /usr/local/bin/composer.phar /usr/local/bin/composer
3+
WORKDIR /project

README.md

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -286,37 +286,14 @@ The workflow for this repository goes as follows:
286286
End users of this repository should only use tagged commits in production. Users interested in the current 'soon-to-be-released' code may use `master`, with the understanding that it may change unexpectedly. All other existing branches (if any) should be considered 'feature' branches in development, and not yet ready for use.
287287

288288
### Local Testing Environment
289-
There's a Vagrant virtual machine configuration included which is suitable for running the necessary unit tests. To bring up the machine, make sure you have Vagrant and Virtualbox installed, and from the project root directory:
289+
There's a `Dockerfile` and a set of helper scripts in `scripts/` suitable for running the necessary unit tests. With Docker installed, do:
290290

291+
``` shell
292+
# Execute the lint checks
293+
./script/lint
291294

292-
``` bash
293-
vagrant up
294-
vagrant ssh
295-
cd /project
295+
# Execute the unit tests
296+
./script/test
296297
```
297298

298-
### Setting Up for Testing
299-
The virtual machine development environment already has Composer installed. Once you're ssh'ed into the virtual machine, install this project's dev dependencies:
300-
301-
``` bash
302-
rm -rf vendor
303-
composer.phar update --verbose --prefer-dist
304-
```
305-
306-
### Unit Tests
307-
All the tests associated with this project can be manually run with:
308-
309-
``` bash
310-
vendor/bin/phpunit -c ./tests/phpunit.xml.dist ./tests
311-
```
312-
313-
### CodeSniffer
314-
Codesniffer verifies that coding standards are being met. Once the project is built with development dependencies, you can run the checks with:
315-
316-
``` bash
317-
vendor/bin/phpcs --encoding=utf-8 --extensions=php --standard=./tests/phpcs.xml -nsp ./
318-
```
319-
320-
### Continuous Integration
321-
The above tests are automatically run against Github commits with Travis-CI.
322-
- https://travis-ci.org/PhpUnitsOfMeasure/php-units-of-measure
299+
In addition, `./script/shell` will get you a bash shell in a temporary container. Note that the hosts directory is mounted into the container, and changes to files inside the container will persist.

Vagrantfile

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

composer.json

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,45 @@
11
{
2-
"name": "php-units-of-measure/php-units-of-measure",
3-
2+
"name": "php-units-of-measure/php-units-of-measure",
43
"description": "A PHP library for converting between standard units of measure.",
5-
64
"keywords": [
7-
"measurements", "data", "conversion"
8-
],
9-
10-
"homepage": "https://github.com/PhpUnitsOfMeasure/php-units-of-measure",
11-
5+
"measurements",
6+
"data",
7+
"conversion"
8+
],
9+
"homepage": "https://github.com/PhpUnitsOfMeasure/php-units-of-measure",
1210
"license": "MIT",
13-
1411
"authors": [
1512
{
16-
"name": "Jonathan Hanson",
17-
"email": "jonathan@jonathan-hanson.org",
18-
"homepage": "http://www.jonathan-hanson.org/",
19-
"role": "Developer"
13+
"name": "Jonathan Hanson",
14+
"role": "Developer"
2015
}
2116
],
22-
2317
"support": {
24-
"email": "jonathan@jonathan-hanson.org",
2518
"issues": "https://github.com/PhpUnitsOfMeasure/php-units-of-measure/issues",
2619
"source": "https://github.com/PhpUnitsOfMeasure/php-units-of-measure"
2720
},
28-
2921
"require": {
3022
"php": ">=5.5.0"
3123
},
32-
3324
"require-dev": {
34-
"phpunit/phpunit": "4.8.*",
25+
"phpunit/phpunit": "4.8.*",
3526
"squizlabs/php_codesniffer": "2.8.1"
3627
},
37-
3828
"replace": {
3929
"triplepoint/php-units-of-measure": "*"
4030
},
41-
4231
"autoload": {
4332
"psr-4": {
4433
"PhpUnitsOfMeasure\\": "source/"
4534
}
4635
},
4736
"autoload-dev": {
4837
"psr-4": {
49-
"PhpUnitsOfMeasureTest\\": "tests/"
38+
"PhpUnitsOfMeasureTest\\": "tests/"
5039
}
40+
},
41+
"scripts": {
42+
"test": "phpunit -c ./tests/phpunit.xml.dist ./tests",
43+
"lint": "phpcs --encoding=utf-8 --extensions=php --standard=./tests/phpcs.xml -nsp ./"
5144
}
5245
}

scripts/lint

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/..
4+
5+
docker build -t "php-units-of-measure:dev" .
6+
docker run -it --rm -v `pwd`:/project "php-units-of-measure:dev" composer run-script lint

scripts/shell

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/..
4+
5+
docker build -t "php-units-of-measure:dev" .
6+
docker run -it --rm -v `pwd`:/project "php-units-of-measure:dev" bash

scripts/test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/..
4+
5+
docker build -t "php-units-of-measure:dev" .
6+
docker run -it --rm -v `pwd`:/project "php-units-of-measure:dev" composer run-script test

0 commit comments

Comments
 (0)