Skip to content

Commit

Permalink
TASK: Tools: Install PHPUnit via phar.io
Browse files Browse the repository at this point in the history
  • Loading branch information
nostadt committed Aug 10, 2023
1 parent 6c24068 commit 6ce5ba3
Show file tree
Hide file tree
Showing 6 changed files with 99,068 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ jobs:
- name: "Print PHP version"
run: php --version

- name: "Install Composer dependencies"
run: composer install
- name: "Print PHPUnit --version"
run: tools/phpunit --version

- name: "PHPUnit"
run: vendor/bin/phpunit
run: tools/phpunit
4 changes: 4 additions & 0 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpunit" version="^10.3.1" installed="10.3.1" location="./tools/phpunit" copy="true"/>
</phive>
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ FROM php:8.1
# copy the Composer PHAR from the Composer image into the PHP image
COPY --from=composer /usr/bin/composer /usr/bin/composer

# Install various packages
RUN apt-get update

RUN apt update && apt install jq git zip openssh-server sudo -y
RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1000 test
RUN echo 'test:test' | chpasswd
Expand All @@ -14,5 +17,16 @@ EXPOSE 22

CMD ["/usr/sbin/sshd","-D"]

## Install for phive.io
RUN apt-get update && apt-get install -y gnupg
RUN apt-get install -y ca-certificates wget

RUN wget -O phive.phar https://phar.io/releases/phive.phar
RUN wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
RUN gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
RUN gpg --verify phive.phar.asc phive.phar
RUN chmod +x phive.phar
RUN mv phive.phar /usr/local/bin/phive

# show that both Composer and PHP run as expected
RUN composer --version && php -v
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ stop:

.PHONY: test
test:
docker exec psr3-log-context-container vendor/bin/phpunit
docker exec psr3-log-context-container tools/phpunit

.PHONY: lint
lint:
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"php": ">=8.1"
},
"require-dev": {
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^10"
"phpstan/phpstan": "^1.10"
},
"scripts": {
"normalize": "./bin/json-normalize composer.json 2"
Expand Down

0 comments on commit 6ce5ba3

Please sign in to comment.