Skip to content

chore: setup ci #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": [
":enableRenovate",
":semanticCommits",
":enablePreCommit",
"config:best-practices"
],
"platform": "github",
"onboarding": false,
"requireConfig": "optional",
"timezone": "UTC",
"dependencyDashboard": true,
"platformCommit": true,
"prCreation": "not-pending",
"suppressNotifications": ["prIgnoreNotification"],
"rebaseWhen": "conflicted",
"packageRules": [
{"matchUpdateTypes": ["major"], "addLabels": ["dependency/major"]},
{"matchUpdateTypes": ["minor"], "addLabels": ["dependency/minor"]},
{"matchUpdateTypes": ["patch"], "addLabels": ["dependency/patch"]}
]
}
82 changes: 82 additions & 0 deletions .github/workflows/flex-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
name: Flex Build

"on":
workflow_call:
inputs:
mc:
description: Minecraft version
type: string
lex:
description: LexForge version
type: string
neo:
description: NeoForge version
type: string
java:
description: Java version
required: true
type: string
upload:
description: Upload the build artifacts
default: true
type: boolean
publish:
description: Run Gradle publish
default: false
type: boolean

jobs:
build: # TODO: add build attestation and generate then combine gradle dependency graphs for SBOM
name: Build ${{ inputs.mc }}
runs-on: blacksmith-2vcpu-ubuntu-2204
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Cache build
id: cache
uses: useblacksmith/cache@v5
with:
path: build
key: build-${{ inputs.mc }}-${{ hashFiles('./*') }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not great and should exclude files like release-please-config.json, README.MD and LICENSE, but besides those all other files affect ci, code or build system and changes should satisfy a rebuild of everything


- if: steps.cache.outputs.cache-hit != 'true'
name: Setup Java
uses: useblacksmith/setup-java@v5
with:
distribution: temurin
java-version: ${{ inputs.java }}

- if: steps.cache.outputs.cache-hit != 'true'
name: Setup Gradle
uses: useblacksmith/setup-gradle/setup-gradle@v5
with:
workflow-job-context: '{}' # FIXME: avoid this cache duplication workaround

- if: |
steps.cache.outputs.cache-hit != 'true'
&& !inputs.release
name: Gradle build
run: >
./gradlew build --stacktrace
-Pminecraft_version=${{ inputs.mc }}
-Plexforge_version=${{ inputs.lex }}
-Pneoforge_version=${{ inputs.neo }}

- if: inputs.release
name: Gradle publish
env:
IS_MAVEN_PUB: true
DEPLOY_TO_GITHUB_PACKAGES_URL: https://maven.pkg.github.com/${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew publish

- if: inputs.upload
name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: jars-${{ inputs.mc }}
path: build/libs/*.jar
Loading
Loading