Skip to content

Commit 0623ac8

Browse files
authored
chore(ci): add build manager (#75)
to more easily build the project locally, add GNU make as build manager, just `make`. current workflow is aligned with configuration in travis.yml, the php command defaults to `php` and can be configured with `PHP=php8.2`. the build is leaving the project tree for `bats` which goes to `/tmp/bats` and `/tmp/local`, which is from the current configuration. github workflow configuration also updated to the current PHP versions and deprecation noise reduced for the remote dependencies. list: * add build manager align Makefile with steps in .travis.yml to build easily locally. just `make` or `make PHP=php8.2 test`. * bump remote build dependencies in the Microsoft GitHub Action workflows to removes noise from the logs. * roll ci it's been quite some time, update php and the ubuntu versions.
1 parent 83705be commit 0623ac8

File tree

3 files changed

+65
-17
lines changed

3 files changed

+65
-17
lines changed

.github/workflows/ci.yml

+7-15
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,22 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
machine: ['ubuntu-18.04']
15-
php-version: ['7.1', '7.2', '7.3', '7.4']
14+
machine: ['ubuntu-20.04']
15+
php-version: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
1616
run-job: ['env.1', 'env.2']
1717
experimental: [false]
1818
include:
19-
- machine: 'ubuntu-18.04'
20-
php-version: '8.0'
19+
- machine: 'ubuntu-20.04'
20+
php-version: '8.2'
2121
run-job: 'env.1'
2222
experimental: true
23-
- machine: 'ubuntu-18.04'
24-
php-version: '8.0'
25-
run-job: 'env.2'
26-
experimental: true
27-
- machine: 'ubuntu-18.04'
28-
php-version: '8.1'
29-
run-job: 'env.1'
30-
experimental: true
31-
- machine: 'ubuntu-18.04'
32-
php-version: '8.1'
23+
- machine: 'ubuntu-20.04'
24+
php-version: '8.2'
3325
run-job: 'env.2'
3426
experimental: true
3527

3628
steps:
37-
- uses: actions/checkout@v2
29+
- uses: actions/checkout@v3
3830
- uses: shivammathur/setup-php@v2
3931
with:
4032
php-version: ${{ matrix.php-version }}

.gitignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
composer.lock
2-
vendor/
1+
*.cached*
2+
/composer.lock
3+
/vendor/

Makefile

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
BATS_GIT := https://github.com/sstephenson/bats.git
2+
BATS_TMP := /tmp/bats
3+
COMPOSER_COMMAND ?= composer
4+
COMPOSER_OPTIONS ?= --prefer-source
5+
GIT ?= git
6+
PHP ?= php
7+
8+
COMPOSER_EXECUTABLE := $(shell command -v $(COMPOSER_COMMAND) 2> /dev/null)
9+
COMPOSER_CMD := $(PHP) $(COMPOSER_EXECUTABLE)
10+
export COMPOSER_VENDOR_DIR := vendor-$(PHP).cached
11+
export COMPOSER := composer-$(PHP).cached.json
12+
13+
export PATH := $(PWD)/bin:$(dir $(BATS_TMP))local/bin:$(PWD)/tests/fixtures:$(PATH)
14+
15+
16+
.PHONY : all
17+
all : install test
18+
19+
.PHONY : test
20+
test : $(dir $(BATS_TMP))local/bin/bats vendor
21+
bats tests
22+
23+
.PHONY : install
24+
install : $(dir $(BATS_TMP))local/bin/bats vendor
25+
@$(PHP) --version | head -1
26+
@$(COMPOSER_CMD) --version
27+
@bats --version
28+
29+
$(dir $(BATS_TMP))local/libexec/bats $(dir $(BATS_TMP))local/bin/bats : $(BATS_TMP)/.git/HEAD
30+
mkdir -p $(dir $(BATS_TMP))local
31+
bash $(BATS_TMP)/install.sh $(dir $(BATS_TMP))local
32+
bats --version
33+
touch $(@)
34+
35+
$(BATS_TMP)/.git/HEAD :
36+
$(GIT) clone $(BATS_GIT) $(BATS_TMP)
37+
38+
.PHONY : vendor
39+
vendor : $(COMPOSER) $(COMPOSER_VENDOR_DIR)/composer/installed.json
40+
41+
composer-%.cached.json : composer.json
42+
rm -f $@
43+
cp $< $@
44+
45+
composer.lock : $(COMPOSER_VENDOR_DIR)/composer/installed.json
46+
touch $@
47+
48+
$(COMPOSER_VENDOR_DIR)/composer/installed.json : composer.json
49+
$(COMPOSER_CMD) update $(COMPOSER_OPTIONS)
50+
touch $@
51+
52+
.PHONY : clean
53+
clean :
54+
rm -rf -- $(BATS_TMP) $(dir $(BATS_TMP))local
55+
git clean -ffx vendor-*.cached composer-*.cached*

0 commit comments

Comments
 (0)