Skip to content

Commit

Permalink
Improve Build CI/CD System (#552)
Browse files Browse the repository at this point in the history
This improves the Build CI/CD System and the Release Commit Workflows.

The CD system now builds and zips the pack in parallel, increasing the speed twofold.
The CI system now does not produce double zips, but remains the same speed, thanks to parallel processing.

The CI system now also changes server.properties and random patches config files for the build, and the buildscript has been edited for that.

Since the CI system replaces the nightly task, the nightly workflow has been deleted. The makeArtifactNames task is now used, and has been changed to remove usage of deprecated features.

The release commit workflows now supports updating files without version input, and the version is grabbed from versions.txt.' The code for the release commit workflows has also been greatly cleaned up.

The changes made to the random patches template files have also been updated. The changes made incorrectly to the issue templates in #487 have also been fixed.

The README badges have also been changed. The issue badge has been replaced by a nightly builds badge.

Finally, this changes the forge download process to try again if the response is null, resulting in a decrease, to almost none, test build pack and build pack failures.

[INTERNAL]
[IGNORE]
checks = { compareNot = "1.7-alpha-1" }
[IGNORE]
  • Loading branch information
IntegerLimit committed Dec 4, 2023
1 parent 00a04e5 commit 8a4b323
Show file tree
Hide file tree
Showing 30 changed files with 618 additions and 341 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/001-bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ body:
id: version
attributes:
label: Nomi CEu Version
description: The version of Nomi CEu you were using when this bug was encountered. If you do not know what it is, check the title of your instance window. If you do not see your version here, please update to the newest alpha, beta or release of the pack.
description: The version of Nomi CEu you were using when this bug was encountered. If you do not know what it is, check the title of your instance window. If you do not see your version here, please update to the newest alpha, beta or release of the pack.
options:
- 1.7-alpha-1
- 1.6.1a
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/002-feature-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ body:
id: version
attributes:
label: Nomi CEu Version
description: The version of Nomi CEu you were using when this bug was encountered. If you do not know what it is, check the title of your instance window. If you do not see your version here, please update to the newest alpha, beta or release of the pack.
description: The version of Nomi CEu you are using as the basis for this feature request. If you do not know what it is, check the title of your instance window. f you do not see your version here, please update to the newest alpha, beta or release of the pack.
options:
- 1.7-alpha-1
- 1.6.1a
Expand Down
318 changes: 299 additions & 19 deletions .github/workflows/buildpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ on:
required: false

jobs:
build:
buildSingle:
name: Build Pack (${{ inputs.tag }})
runs-on: ubuntu-latest
if: ${{ !inputs.separate_upload }}
env:
GITHUB_TAG: ${{ inputs.tag }}
RELEASE_TYPE: ${{ inputs.release_type }}
Expand Down Expand Up @@ -124,60 +125,339 @@ jobs:
CURSEFORGE_API_TOKEN: ${{ secrets.CURSEFORGE_API_TOKEN }}
CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }}

- name: Build Pack
- name: Build and Zip Pack
working-directory: ./tools
run: npx gulp buildAll
run: npx gulp
env:
CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }}
CHANGELOG_BRANCH: ${{ inputs.changelog_branch }}
CHANGELOG_URL: ${{ inputs.changelog_url }}
CHANGELOG_CF_URL: ${{ inputs.changelog_cf_url }}
COMPARE_TAG: ${{ inputs.compare_tag }}

- name: Zip Pack
working-directory: ./tools
run: npx gulp zipAll

- name: Upload All Files
uses: actions/upload-artifact@v3
if: ${{ !inputs.separate_upload }}
with:
name: Built Pack
path: |
./build/*.zip
./build/*.md
if-no-files-found: error

makeNames:
name: Make Artifact Names (${{ inputs.tag }})
runs-on: ubuntu-latest
if: ${{ inputs.separate_upload }}
env:
GITHUB_TAG: ${{ inputs.tag }}
RELEASE_TYPE: ${{ inputs.release_type }}
GITHUB_HEAD_REF: ${{ inputs.head_ref }}
TRUE_SHA: ${{ inputs.true_sha }}
outputs:
client: ${{ steps.artifactNames.outputs.client }}
server: ${{ steps.artifactNames.outputs.server }}
lang: ${{ steps.artifactNames.outputs.lang }}
mmc: ${{ steps.artifactNames.outputs.mmc }}
steps:
- name: Checkout Ref
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.tag }}

- name: Restore Cached Files
uses: actions/cache@v3
id: cache
with:
path: |
~/.npm
./.cache
./tools/node_modules
key: ${{ runner.os }}-bunny-${{ hashFiles('**/.cache', '**/package-lock.json', '**/manifest.json') }}
restore-keys: ${{ runner.os }}-bunny-

