-
Notifications
You must be signed in to change notification settings - Fork 0
[AJDA-2665] Migrate CI from Azure Pipelines to GitHub Actions + PHP 8.5 #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b436782
Rename docker-compose services: tests→ci, tests-local→dev
ErikZigo f6a80c8
Upgrade Dockerfile base image to php:8.5-cli-trixie
ErikZigo cd07388
Bump PHP ^8.5, keboola/php-component ^11.0, job-queue-api-php-client …
ErikZigo d6dfe74
Fix BC breaks from keboola/php-component 11 and Monolog 3 upgrade
ErikZigo b6f8de2
Add GitHub Actions workflow for build/test/deploy
ErikZigo a495adf
Remove Azure Pipelines configuration and deploy script
ErikZigo f66112d
Update README: GHA badge and docker compose v2 syntax
ErikZigo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| name: 'GitHub Actions' | ||
| 'on': | ||
| - push | ||
| concurrency: 'ci-${{ github.ref }}' | ||
| env: | ||
| APP_IMAGE: keboola-component | ||
| KBC_DEVELOPERPORTAL_VENDOR: keboola | ||
| KBC_DEVELOPERPORTAL_APP: keboola.runner-config-test | ||
| KBC_DEVELOPERPORTAL_USERNAME: keboola+RunnerConfigTestCI | ||
| KBC_DEVELOPERPORTAL_PASSWORD: '${{ secrets.KBC_DEVELOPERPORTAL_PASSWORD }}' | ||
| DOCKERHUB_USER: keboolabot | ||
| DOCKERHUB_TOKEN: '${{ secrets.DOCKERHUB_TOKEN }}' | ||
| KBC_STORAGE_TOKEN: '${{ secrets.KBC_STORAGE_TOKEN }}' | ||
| KBC_TEST_PROJECT_URL: '' | ||
| KBC_TEST_PROJECT_CONFIGS: '' | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| 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 -t $APP_IMAGE .' | ||
| - | ||
| name: 'Set image tag' | ||
| id: tag | ||
| run: | | ||
| TAG="${GITHUB_REF##*/}" | ||
| IS_SEMANTIC_TAG=$(echo "$TAG" | grep -q '^v\?[0-9]\+\.[0-9]\+\.[0-9]\+$' && echo true || echo false) | ||
| echo "Tag = '$TAG', is semantic tag = '$IS_SEMANTIC_TAG'" | ||
| echo "is_semantic_tag=$IS_SEMANTIC_TAG" >> $GITHUB_OUTPUT | ||
| echo "app_image_tag=$TAG" >> $GITHUB_OUTPUT | ||
| - | ||
| name: 'Push image to ECR' | ||
| uses: keboola/action-push-to-ecr@master | ||
| with: | ||
| vendor: '${{ env.KBC_DEVELOPERPORTAL_VENDOR }}' | ||
| app_id: '${{ env.KBC_DEVELOPERPORTAL_APP }}' | ||
| username: '${{ env.KBC_DEVELOPERPORTAL_USERNAME }}' | ||
| password: '${{ env.KBC_DEVELOPERPORTAL_PASSWORD }}' | ||
| tag: '${{ steps.tag.outputs.app_image_tag }}' | ||
| push_latest: '${{ steps.tag.outputs.is_semantic_tag }}' | ||
| source_image: '${{ env.APP_IMAGE}}' | ||
| tests: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - | ||
| name: 'Check out the repo' | ||
| uses: actions/checkout@v3 | ||
| - | ||
| name: 'Pull image from ECR' | ||
| uses: keboola/action-pull-from-ecr@master | ||
| with: | ||
| vendor: '${{ env.KBC_DEVELOPERPORTAL_VENDOR }}' | ||
| app_id: '${{ env.KBC_DEVELOPERPORTAL_APP }}' | ||
| username: '${{ env.KBC_DEVELOPERPORTAL_USERNAME }}' | ||
| password: '${{ env.KBC_DEVELOPERPORTAL_PASSWORD }}' | ||
| tag: '${{ needs.build.outputs.app_image_tag }}' | ||
| target_image: '${{ env.APP_IMAGE}}' | ||
| tag_as_latest: true | ||
| - | ||
| name: 'Run tests' | ||
| run: | | ||
| docker run \ | ||
| -e QUEUE_API_URL \ | ||
| -e STORAGE_TOKEN \ | ||
| ${{env.APP_IMAGE}} composer ci | ||
| env: | ||
| QUEUE_API_URL: '${{ secrets.QUEUE_API_URL }}' | ||
| STORAGE_TOKEN: '${{ secrets.KBC_STORAGE_TOKEN }}' | ||
| tests-in-kbc: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - | ||
| name: 'Run KBC test jobs' | ||
| if: 'env.KBC_STORAGE_TOKEN && env.KBC_TEST_PROJECT_CONFIGS' | ||
| uses: keboola/action-run-configs-parallel@master | ||
| with: | ||
| token: '${{ env.KBC_STORAGE_TOKEN }}' | ||
| componentId: '${{ env.KBC_DEVELOPERPORTAL_APP }}' | ||
| tag: '${{ needs.build.outputs.app_image_tag }}' | ||
| configs: '${{ env.KBC_TEST_PROJECT_CONFIGS }}' | ||
| deploy: | ||
| needs: | ||
| - build | ||
| - tests | ||
| - tests-in-kbc | ||
| runs-on: ubuntu-latest | ||
| if: 'startsWith(github.ref, ''refs/tags/'') && needs.build.outputs.is_semantic_tag == ''true''' | ||
| steps: | ||
| - | ||
| name: 'Set tag in the Developer Portal (main component)' | ||
| uses: keboola/action-set-tag-developer-portal@master | ||
| with: | ||
| vendor: '${{ env.KBC_DEVELOPERPORTAL_VENDOR }}' | ||
| app_id: '${{ env.KBC_DEVELOPERPORTAL_APP }}' | ||
| username: '${{ env.KBC_DEVELOPERPORTAL_USERNAME }}' | ||
| password: '${{ env.KBC_DEVELOPERPORTAL_PASSWORD }}' | ||
| tag: '${{ needs.build.outputs.app_image_tag }}' | ||
| - | ||
| name: 'Set tag in the Developer Portal (GELF variant)' | ||
| uses: keboola/action-set-tag-developer-portal@master | ||
| with: | ||
| vendor: '${{ env.KBC_DEVELOPERPORTAL_VENDOR }}' | ||
| app_id: keboola.runner-config-test-gelf | ||
| username: '${{ env.KBC_DEVELOPERPORTAL_USERNAME }}' | ||
| password: '${{ env.KBC_DEVELOPERPORTAL_PASSWORD }}' | ||
| tag: '${{ needs.build.outputs.app_image_tag }}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.