Skip to content

Commit c838727

Browse files
authored
Merge pull request #8 from icon-project/7-add-cicd-workflows
ci: add release workflow
2 parents 81d77d7 + 649f157 commit c838727

File tree

11 files changed

+212
-2
lines changed

11 files changed

+212
-2
lines changed

.github/labeler.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
cicd:
2+
- '.github/workflows/*'
3+
4+
scripts:
5+
- 'scripts/*'
6+
7+
test:
8+
- 'test/**'
9+
10+
documentation:
11+
- '**/*.md'
12+
13+
docker:
14+
- 'docker/**'
15+

.github/release.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# .github/release.yml
2+
3+
changelog:
4+
exclude:
5+
labels:
6+
- cicd
7+
- scripts
8+
- test
9+
categories:
10+
- title: Breaking Changes 🛠
11+
labels:
12+
- Major
13+
- breaking-change
14+
- title: New Features 🎉
15+
labels:
16+
- Minor
17+
- enhancement
18+
- Feature
19+
- title: Bug Fixes 🐛
20+
labels:
21+
- Patch
22+
- bug
23+
- title: Other Changes 📝
24+
labels:
25+
- "*"

.github/workflows/auto-pr-labeler.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Pull Request Labeler
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- edited
7+
- synchronize
8+
jobs:
9+
auto-label:
10+
permissions:
11+
contents: read
12+
pull-requests: write
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Find Current Pull Request
16+
uses: jwalton/gh-find-current-pr@v1.3.2
17+
id: findPr
18+
with:
19+
# Can be "open", "closed", or "all". Defaults to "open".
20+
state: open
21+
- run: echo "PR Number is ${PR}"
22+
if: success() && steps.findPr.outputs.number
23+
env:
24+
PR: ${{ steps.findPr.outputs.pr }}
25+
26+
- name: check pr pr-number
27+
run: echo ${{ github.event.number }}
28+
29+
- uses: actions/labeler@v4
30+
with:
31+
dot: true
32+
pr-number: ${{ steps.findPr.outputs.pr }}
33+

.github/workflows/check-pr-label.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: PR Label Checker
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- synchronize
7+
- reopened
8+
- labeled
9+
- unlabeled
10+
11+
jobs:
12+
13+
check_labels:
14+
name: Check PR labels
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: docker://agilepathway/pull-request-label-checker:latest
18+
with:
19+
any_of: documentation,enhancement,bug,cicd,test,breaking-change,feature,scripts
20+
repo_token: ${{ secrets.GITHUB_TOKEN }}
21+

.github/workflows/lint-pr.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Lint PR
2+
on:
3+
pull_request_target:
4+
types:
5+
- opened
6+
- edited
7+
- synchronize
8+
jobs:
9+
main:
10+
name: Validate PR title
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: amannn/action-semantic-pull-request@v5.1.0
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
with:
17+
validateSingleCommit: true
18+
validateSingleCommitMatchesPrTitle: true

.github/workflows/release.yml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
permissions:
7+
contents: write
8+
packages: write
9+
repository-projects: write
10+
11+
jobs:
12+
build_javascore:
13+
name: Build Javascore Contracts
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
with:
19+
submodules: true
20+
21+
- name: Build Javascore Contracts
22+
run: |
23+
./gradlew clean build
24+
./gradlew optimizedJar
25+
./gradlew zipOutputOptimizedJars
26+
- name: Upload Artifacts
27+
uses: actions/upload-artifact@v3
28+
with:
29+
name: javascore-contracts
30+
path: ./build/javascore-contracts.zip
31+
32+
release:
33+
name: Release and Publish
34+
runs-on: ubuntu-latest
35+
needs:
36+
- build_javascore
37+
steps:
38+
- name: Initialize variables
39+
id: vars
40+
run: |
41+
echo «::set-output name=date::$(date +'%Y-%m-%d')»
42+
echo «::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)»
43+
- name: Download Javascore Artifacts
44+
uses: actions/download-artifact@v2
45+
with:
46+
name: javascore-contracts
47+
path: javascore-contracts
48+
49+
- name: Unzip Javascore Artifacts
50+
run: unzip javascore-contracts/javascore-contracts.zip -d javascore-contracts && rm -rf javascore-contracts/javascore-contracts.zip
51+
52+
- name: Changelog
53+
uses: scottbrenner/generate-changelog-action@master
54+
id: Changelog
55+
env:
56+
REPO: ${{ github.repository }}
57+
58+
- name: Generate checksum
59+
uses: jmgilman/actions-generate-checksum@v1
60+
with:
61+
patterns: |
62+
javascore-contracts/*.jar
63+
output: check256sums.txt
64+
65+
- name: Create Release
66+
id: create_release
67+
uses: softprops/action-gh-release@v1
68+
if: startsWith(github.ref, 'refs/tags/')
69+
with:
70+
token: ${{ secrets.GITHUB_TOKEN }}
71+
body: |
72+
${{ steps.Changelog.outputs.changelog }}
73+
files: |
74+
./javascore-contracts/*.jar
75+
check256sums.txt

buckets/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,3 @@ task integrationTest(type: Test) {
7878

7979
}
8080

81-

build.gradle

+19
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,23 @@ gradle.taskGraph.whenReady { taskGraph ->
6060
}
6161

6262

63+
task collectOptimizedJars(type: Copy) {
64+
from subprojects.collect { subproject ->
65+
subproject.fileTree('build/libs') {
66+
include '**/*-optimized.jar'
67+
}
68+
}
69+
into "$buildDir/output-jars"
70+
}
71+
72+
task zipOutputOptimizedJars(type: Zip) {
73+
dependsOn collectOptimizedJars
74+
from("$buildDir/output-jars") {
75+
include '**/*-optimized.jar'
76+
}
77+
archiveFileName = "javascore-contracts.zip"
78+
destinationDirectory = file("$buildDir")
79+
}
80+
81+
6382

insurance/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jacocoTestReport {
2525
}
2626

2727
optimizedJar {
28+
dependsOn project(':score-lib').jar
2829
mainClassName = 'icon.inflation.score.insurance.Insurance'
2930
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
3031
from {

network-owned-liquidity/build.gradle

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jacocoTestReport {
2828
}
2929

3030
optimizedJar {
31+
dependsOn project(':score-lib').jar
3132
mainClassName = 'icon.inflation.score.nol.NetworkOwnedLiquidity'
3233
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
3334
from {
@@ -83,3 +84,5 @@ task integrationTest(type: Test) {
8384
}
8485

8586
}
87+
88+

savings-rate/build.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jacocoTestReport {
2828
}
2929

3030
optimizedJar {
31+
dependsOn project(':score-lib').jar
3132
mainClassName = 'icon.inflation.score.savings.SavingsRate'
3233
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
3334
from {
@@ -82,4 +83,4 @@ task integrationTest(type: Test) {
8283
systemProperty "java", optimizedJar.outputJarName
8384
}
8485

85-
}
86+
}

0 commit comments

Comments
 (0)