Skip to content

Commit

Permalink
ci: initial setup
Browse files Browse the repository at this point in the history
  • Loading branch information
boricj committed Aug 25, 2023
1 parent e558de7 commit b87ff74
Show file tree
Hide file tree
Showing 3 changed files with 196 additions and 0 deletions.
121 changes: 121 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: "ci"

on:
push:
branches:
- "*"
tags:
- "v*"
pull_request:

jobs:
spotless:
runs-on: ubuntu-latest
steps:
-
name: "Checkout"
uses: actions/checkout@v3
-
name: "Setup JDK"
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
-
name: "Setup Ghidra"
uses: er28-0652/setup-ghidra@master
with:
version: "10.3.2"
-
name: "Run spotless"
run: gradle spotlessCheck

build:
runs-on: ubuntu-latest
permissions:
checks: "write"
strategy:
fail-fast: false
matrix:
ghidra:
- "10.3.2"
steps:
-
name: "Checkout"
uses: actions/checkout@v3
-
name: "Setup JDK"
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
-
name: "Setup Ghidra"
uses: er28-0652/setup-ghidra@master
with:
version: ${{ matrix.ghidra }}
-
name: "Build extension"
run: gradle buildExtension
-
name: "Run tests"
uses: coactions/setup-xvfb@v1
with:
run: gradle test jacocoTestReport
-
name: "Upload artifacts"
uses: actions/upload-artifact@v3
with:
path: "dist/*"
if-no-files-found: "error"
-
name: "Collect test reports"
uses: dorny/test-reporter@v1
with:
name: "JUnit tests"
path: "build/test-results/test/*.xml"
reporter: java-junit
-
name: "Upload reports"
uses: actions/upload-artifact@v3
with:
name: "reports"
path: "build/reports/*"
if-no-files-found: "error"

release:
if: startsWith(github.ref, 'refs/tags/v')
needs:
- "build"
runs-on: ubuntu-latest
permissions:
contents: "write"
steps:
-
name: "Checkout"
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: "Setup JDK"
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
java-package: "jre"
-
name: "Download artifacts"
uses: actions/download-artifact@v3
with:
name: "artifact"
path: "dist/"
-
name: "Generate release notes"
run: ./developer_scripts/generate-release-notes.sh | tee release-notes.md
-
name: "GitHub release"
uses: ncipollo/[email protected]
with:
artifacts: "dist/*"
draft: true
bodyFile: "release-notes.md"
24 changes: 24 additions & 0 deletions developer_scripts/generate-release-notes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

set -eEu -o pipefail
shopt -s extdebug

GIT_CHANGELOG_COMMAND_LINE_VERSION="1.104.1"
GIT_CHANGELOG_COMMAND_LINE_JAR="git-changelog-command-line-${GIT_CHANGELOG_COMMAND_LINE_VERSION}.jar"

if [ ! -e "developer_scripts/${GIT_CHANGELOG_COMMAND_LINE_JAR}" ]
then
wget "https://repo1.maven.org/maven2/se/bjurr/gitchangelog/git-changelog-command-line/${GIT_CHANGELOG_COMMAND_LINE_VERSION}/${GIT_CHANGELOG_COMMAND_LINE_JAR}" -O "developer_scripts/${GIT_CHANGELOG_COMMAND_LINE_JAR}"
fi

CURRENT_TAG=$(git describe --tags HEAD)
PREVIOUS_TAG=$(git describe --tags HEAD^ 2>/dev/null || true)

