-
Notifications
You must be signed in to change notification settings - Fork 1
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 #53 from silinternational/feature/actions
add GitHub Actions workflow for test and publish
- Loading branch information
Showing
5 changed files
with
87 additions
and
62 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,59 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
unit-tests: | ||
name: Unit Tests | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Run unit tests | ||
run: | | ||
docker-compose -f actions-services.yml run --rm app ./run-tests.sh | ||
api-tests: | ||
name: API Tests | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Run API tests | ||
run: | | ||
docker-compose -f actions-services.yml run --rm app ./run-tests-api.sh | ||
psr2-check: | ||
name: PSR2 check | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Check PSR2 | ||
run: | | ||
docker-compose -f actions-services.yml run --rm app ./check-psr2.sh | ||
build-and-publish: | ||
name: Build and Publish | ||
needs: [unit-tests,api-tests,psr2-check] | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ vars.DOCKER_ORG }}/email-service | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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,28 @@ | ||
version: '2' | ||
services: | ||
db: | ||
image: mariadb:10 | ||
environment: | ||
MYSQL_ROOT_PASSWORD: r00tp@ss! | ||
MYSQL_DATABASE: test | ||
MYSQL_USER: email | ||
MYSQL_PASSWORD: email | ||
|
||
app: | ||
build: . | ||
depends_on: | ||
- db | ||
working_dir: /data | ||
environment: | ||
APP_ENV: test | ||
MYSQL_HOST: db | ||
MYSQL_DATABASE: test | ||
MYSQL_USER: email | ||
MYSQL_PASSWORD: email | ||
API_ACCESS_KEYS: abc123 | ||
APP_NAME: email-service | ||
MAILER_HOST: test | ||
MAILER_USERNAME: test | ||
MAILER_PASSWORD: test | ||
NOTIFICATION_EMAIL: test@test.com | ||
FROM_EMAIL: test@test.com |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.