Skip to content

Commit 8595c87

Browse files
authored
Remove comments and update actions (#47)
1 parent 01091ab commit 8595c87

File tree

246 files changed

+1649
-9233
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

246 files changed

+1649
-9233
lines changed

.github/workflows/tests.yaml

Lines changed: 90 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: "Tests"
33
on:
44
pull_request:
55
branches:
6-
- master
6+
- main
77
paths:
88
- '**.php'
99
- 'composer.json'
@@ -12,7 +12,7 @@ on:
1212
- '.github/workflows/tests.yaml'
1313
push:
1414
branches:
15-
- master
15+
- main
1616
paths:
1717
- '**.php'
1818
- 'composer.json'
@@ -22,42 +22,115 @@ on:
2222

2323
env:
2424
CONSUL_HTTP_ADDR: "127.0.0.1:8500"
25-
CONSUL_VERSION: '1.17.2'
25+
CONSUL_VERSION: '1.20.5'
2626

2727
jobs:
2828
tests:
2929
runs-on: ubuntu-22.04
3030
strategy:
3131
matrix:
32-
php-version: ["8.0", "8.1", "8.2"]
32+
php-version:
33+
- '8.1'
34+
- '8.2'
35+
- '8.3'
36+
- '8.4'
3337

3438
name: Tests - PHP ${{ matrix.php-version }}
3539
steps:
3640
- uses: actions/checkout@v4
3741

42+
- name: 'Define vars'
43+
id: vars
44+
shell: bash -e {0}
45+
# language=sh
46+
run: |
47+
_phpunit_version=
48+
case "${{ matrix.php-version }}" in
49+
8.1) _phpunit_version='10.5' ;;
50+
8.2) _phpunit_version='11.1' ;;
51+
8.3) _phpunit_version='11.1' ;;
52+
8.4) _phpunit_version='11.1' ;;
53+
*) echo "Unsupported PHP version: ${{ matrix.php-version }}" && exit 1 ;;
54+
esac
55+
echo "phpunit-version=${_phpunit_version}" >> $GITHUB_OUTPUT
56+
3857
- uses: shivammathur/setup-php@v2
3958
with:
4059
php-version: ${{ matrix.php-version }}
4160
extensions: json
4261
ini-values: precision=14,serialize_precision=-1
4362

