Skip to content

Commit

Permalink
added workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
testersen committed Nov 7, 2023
1 parent c74fa55 commit 05f3cff
Show file tree
Hide file tree
Showing 4 changed files with 219 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CodeQL
on:
# @formatter:off
workflow_call: {}
# @formatter:on
schedule:
- cron: 0 0 * * *
jobs:
codeql:
name: CodeQL
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
packages: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: github/codeql-action/init@v2
with:
languages: java
- run: ./gradlew build
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
- uses: github/codeql-action/analyze@v2
with:
category: /language:java
52 changes: 52 additions & 0 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Quality Assurance
on: [ pull_request, workflow_call ]
jobs:
# IntelliJ formatter is f*#$ed...
# format:
# name: QA IntelliJ Format
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-java@v3
# with:
# distribution: temurin
# java-version: 17
# - uses: telenornorway/setup-intellij@v0
# - uses: telenornorway/action-intellij-format@v0
lint:
name: QA IntelliJ Lint
runs-on: ubuntu-latest
permissions:
packages: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: telenornorway/setup-intellij@v0
- uses: telenornorway/action-intellij-inspect@v0
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}

test:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- run: ./gradlew test
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
codeql:
permissions:
actions: read
contents: read
security-events: write
packages: read
uses: ./.github/workflows/codeql.yml
83 changes: 83 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Release (semver)
on:
workflow_dispatch:
inputs:
semver:
type: choice
description: What kind of release is this?
required: true
default: patch
options:
- major
- minor
- patch
message:
type: string
description: An optional release message
required: false
jobs:
quality-assurance:
permissions:
actions: read
contents: read
security-events: write
packages: read
name: Quality Assurance
uses: ./.github/workflows/qa.yml
versioning:
name: Versioning
runs-on: ubuntu-latest
permissions:
contents: read
if: github.ref == 'refs/heads/main'
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: oss-actions/auto-semver@v0
id: version
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
type: ${{ inputs.semver }}
vprefix: disabled
release:
name: Release
runs-on: ubuntu-latest
needs: [ quality-assurance, versioning ]
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v3
# region todo(James Bradlee): Find an effective way to do this in a different job and
# download the cache and artifacts for immediate release when
# quality assurance is complete.
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Build
env:
VERSION: ${{ needs.versioning.outputs.version }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
run: ./gradlew build
- name: Release (packages)
env:
VERSION: ${{ needs.versioning.outputs.version }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
run: ./gradlew publish
# endregion
- name: Release (git tag)
env:
GITHUB_TOKEN: ${{ github.token }}
VERSION: ${{ needs.versioning.outputs.version }}
TITLE: ${{ inputs.message }}
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git tag $VERSION
git push -u origin $VERSION
# todo, upload release artifacts
# gh release create --verify-tag -t $TITLE
52 changes: 52 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release (snapshot)
on: [ push ]
jobs:
quality-assurance:
permissions:
actions: read
contents: read
security-events: write
packages: read
name: Quality Assurance
uses: ./.github/workflows/qa.yml
versioning:
name: Versioning
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- id: version
env:
GIT_SHA: ${{ github.sha }}
run: |
echo "version=${GIT_SHA:0:16}-SNAPSHOT" >> $GITHUB_OUTPUT
release:
name: Release (Snapshot)
runs-on: ubuntu-latest
needs: [ quality-assurance, versioning ]
permissions:
packages: write
steps:
- uses: actions/checkout@v3
# region todo(James Bradlee): Find an effective way to do this in a different job and
# download the cache and artifacts for immediate release when
# quality assurance is complete.
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Build
env:
VERSION: ${{ needs.versioning.outputs.version }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
run: ./gradlew build
- name: Release (packages)
env:
VERSION: ${{ needs.versioning.outputs.version }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
run: ./gradlew publish
# endregion

0 comments on commit 05f3cff

Please sign in to comment.