Skip to content

Commit

Permalink
Merge pull request #53 from silinternational/feature/actions
Browse files Browse the repository at this point in the history
add GitHub Actions workflow for test and publish
  • Loading branch information
briskt authored Feb 21, 2024
2 parents 26c7762 + 16070d2 commit 6892ade
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 62 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/test-and-publish.yml
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 }}
28 changes: 28 additions & 0 deletions actions-services.yml
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
30 changes: 0 additions & 30 deletions codeship-services.yml

This file was deleted.

30 changes: 0 additions & 30 deletions codeship-steps.yml

This file was deleted.

2 changes: 0 additions & 2 deletions dockercfg.encrypted

This file was deleted.

0 comments on commit 6892ade

Please sign in to comment.