if [ -z "${PREVIOUS_TAG}" ]
then
echo >&2 "Generating release notes for ${CURRENT_TAG} from beginning..."
java -jar "developer_scripts/${GIT_CHANGELOG_COMMAND_LINE_JAR}" --github-enabled --template developer_scripts/release-notes.mustache -std
else
echo >&2 "Generating release notes for ${CURRENT_TAG} from ${PREVIOUS_TAG}..."
java -jar "developer_scripts/${GIT_CHANGELOG_COMMAND_LINE_JAR}" --github-enabled --template developer_scripts/release-notes.mustache -std --from-revision "$(git describe --tags HEAD^)"
fi
51 changes: 51 additions & 0 deletions developer_scripts/release-notes.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{#tags}}
## {{repoName}} {{name}} ({{tagDate .}})

{{#ifContainsBreaking commits}}
### Breaking changes

{{#commits}}
{{#ifCommitBreaking .}}
- {{#eachCommitScope .}} **{{.}}** {{/eachCommitScope}} {{{commitDescription .}}} ([{{subString hash 0 5}}](https://github.com/{{ownerName}}/{{repoName}}/commit/{{hash}}) {{authorName}}) {{#eachCommitRefs .}}{{#ifMatches . "^#[0-9]+"}} [{{.}}](https://github.com/{{ownerName}}/{{repoName}}/issues/{{subString . 1}}) {{/ifMatches}}{{/eachCommitRefs}} {{#eachCommitFixes .}}{{#ifMatches . "^#[0-9]+"}} [{{.}}](https://github.com/{{ownerName}}/{{repoName}}/issues/{{subString . 1}}) {{/ifMatches}}{{/eachCommitFixes}}
{{/ifCommitBreaking}}
{{/commits}}

{{/ifContainsBreaking}}
{{#ifContainsType commits type='feat'}}
### Features

{{#commits}}
{{#ifCommitType . type='feat'}}
- {{#eachCommitScope .}} **{{.}}** {{/eachCommitScope}} {{{commitDescription .}}} ([{{subString hash 0 5}}](https://github.com/{{ownerName}}/{{repoName}}/commit/{{hash}}) {{authorName}}) {{#eachCommitRefs .}}{{#ifMatches . "^#[0-9]+"}} [{{.}}](https://github.com/{{ownerName}}/{{repoName}}/issues/{{subString . 1}}) {{/ifMatches}}{{/eachCommitRefs}} {{#eachCommitFixes .}}{{#ifMatches . "^#[0-9]+"}} [{{.}}](https://github.com/{{ownerName}}/{{repoName}}/issues/{{subString . 1}}) {{/ifMatches}}{{/eachCommitFixes}}
{{/ifCommitType}}
{{/commits}}

{{/ifContainsType}}
{{#ifContainsType commits type='fix'}}
### Bug Fixes

{{#commits}}
{{#ifCommitType . type='fix'}}
- {{#eachCommitScope .}} **{{.}}** {{/eachCommitScope}} {{{commitDescription .}}} ([{{subString hash 0 5}}](https://github.com/{{ownerName}}/{{repoName}}/commit/{{hash}}) {{authorName}}) {{#eachCommitRefs .}}{{#ifMatches . "^#[0-9]+"}} [{{.}}](https://github.com/{{ownerName}}/{{repoName}}/issues/{{subString . 1}}) {{/ifMatches}}{{/eachCommitRefs}} {{#eachCommitFixes .}}{{#ifMatches . "^#[0-9]+"}} [{{.}}](https://github.com/{{ownerName}}/{{repoName}}/issues/{{subString . 1}}) {{/ifMatches}}{{/eachCommitFixes}}
{{/ifCommitType}}
{{/commits}}

{{/ifContainsType}}
{{#ifContainsType commits type='^($|(?!fix|feat|breaking))'}}
### Other changes

{{#commits}}
{{#ifCommitType . type='^($|(?!fix|feat|breaking))'}}
**{{{messageTitle}}}**

{{#messageBodyItems}}
* {{.}}
{{/messageBodyItems}}

[{{subString hash 0 5}}](https://github.com/{{ownerName}}/{{repoName}}/commit/{{hash}}) {{authorName}} *{{commitTime}}*

{{/ifCommitType}}
{{/commits}}

{{/ifContainsType}}
{{/tags}}

0 comments on commit b87ff74

Please sign in to comment.