-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from pasindu07/php-7.4-ubuntu-20.04
Added github workflow
- Loading branch information
Showing
10 changed files
with
141 additions
and
2,198 deletions.
There are no files selected for viewing
This file contains 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,96 @@ | ||
name: OrangeHRM PROD Image Build Workflow | ||
|
||
on: | ||
push: | ||
branches: [ php-7.4-ubuntu-20.04 ] | ||
schedule: | ||
- cron: '30 0 * * MON' # 0030 in UTC, 0600 in IST | ||
workflow_dispatch: | ||
|
||
env: | ||
REGISTRY: hub.docker.com | ||
DOCKER_HUB_REPO: "orangehrm/orangehrm-environment-images" | ||
TAG_NAME: "prod-php-7.4-ubuntu20.04" | ||
VERSION_TAG_NAME: "prod-php-7.4-ubuntu20.04" | ||
#LATEST_TAG_NAME: "prod-php-latest-ubuntu-20.04" | ||
UPSTREAM_REPO: "orangehrm/orangehrm-prod-environment" | ||
UPSTREAM_BRANCH: "refs/heads/php-7.4-ubuntu-20.04" | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Verify prerequisites | ||
run: | | ||
docker --version | ||
docker compose version | ||
composer --version | ||
- name: Install test suite dependencies | ||
run: composer install | ||
|
||
- name: Build docker image | ||
run: docker build -t ${{ env.DOCKER_HUB_REPO }}:${{ env.TAG_NAME }} docker-image | ||
|
||
- name: Spin up the container | ||
run: | | ||
docker compose up -d | ||
docker ps -a | ||
- name: Run unit test suite | ||
run: | | ||
sleep 10s | ||
php vendor/bin/codecept run unit | ||
# - name: Get installed php version | ||
# run: echo "VERSION_TAG_NAME=prod-php-$(docker exec prod_web_ubuntu php -r 'echo PHP_VERSION;')-ubuntu-20.04" >> $GITHUB_ENV | ||
|
||
# - name: New image with a version tag & latest tag | ||
# run: | | ||
# docker tag ${{ env.DOCKER_HUB_REPO }}:${{ env.TAG_NAME }} ${{ env.DOCKER_HUB_REPO }}:${{ env.VERSION_TAG_NAME }} | ||
# docker tag ${{ env.DOCKER_HUB_REPO }}:${{ env.TAG_NAME }} ${{ env.DOCKER_HUB_REPO }}:${{ env.LATEST_TAG_NAME }} | ||
|
||
- name: Docker hub login | ||
if: ${{ github.repository == env.UPSTREAM_REPO && github.ref == env.UPSTREAM_BRANCH }} | ||
run: docker login -u=${{ secrets.DOCKER_HUB_USERNAME }} -p=${{ secrets.DOCKER_HUB_PASSWORD }} | ||
|
||
- name: Deploy changes to the docker hub with version tag | ||
if: ${{ github.repository == env.UPSTREAM_REPO && github.ref == env.UPSTREAM_BRANCH }} | ||
run: | | ||
docker push ${{ env.DOCKER_HUB_REPO }}:${{ env.VERSION_TAG_NAME }} | ||
echo 'SUCCESS - IMAGE WAS PUBLISHED ${{ env.DOCKER_HUB_REPO }}:${{ env.VERSION_TAG_NAME }}' | ||
# - name: Deploy changes to the docker hub with latest tag | ||
# if: ${{ github.repository == env.UPSTREAM_REPO && github.ref == env.UPSTREAM_BRANCH }} | ||
# run: | | ||
# docker push ${{ env.DOCKER_HUB_REPO }}:${{ env.LATEST_TAG_NAME }} | ||
# echo 'SUCCESS - IMAGE WAS PUBLISHED ${{ env.DOCKER_HUB_REPO }}:${{ env.LATEST_TAG_NAME }}' | ||
|
||
- name: Docker hub logout | ||
if: ${{ github.repository == env.UPSTREAM_REPO && github.ref == env.UPSTREAM_BRANCH }} | ||
run: docker logout | ||
|
||
- name: Send the email notification | ||
if: always() | ||
uses: dawidd6/action-send-mail@v2 | ||
with: | ||
# mail server settings | ||
server_address: smtp.gmail.com | ||
server_port: 465 | ||
# user credentials | ||
username: ${{ secrets.EMAIL_USERNAME }} | ||
password: ${{ secrets.EMAIL_PASSWORD }} | ||
# email subject | ||
subject: ${{ github.job }} job of ${{ github.repository }} has ${{ job.status }} | ||
# email body as text | ||
body: ${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }} | ||
# comma-separated string, send email to | ||
to: [email protected] | ||
# from email name | ||
from: DockHRM Automator |
This file contains 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 |
---|---|---|
|
@@ -3,3 +3,4 @@ vendor/ | |
*~ | ||
logs/* | ||
tests/_output/* | ||
composer.json |
This file was deleted.
Oops, something went wrong.
This file contains 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 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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
{ | ||
"require": { | ||
"codeception/codeception": "^2.2" | ||
"require-dev": { | ||
"codeception/codeception": "^4.1", | ||
"codeception/module-phpbrowser": "^1.0.0", | ||
"codeception/module-asserts": "^1.0.0", | ||
"codeception/module-cli": "^1.1" | ||
} | ||
} | ||
} |
Oops, something went wrong.