Skip to content

πŸ”€ Merge pull request #17 from likesistemas/feature/NFE-180_v2 #25

πŸ”€ Merge pull request #17 from likesistemas/feature/NFE-180_v2

πŸ”€ Merge pull request #17 from likesistemas/feature/NFE-180_v2 #25

Workflow file for this run

name: Test and publish
on:
push:
branches:
- master
tags:
- v*
pull_request:
jobs:
test:
strategy:
matrix:
PHP: [73, 74, 80, 81, 82, 83]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Prepare code
run: |
touch .env
echo "GITHUB_TOKEN=${{ secrets.GH_TOKEN }}" >> .env
echo "CODECOMMIT_HOST=${{ secrets.CODECOMMIT_HOST }}" >> .env
echo "CODECOMMIT_USER=${{ secrets.CODECOMMIT_USER }}" >> .env
echo "CODECOMMIT_PASSWORD=${{ secrets.CODECOMMIT_PASSWORD }}" >> .env
- name: Up enviroment
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
docker-compose -f docker-compose-${PHP_VERSION}.yml up --build -d
- name: Wait enviroment
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
echo $(docker run -t --network php-dev jwilder/dockerize \
-wait http://php-dev_nginx/ \
-timeout 60s)
- name: Logs enviroment
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
docker ps -a
docker logs php-dev_app
- name: Run tests -> PHP Stan
if: matrix.PHP != '56'
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
docker-compose -f docker-compose-${PHP_VERSION}.yml exec -T -w /var/www/ app phpstan
# - name: Run tests -> PHP CS Fixer
# if: matrix.PHP != '56'
# env:
# PHP_VERSION: ${{ matrix.PHP }}
# run: |
# docker-compose -f docker-compose-${PHP_VERSION}.yml exec -T -w /var/www/ app php-cs-fixer fix
- name: Run tests -> Http Request
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
CONTENT=$(curl -s "http://127.0.0.1/");
echo "CHAMADA HTTP: ${CONTENT}";
if [ "${CONTENT}" != "Like Sistemas|${PHP_VERSION}" ]; then
echo "Chamada HTTP retornou errado: ${CONTENT}"
exit 1;
fi
push:
needs: test
strategy:
matrix:
PHP: [73, 74, 80, 81, 82, 83]
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v1
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.CR_PAT }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
build-args: |
PHP_VERSION=${{ matrix.PHP }}
push: true
tags: |
likesistemas/php-dev:${{ matrix.PHP }}
# ghcr.io/likesistemas/php-dev:${{ matrix.PHP }}