.github/workflows/push.yml
name: GitHub Actions
on: [ push ]
concurrency: ci-${{ github.ref }} # to avoid tag collisions in the ECR
env:
# Name of the image in the ECR
APP_IMAGE: gooddata-php-client
KBGDC_API_URL: "https://keboola-fork-bomb.on.gooddata.com"
KBGDC_USERNAME: "vlado+gdtest@keboola.com"
KBGDC_PASSWORD: ${{ secrets.KBGDC_PASSWORD }}
KBGDC_AUTH_TOKEN: ${{ secrets.KBGDC_AUTH_TOKEN }}
# DockerHub login
DOCKERHUB_USER: "keboolabot"
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
php: ['7.3', '7.4']
outputs:
app_image_tag: ${{ steps.tag.outputs.app_image_tag }}
is_semantic_tag: ${{ steps.tag.outputs.is_semantic_tag }}
steps:
-
name: Check out the repo
uses: actions/checkout@v3
-
name: Print Docker version
run: docker -v
-
name: Docker login
if: env.DOCKERHUB_TOKEN
run: docker login --username "$DOCKERHUB_USER" --password "$DOCKERHUB_TOKEN"
-
name: Build image
run: docker build --build-arg PHP_VERSION=${{ matrix.php }} -t $APP_IMAGE .
-
name: Run tests
run: |
docker run \
-e KBGDC_API_URL \
-e KBGDC_USERNAME \
-e KBGDC_PASSWORD \
-e KBGDC_AUTH_TOKEN \
$APP_IMAGE composer ci