Skip to content

Commit

Permalink
ci(github): updated workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianLusina committed May 13, 2022
1 parent 2ee8690 commit 3c867d1
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 136 deletions.
69 changes: 0 additions & 69 deletions .github/workflows/codeql.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/dangerci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Danger CI

on:
pull_request:
branches:
- 'main'

jobs:
test:
name: Danger CI
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: 16.x

- name: Install dependencies
run: yarn add danger

- name: Danger CI Check
uses: danger/[email protected]
env:
CI: true
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
DANGER_GITHUB_API_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
15 changes: 12 additions & 3 deletions .github/workflows/lint_test_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,16 @@ jobs:
- uses: actions/checkout@v2

- name: Run tests
run: ./gradlew test
run: make test

# Ref: https://github.com/codecov/codecov-action
- name: Upload Test Coverage
uses: codecov/codecov-action@v2
with:
files: ./build/reports/jacoco/test/jacocoTestReport.xml
flags: unittests
fail_ci_if_error: true
verbose: true

build:
name: Build
Expand All @@ -77,13 +86,13 @@ jobs:
- uses: actions/checkout@v2

- name: Run Build
run: ./gradlew build
run: make build

- name: Upload App Build
uses: actions/upload-artifact@v2
with:
name: build
path: build/libs/app-0.0.1.jar
path: build/libs/cachey.jar

- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Release
on:
workflow_run:
workflows:
- "Lint, Test & Build"
types:
- completed
branches:
- main

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
1 change: 0 additions & 1 deletion .github/workflows/slack_notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
- "Deploy"
- "Gitlab Sync"
- "BitBucket Sync"
- "CodeQL"
types:
- completed

Expand Down
62 changes: 0 additions & 62 deletions .gitlab-ci.yml

This file was deleted.

9 changes: 9 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"branches": ["main", {"name":"beta", "prerelease": true}],
"tagFormat": "v${version}",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github"
]
}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ lint:

build:
@echo "Building application"
./gradlew build
./gradlew build -x test

all: install lint test
26 changes: 26 additions & 0 deletions dangerfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { danger, warn, markdown } from 'danger';

// Setup
const { pr } = danger.github;
const modifiedFiles = danger.git.modified_files;
const packageChanged = modifiedFiles.includes('package.json');
const lockfileChanged = modifiedFiles.includes('yarn.lock');

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

const bigPRThreshold = 600;
if (pr.additions + pr.deletions > bigPRThreshold) {
warn(`:exclamation: Big PR`);
markdown(
`>: Pull Request size seems relatively large. If Pull Request contains multiple changes, split each into separate PR will helps faster, easier review.`,
);
}

if (packageChanged && !lockfileChanged) {
const message = 'Changes were made to package.json, but not to yarn.lock';
const idea = 'Perhaps you need to run `yarn install`?';
warn(`${message} - <i>${idea}</i>`);
}

0 comments on commit 3c867d1

Please sign in to comment.