- name: Setup NodeJS v16
uses: actions/setup-node@v3
with:
node-version: "16"
check-latest: true

- name: Setup NPM Packages
working-directory: ./tools
run: npm ci

- name: Check Environmental Variables
working-directory: ./tools
run: npx gulp check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CURSEFORGE_PROJECT_ID: ${{ secrets.CURSEFORGE_PROJECT_ID }}
CURSEFORGE_API_TOKEN: ${{ secrets.CURSEFORGE_API_TOKEN }}
CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }}

- name: Make Artifact Names
id: artifactNames
working-directory: ./tools
run: npx gulp makeArtifactNames

buildClient:
name: Build Pack Client (${{ inputs.tag }})
runs-on: ubuntu-latest
if: ${{ inputs.separate_upload }}
needs: makeNames
env:
GITHUB_TAG: ${{ inputs.tag }}
RELEASE_TYPE: ${{ inputs.release_type }}
GITHUB_HEAD_REF: ${{ inputs.head_ref }}
TRUE_SHA: ${{ inputs.true_sha }}
steps:
- name: Checkout Ref
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.tag }}

- name: Restore Cached Files
uses: actions/cache@v3
id: cache
with:
path: |
~/.npm
./.cache
./tools/node_modules
key: ${{ runner.os }}-bunny-${{ hashFiles('**/.cache', '**/package-lock.json', '**/manifest.json') }}
restore-keys: ${{ runner.os }}-bunny-

- name: Setup NodeJS v16
uses: actions/setup-node@v3
with:
node-version: "16"
check-latest: true

- name: Setup NPM Packages
working-directory: ./tools
run: npm ci

- name: Check Environmental Variables
working-directory: ./tools
run: npx gulp check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CURSEFORGE_PROJECT_ID: ${{ secrets.CURSEFORGE_PROJECT_ID }}
CURSEFORGE_API_TOKEN: ${{ secrets.CURSEFORGE_API_TOKEN }}
CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }}

- name: Build Client
working-directory: ./tools
run: npx gulp buildClient
env:
CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }}
CHANGELOG_BRANCH: ${{ inputs.changelog_branch }}
CHANGELOG_URL: ${{ inputs.changelog_url }}
CHANGELOG_CF_URL: ${{ inputs.changelog_cf_url }}
COMPARE_TAG: ${{ inputs.compare_tag }}

- name: Upload Client Zip
uses: actions/upload-artifact@v3
if: ${{ inputs.separate_upload }}
with:
name: Client Zip
path: ./build/*-client.zip
name: ${{ needs.makeNames.outputs.client }}
path: ./build/client/**/*
if-no-files-found: error

buildServer:
name: Build Pack Server (${{ inputs.tag }})
runs-on: ubuntu-latest
if: ${{ inputs.separate_upload }}
needs: makeNames
env:
GITHUB_TAG: ${{ inputs.tag }}
RELEASE_TYPE: ${{ inputs.release_type }}
GITHUB_HEAD_REF: ${{ inputs.head_ref }}
TRUE_SHA: ${{ inputs.true_sha }}
steps:
- name: Checkout Ref
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.tag }}

- name: Restore Cached Files
uses: actions/cache@v3
id: cache
with:
path: |
~/.npm
./.cache
./tools/node_modules
key: ${{ runner.os }}-bunny-${{ hashFiles('**/.cache', '**/package-lock.json', '**/manifest.json') }}
restore-keys: ${{ runner.os }}-bunny-

- name: Setup NodeJS v16
uses: actions/setup-node@v3
with:
node-version: "16"
check-latest: true

- name: Setup NPM Packages
working-directory: ./tools
run: npm ci

- name: Check Environmental Variables
working-directory: ./tools
run: npx gulp check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CURSEFORGE_PROJECT_ID: ${{ secrets.CURSEFORGE_PROJECT_ID }}
CURSEFORGE_API_TOKEN: ${{ secrets.CURSEFORGE_API_TOKEN }}
CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }}

- name: Build Server
working-directory: ./tools
run: npx gulp buildServer
env:
CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }}
CHANGELOG_BRANCH: ${{ inputs.changelog_branch }}
CHANGELOG_URL: ${{ inputs.changelog_url }}
CHANGELOG_CF_URL: ${{ inputs.changelog_cf_url }}
COMPARE_TAG: ${{ inputs.compare_tag }}

