Skip to content

Test pr #1

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

Open
wants to merge 12 commits into
base: feature/obi
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@

name: Obi Test
name: erp-lms-service

on:
push:
branches:
- feature/obitest
- feature/obi/test

jobs:
deploy:
deploy-Container:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: SSH into EC2 instance and deploy Docker container
uses: appleboy/ssh-action@v0.1.5
- name: Notify Slack
uses: asconsoft/action-slack@v4.0.1
with:
host: ${{ secrets.SERVER_IP }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.EC2_PASSWORD }}
script: |
docker pull $ECR_REGISTRY/onebillionideas:${IMAGE_TAG}
docker stop my-docker-container || true
docker rm my-docker-container || true
docker run -d -p 8080:8080 $ECR_REGISTRY/onebillionideas:${IMAGE_TAG}"
channel: '#deployment'
if_mention: failure,cancelled
status: ${{ job.status }}
fields: workflow,job,commit,repo,ref,author
text_success: ':rocket: `erp-lms` is successfully deployed in an EC2 instance'
text_failure: ':boom: `erp-lms` has failed to be deployed :-1:; working on it :hammer_and_wrench:'
env:
SLACK_GIT_TOKEN: ${{ secrets.SLACK_GIT_TOKEN }} # optional
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
if: always() # Pick up events even if the job fails or is canceled.


10 changes: 5 additions & 5 deletions .github/workflows/feature-workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

name: Obi Test
name: erp-lms-service

on:
push:
branches:
- feature/obi
- feature/obi/test

jobs:
app-containerize:
docker-build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -27,8 +27,8 @@ jobs:
run: |
docker build -t $ECR_REGISTRY/onebillionideas:erp-lms-v1 .
docker push $ECR_REGISTRY/onebillionideas:erp-lms-v1
deploy:
needs: app-containerize
deploy-Container:
needs: docker-build-and-push
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/main.yaml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/pr-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
on:
pull_request:
branches:
- feature/obi
# paths-ignore:
# - .github/**

name: DangerJS | Sonarqube

env:
REPO: ${GITHUB_REPOSITORY}
FROM: ${GITHUB_HEAD_REF#refs/heads/}
TO: ${GITHUB_BASE_REF#refs/heads/}
KEY: ${{ github.event.number }}

jobs:
danger_check:
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
name: Danger JS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Danger
uses: danger/danger-js@9.1.8
env:
# SLACK_GIT_TOKEN: ${{ secrets.SLACK_GIT_TOKEN }} # optional
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify Slack
uses: asconsoft/action-slack@v4.0.1
with:
channel: '#pr'
if_mention: failure,cancelled
status: ${{ job.status }}
fields: workflow,job,commit,repo,ref,author
text_success: ':dizzy: `erp-lms` - this PR is successfully passed the checks for `Dangerjs` :v:'
text_failure: ':boom: `erp-lms` - this PR is failed the checks for `Dangerjs` :-1:; working on it :hammer_and_wrench:'
env:
SLACK_GIT_TOKEN: ${{ secrets.SLACK_GIT_TOKEN }} # optional
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
if: always() # Pick up events even if the job fails or is canceled.
36 changes: 36 additions & 0 deletions dangerfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { message, warn, fail, markdown } from "danger"

// Add a CHANGELOG entry for app changes
const hasChangelog = danger.git.modified_files.includes("changelog.md")
const isTrivial = (danger.github.pr.body + danger.github.pr.title).includes("#trivial")

if (!hasChangelog && !isTrivial) {
warn("Please add a changelog entry for your changes.")
}

// Enforce smaller PRs
var bigPRThreshold = 600;
if (danger.github.pr.additions + danger.github.pr.deletions > bigPRThreshold) {
warn(':exclamation: Big PR (' + ++errorCount + ')');
markdown('> (' + errorCount + ') : Pull Request size seems relatively large. If Pull Request contains multiple changes, split each into separate PR will helps faster, easier review.');
} else {
message("Thanks - We :heart: small PR!")
}

// Always ensure we assign someone, so that our Slackbot can do its work correctly
if (danger.github.pr.assignee === null) {
fail("Please assign someone to merge this PR, and optionally include people who should review.")
}

// Check documentation change and ensure test
const docs = danger.git.fileMatch("**/*.md")
const main = danger.git.fileMatch("src/main/java/**/*.java")
const tests = danger.git.fileMatch("src/test/java/**/*.java")

if (docs.edited) {
message("Thanks - We :heart: our documentarians!")
}

if (main.modified && !tests.modified) {
fail("You have main Java files changes without test Java files.")
}