Skip to content

Commit

Permalink
Merge pull request #25 from TeamKun/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
PeyaPeyaPeyang authored Jul 31, 2024
2 parents 082cc7b + 51fbe25 commit ac9f6b5
Show file tree
Hide file tree
Showing 554 changed files with 25,097 additions and 22,281 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/build-nms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Build NMS with NMSAction
on:
workflow_call:
secrets:
token:
required: true

jobs:
check-whether-has-to-build:
name: Check whether has to build
runs-on: ubuntu-latest
outputs:
cache-hit: ${{ steps.check.outputs.cache-hit }}
steps:
- name: Check whether has to build
id: check
uses: actions/cache@v4
with:
lookup-only: true
path: nms-build/.m2
key: scenamatica-nms
restore-keys: scenamatica-nms
build-nms:
name: Build NMS with NMSAction
needs: check-whether-has-to-build
if: needs.check-whether-has-to-build.outputs.cache-hit != 'true'
strategy:
matrix:
nms-version:
- 1.16.5
- 1.16.3
- 1.15.2
- 1.14.4
- 1.13.2
- "1.13"
runs-on: ubuntu-latest
steps:
- name: Build NMS if cache miss
uses: PeyaPeyaPeyang/nmsaction@v9
with:
rev: ${{ matrix.nms-version }}
- name: Cache NMS
uses: actions/cache@v4
with:
path: nms-build/.m2
key: nms-maven-${{ matrix.nms-version }}
collect-to-one-artifact:
name: Collect to one artifact
runs-on: ubuntu-latest
needs: build-nms
if: needs.check-whether-has-to-build.outputs.cache-hit != 'true'
steps:
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- run: npm install @actions/cache @actions/github
- uses: actions/github-script@v7
with:
script: |
const cache = require('@actions/cache');
const gh = require('@actions/github');
const path = require('path');
const nmsVersions = [
'1.16.5',
'1.16.3',
'1.15.2',
'1.14.4',
'1.13.2',
'1.13'
];
const octokit = gh.getOctokit(process.env.GITHUB_TOKEN);
for (const nmsVersion of nmsVersions) {
const key = `nms-maven-${nmsVersion}`;
const cacheKey = await cache.restoreCache(
['nms-build/.m2'],
key,
nmsVersions
);
if (cacheKey) {
console.log(`Cache restored from key: ${cacheKey}`);
} else {
console.error(`Cache not found for key: ${key}`);
process.exit(1);
}
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Save caches
uses: actions/cache/save@v4
with:
path: nms-build/.m2
key: nms-maven
46 changes: 46 additions & 0 deletions .github/workflows/build-scenamatica.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build NMS with NMSAction
on:
workflow_call:
secrets:
token:
required: true

jobs:
build:
name: Build with Maven
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Change directory to scenamatica
run: cd Scenamatica
- name: Set up JDK 8
uses: actions/setup-java@v4
id: maven-cache
with:
java-version: 8
distribution: zulu
cache: maven
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.8.2
- name: Restore NMS cache
uses: actions/cache@v4
with:
path: nms-build/.m2
key: scenamatica-nms
restore-keys: scenamatica-nms
- name: Deploy NMS cache
if: steps.maven-cache.outputs.cache-hit != 'true'
run: |
mv -f nms-build/.m2/repository/repository $HOME/.m2/ -v
- name: Build with Maven
run: |
./Scenamatica/build -D"jar.finalName=Scenamatica" -P debug
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: scenamatica
path: Scenamatica/ScenamaticaPlugin/target/Scenamatica.jar
retention-days: 1
if-no-files-found: error
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ jobs:
- 1.15.2
- 1.14.4
- 1.13.2
- 1.13
runs-on: self-hosted
- "1.13"
runs-on: ubuntu-latest
steps:
- name: Try to restore caches
uses: actions/cache@v4
Expand All @@ -61,7 +61,7 @@ jobs:
key: nms-maven-${{ matrix.nms-version }}
build-and-analyze:
name: Build with Maven
runs-on: self-hosted
runs-on: ubuntu-latest
needs: setup-nms
steps:
- uses: actions/checkout@v4
Expand Down
37 changes: 32 additions & 5 deletions .github/workflows/docs-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,26 @@ permissions:
deployments: write

jobs:
setup-nms:
name: Setup NMS
uses: "./.github/workflows/build-nms.yml"
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
deploy:
needs: setup-nms
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Restore NMS cache
uses: actions/cache@v4
with:
path: nms-build/.m2
key: nms-maven
restore-keys: nms-maven
- name: Deploy NMS cache
run: |
mv -f nms-build/.m2/repository/repository $HOME/.m2/ -v
- uses: actions/checkout@v4
- run: chmod -R +x docs/
- uses: chrnorm/deployment-action@v2
name: Create GitHub Deployment
id: deploy-status
Expand All @@ -31,9 +47,20 @@ jobs:
environment: production
initial-status: in_progress
- name: pnpm-setup
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v3
with:
package_json_file: docs/package.json
- name: Set up JDK 11
uses: actions/setup-java@v4
id: maven-cache
with:
java-version: 11
distribution: zulu
cache: maven
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.8.2
- name: Install dependencies
run: |
cd docs
Expand All @@ -45,13 +72,13 @@ jobs:
pnpm run build
cd ..
- name: Setup Pages
uses: actions/configure-pages@v2
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: "docs/build/"
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4
- name: Update GitHub Deployment
if: success()
uses: chrnorm/deployment-status@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/qodana-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
minecraft: [1.16.5]
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: cd Scenamatica
Expand Down
115 changes: 17 additions & 98 deletions .github/workflows/scenamatica-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,107 +16,17 @@ concurrency:
cancel-in-progress: true
jobs:
setup-nms:
name: Build NMS with NMSAction
strategy:
matrix:
nms-version:
- 1.16.5
- 1.16.3
- 1.15.2
- 1.14.4
- 1.13.2
- 1.13
runs-on: self-hosted
steps:
- name: Try to restore caches
uses: actions/cache@v4
id: restore-cache
with:
path: nms-build/.m2
key: nms-maven-${{ matrix.nms-version }}
restore-keys: |
nms-maven-${{ matrix.nms-version }}
lookup-only: true
- name: Build NMS if cache miss
if: steps.restore-cache.outputs.cache-hit != 'true'
uses: PeyaPeyaPeyang/nmsaction@v9
with:
rev: ${{ matrix.nms-version }}
- name: Save caches
if: steps.restore-cache.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: nms-build/.m2
key: nms-maven-${{ matrix.nms-version }}
name: Setup NMS
uses: "./.github/workflows/build-nms.yml"
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build with Maven
runs-on: self-hosted
needs: setup-nms
steps:
- uses: actions/checkout@v4
- name: Change directory to scenamatica
run: cd Scenamatica
- name: Set up JDK 8
uses: actions/setup-java@v4
id: maven-cache
with:
java-version: 8
distribution: zulu
cache: maven
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.8.2
- uses: actions/setup-node@v4
if: steps.maven-cache.outputs.cache-hit != 'true'
with:
node-version: '20.x'
- run: npm install @actions/cache
if: steps.maven-cache.outputs.cache-hit != 'true'
- name: Restore NMS cache
uses: actions/github-script@v7
if: steps.maven-cache.outputs.cache-hit != 'true'
with:
script: |
const cache = require('@actions/cache');
const path = require('path');
const nmsVersions = [
'1.16.5',
'1.16.3',
'1.15.2',
'1.14.4',
'1.13.2',
'1.13'
];
for (const nmsVersion of nmsVersions) {
const key = `nms-maven-${nmsVersion}`;
const cacheKey = await cache.restoreCache(
['nms-build/.m2'],
key,
nmsVersions
);
if (cacheKey) {
console.log(`Cache restored from key: ${cacheKey}`);
} else {
console.error(`Cache not found for key: ${key}`);
process.exit(1);
}
}
- name: Deploy NMS cache
if: steps.maven-cache.outputs.cache-hit != 'true'
run: |
mv -f nms-build/.m2/repository/repository $HOME/.m2/ -v
- name: Build with Maven
run: |
mvn -B package --file Scenamatica/pom.xml -D"jar.finalName=Scenamatica" -P debug
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: scenamatica
path: Scenamatica/ScenamaticaPlugin/target/Scenamatica.jar
retention-days: 1
if-no-files-found: error
test-other-versions:
uses: "./.github/workflows/build-scenamatica.yml"
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
self-tests:
name: Self-test with Scenamatica
runs-on: ubuntu-latest
needs: build
Expand Down Expand Up @@ -149,3 +59,12 @@ jobs:
env:
NO_SCENAMATICA: true
timeout-minutes: 60
cleanup:
name: Clean up
runs-on: ubuntu-latest
needs: self-tests
steps:
- name: Clean artifacts
uses: geekyeggo/delete-artifact@v2
with:
name: scenamatica
Loading

0 comments on commit ac9f6b5

Please sign in to comment.