Skip to content

Commit 91c84d9

Browse files
chore: add test workflow for master and dev branches (#10)
* chore: add test workflow for master and dev branches * remove version field from composer.json
1 parent 98178b2 commit 91c84d9

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

.github/workflows/tests.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ "master", "dev" ]
6+
pull_request:
7+
branches: [ "master", "dev" ]
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: Set up PHP
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: 8.3
24+
25+
- name: Validate composer.json and composer.lock
26+
run: composer validate --strict
27+
28+
- name: Cache Composer packages
29+
id: composer-cache
30+
uses: actions/cache@v3
31+
with:
32+
path: vendor
33+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
34+
restore-keys: |
35+
${{ runner.os }}-php-
36+
37+
- name: Install dependencies
38+
run: composer install --prefer-dist --no-progress --no-suggest
39+
40+
- name: Run test suite
41+
run: composer test

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "naingaunglwin-dev/timetracker",
33
"description": "A lightweight time tracker for php",
44
"minimum-stability": "stable",
5-
"version": "1.0.0",
65
"type": "library",
76
"prefer-stable": true,
87
"license": "MIT",
@@ -23,5 +22,8 @@
2322
},
2423
"require-dev": {
2524
"phpunit/phpunit": "^11.5"
25+
},
26+
"scripts": {
27+
"test": "vendor/bin/phpunit tests"
2628
}
2729
}

0 commit comments

Comments
 (0)