44-
- name: 'Composer update'
45-
# language=bash
63+
- name: 'Install jq'
64+
uses: dcarbone/install-jq-action@v3
65+
with:
66+
force: true
67+
68+
- name: 'Set composer dep versions'
69+
shell: bash -e {0}
70+
# language=sh
4671
run: |
47-
composer update \
48-
--no-ansi \
49-
--no-interaction \
50-
--no-scripts \
51-
--no-progress
72+
tmpf="$(mktemp)"
73+
jq -rcM '."require-dev"."phpunit/phpunit" = "^${{ steps.vars.outputs.phpunit-version }}"' composer.json > "${tmpf}"
74+
mv "${tmpf}" composer.json
5275
53-
- name: 'Install Consul'
76+
- name: 'Get composer cache directory'
77+
id: composer-cache
78+
shell: bash -e {0}
79+
# language=sh
80+
run: |
81+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
82+
83+
- name: 'Init composer dep cache'
84+
id: cache
85+
uses: actions/cache@v4
86+
with:
87+
path: ${{ steps.composer-cache.outputs.dir }}
88+
key: "composer-${{ runner.os }}-${{ matrix.php-version }}-${{ steps.vars.outputs.phpunit-version }}-${{ hashFiles('composer.lock') }}"
89+
90+
- name: 'Install composer deps'
91+
shell: bash -e {0}
92+
# language=sh
93+
run: |
94+
rm composer.lock
95+
composer update --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
96+
97+
- name: 'Save composer dep cache'
98+
if: steps.cache.outputs.cache-hit != 'true' && steps.cache.outputs.cache-hit != true
99+
uses: actions/cache/save@v4
100+
with:
101+
path: ${{ steps.composer-cache.outputs.dir }}
102+
key: "composer-${{ runner.os }}-${{ matrix.php-version }}-${{ steps.vars.outputs.phpunit-version }}-${{ hashFiles('composer.lock') }}"
103+
104+
- name: 'Restore consul ${{ env.CONSUL_VERSION }}'
105+
id: consul-cache
106+
uses: actions/cache/restore@v4
107+
with:
108+
path: '${{ runner.tool_cache }}/consul'
109+
key: 'consul-${{ env.CONSUL_VERSION }}'
110+
111+
- name: 'Install consul ${{ env.CONSUL_VERSION }}'
112+
if: '! steps.consul-cache.outputs.cache-hit'
113+
working-directory: '${{ runner.temp }}'
54114
# language=bash
55115
run: |
56-
wget https://releases.hashicorp.com/consul/${{ env.CONSUL_VERSION }}/consul_${{ env.CONSUL_VERSION }}_linux_amd64.zip
57-
unzip consul_${{ env.CONSUL_VERSION }}_linux_amd64.zip -d /usr/local/bin/
58-
rm consul_${{ env.CONSUL_VERSION }}_linux_amd64.zip
59-
chmod +x /usr/local/bin/consul
60-
consul --version
116+
mkdir consul
117+
wget -O consul.zip https://releases.hashicorp.com/consul/${{ env.CONSUL_VERSION }}/consul_${{ env.CONSUL_VERSION }}_linux_amd64.zip
118+
unzip 'consul.zip' consul -d consul/
119+
rm consul.zip
120+
chmod +x consul/consul
121+
122+
- name: 'Install consul ${{ env.CONSUL_VERSION }} into tool cache'
123+
uses: AnimMouse/tool-cache@v1
124+
with:
125+
folder_name: consul
126+
cache_hit: ${{ steps.consul-cache.outputs.cache-hit }}
127+
128+
- name: 'Save consul ${{ env.CONSUL_VERSION }} cache'
129+
if: '! steps.consul-cache.outputs.cache-hit'
130+
uses: actions/cache/save@v4
131+
with:
132+
path: '${{ runner.tool_cache }}/consul'
133+
key: 'consul-${{ env.CONSUL_VERSION }}'
61134

62135
- name: 'Execute tests'
63136
# language=bash

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This library is loosely based upon the [official GO client](https://github.com/h
1414
| 0.6.x | 0.7-0.8 |
1515
| v1.x | 0.9-current |
1616
| v2.x | 0.9-current |
17-
| dev-master | current |
17+
| dev-main | current |
1818

1919
Newer versions of the api lib will probably work in a limited capacity with older versions of Consul, but no guarantee
2020
is made and backwards compatibility issues will not be addressed.

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"php-consul-api"
1717
],
1818
"require": {
19-
"php": "8.*",
19+
"php": "^8.1",
2020
"ext-json": "*",
21-
"dcarbone/gotime": "v0.5.*",
21+
"dcarbone/gotime": "^v0.6",
2222
"dcarbone/gohttp": "v0.3.*",
2323
"guzzlehttp/guzzle": "^7.4",
2424
"guzzlehttp/psr7": "^2.4"
@@ -33,7 +33,7 @@
3333
}
3434
},
3535
"require-dev": {
36-
"phpunit/phpunit": "@stable"
36+
"phpunit/phpunit": "^10.5 || ^11.0"
3737
},
3838
"autoload-dev": {
3939
"files": [
@@ -46,6 +46,6 @@
4646
}
4747
},
4848
"scripts": {
49-
"php-cs-fixer": "vendor/bin/php-cs-fixer fix --config tools/php-cs-fixer/php-consul-api-rules.php_cs src/"
49+
"php-cs-fixer": "tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --config tools/php-cs-fixer/php-consul-api-rules.php_cs src/"
5050
}
5151
}

0 commit comments

Comments
 (0)