- name: Upload Server Zip
uses: actions/upload-artifact@v3
if: ${{ inputs.separate_upload }}
with:
name: Server Zip
path: ./build/*-server.zip
name: ${{ needs.makeNames.outputs.server }}
path: ./build/server/**/*
if-no-files-found: error

- name: Upload Lang Zip
buildMMC:
name: Build Pack MMC (${{ inputs.tag }})
runs-on: ubuntu-latest
if: ${{ inputs.separate_upload }}
needs: makeNames
env:
GITHUB_TAG: ${{ inputs.tag }}
RELEASE_TYPE: ${{ inputs.release_type }}
GITHUB_HEAD_REF: ${{ inputs.head_ref }}
TRUE_SHA: ${{ inputs.true_sha }}
steps:
- name: Checkout Ref
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.tag }}

- name: Restore Cached Files
uses: actions/cache@v3
id: cache
with:
path: |
~/.npm
./.cache
./tools/node_modules
key: ${{ runner.os }}-bunny-${{ hashFiles('**/.cache', '**/package-lock.json', '**/manifest.json') }}
restore-keys: ${{ runner.os }}-bunny-

- name: Setup NodeJS v16
uses: actions/setup-node@v3
with:
node-version: "16"
check-latest: true

- name: Setup NPM Packages
working-directory: ./tools
run: npm ci

- name: Check Environmental Variables
working-directory: ./tools
run: npx gulp check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CURSEFORGE_PROJECT_ID: ${{ secrets.CURSEFORGE_PROJECT_ID }}
CURSEFORGE_API_TOKEN: ${{ secrets.CURSEFORGE_API_TOKEN }}
CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }}

- name: Build MMC
working-directory: ./tools
run: npx gulp buildMMC
env:
CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }}
CHANGELOG_BRANCH: ${{ inputs.changelog_branch }}
CHANGELOG_URL: ${{ inputs.changelog_url }}
CHANGELOG_CF_URL: ${{ inputs.changelog_cf_url }}
COMPARE_TAG: ${{ inputs.compare_tag }}

- name: Upload MMC Zip
uses: actions/upload-artifact@v3
if: ${{ inputs.separate_upload }}
with:
name: Lang Zip
path: ./build/*-lang.zip
name: ${{ needs.makeNames.outputs.mmc }}
path: ./build/mmc/**/*
if-no-files-found: error

- name: Upload MMC Zip

buildLang:
name: Build Pack Lang and Changelogs (${{ inputs.tag }})
runs-on: ubuntu-latest
if: ${{ inputs.separate_upload }}
needs: makeNames
env:
GITHUB_TAG: ${{ inputs.tag }}
RELEASE_TYPE: ${{ inputs.release_type }}
GITHUB_HEAD_REF: ${{ inputs.head_ref }}
TRUE_SHA: ${{ inputs.true_sha }}
steps:
- name: Checkout Ref
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.tag }}

- name: Restore Cached Files
uses: actions/cache@v3
id: cache
with:
path: |
~/.npm
./.cache
./tools/node_modules
key: ${{ runner.os }}-bunny-${{ hashFiles('**/.cache', '**/package-lock.json', '**/manifest.json') }}
restore-keys: ${{ runner.os }}-bunny-

- name: Setup NodeJS v16
uses: actions/setup-node@v3
with:
node-version: "16"
check-latest: true

- name: Setup NPM Packages
working-directory: ./tools
run: npm ci

- name: Check Environmental Variables
working-directory: ./tools
run: npx gulp check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CURSEFORGE_PROJECT_ID: ${{ secrets.CURSEFORGE_PROJECT_ID }}
CURSEFORGE_API_TOKEN: ${{ secrets.CURSEFORGE_API_TOKEN }}
CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }}

- name: Build Lang and Changelogs
working-directory: ./tools
run: npx gulp buildLang
env:
CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }}
CHANGELOG_BRANCH: ${{ inputs.changelog_branch }}
CHANGELOG_URL: ${{ inputs.changelog_url }}
CHANGELOG_CF_URL: ${{ inputs.changelog_cf_url }}
COMPARE_TAG: ${{ inputs.compare_tag }}

- name: Upload Lang Zip
uses: actions/upload-artifact@v3
if: ${{ inputs.separate_upload }}
with:
name: MMC Zip
path: ./build/*-mmc.zip
name: ${{ needs.makeNames.outputs.lang }}
path: ./build/lang/**/*
if-no-files-found: error

- name: Upload Changelogs
Expand Down

0 comments on commit 8a4b323

Please sign in to comment.