Skip to content

Commit 3c867d1

Browse files
committed
ci(github): updated workflows
1 parent 2ee8690 commit 3c867d1

File tree

9 files changed

+101
-136
lines changed

9 files changed

+101
-136
lines changed

.github/workflows/codeql.yml

Lines changed: 0 additions & 69 deletions
This file was deleted.

.github/workflows/dangerci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Danger CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'main'
7+
8+
jobs:
9+
test:
10+
name: Danger CI
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
17+
- uses: actions/setup-node@v2
18+
with:
19+
node-version: 16.x
20+
21+
- name: Install dependencies
22+
run: yarn add danger
23+
24+
- name: Danger CI Check
25+
uses: danger/[email protected]
26+
env:
27+
CI: true
28+
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
29+
DANGER_GITHUB_API_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}

.github/workflows/lint_test_build.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,16 @@ jobs:
6565
- uses: actions/checkout@v2
6666

6767
- name: Run tests
68-
run: ./gradlew test
68+
run: make test
69+
70+
# Ref: https://github.com/codecov/codecov-action
71+
- name: Upload Test Coverage
72+
uses: codecov/codecov-action@v2
73+
with:
74+
files: ./build/reports/jacoco/test/jacocoTestReport.xml
75+
flags: unittests
76+
fail_ci_if_error: true
77+
verbose: true
6978

7079
build:
7180
name: Build
@@ -77,13 +86,13 @@ jobs:
7786
- uses: actions/checkout@v2
7887

7988
- name: Run Build
80-
run: ./gradlew build
89+
run: make build
8190

8291
- name: Upload App Build
8392
uses: actions/upload-artifact@v2
8493
with:
8594
name: build
86-
path: build/libs/app-0.0.1.jar
95+
path: build/libs/cachey.jar
8796

8897
- name: Cleanup Gradle Cache
8998
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.

.github/workflows/release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Release
2+
on:
3+
workflow_run:
4+
workflows:
5+
- "Lint, Test & Build"
6+
types:
7+
- completed
8+
branches:
9+
- main
10+
11+
jobs:
12+
release:
13+
name: Release
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Release
22+
run: npx semantic-release
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}

.github/workflows/slack_notification.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ on:
1111
- "Deploy"
1212
- "Gitlab Sync"
1313
- "BitBucket Sync"
14-
- "CodeQL"
1514
types:
1615
- completed
1716

.gitlab-ci.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

.releaserc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"branches": ["main", {"name":"beta", "prerelease": true}],
3+
"tagFormat": "v${version}",
4+
"plugins": [
5+
"@semantic-release/commit-analyzer",
6+
"@semantic-release/release-notes-generator",
7+
"@semantic-release/github"
8+
]
9+
}

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ lint:
1313

1414
build:
1515
@echo "Building application"
16-
./gradlew build
16+
./gradlew build -x test
1717

1818
all: install lint test

dangerfile.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { danger, warn, markdown } from 'danger';
2+
3+
// Setup
4+
const { pr } = danger.github;
5+
const modifiedFiles = danger.git.modified_files;
6+
const packageChanged = modifiedFiles.includes('package.json');
7+
const lockfileChanged = modifiedFiles.includes('yarn.lock');
8+
9+
// Always ensure we assign someone, so that our Slackbot can do its work correctly
10+
if (pr.assignee === null) {
11+
fail('Please assign someone to merge this PR, and optionally include people who should review.');
12+
}
13+
14+
const bigPRThreshold = 600;
15+
if (pr.additions + pr.deletions > bigPRThreshold) {
16+
warn(`:exclamation: Big PR`);
17+
markdown(
18+
`>: Pull Request size seems relatively large. If Pull Request contains multiple changes, split each into separate PR will helps faster, easier review.`,
19+
);
20+
}
21+
22+
if (packageChanged && !lockfileChanged) {
23+
const message = 'Changes were made to package.json, but not to yarn.lock';
24+
const idea = 'Perhaps you need to run `yarn install`?';
25+
warn(`${message} - <i>${idea}</i>`);
26+
}

0 commit comments

Comments
 (0)