Skip to content

Commit

Permalink
Merge branch 'dev/feature' into enhancement/release-under-mit
Browse files Browse the repository at this point in the history
  • Loading branch information
APickledWalrus authored Apr 11, 2024
2 parents 0067685 + b5160e2 commit 8226f9f
Show file tree
Hide file tree
Showing 674 changed files with 28,563 additions and 16,483 deletions.
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# .git-blame-ignore-revs

# cleanup lang package - mostly renaming variables
98abf5d7773df11c65d66e4e9485d0f1e3ef8821
Binary file added .github/assets/Cover.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
version: 2
updates:
- package-ecosystem: "github-actions"
target-branch: "dev/patch"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
labels:
- "dependencies"
- package-ecosystem: gradle
- package-ecosystem: "gradle"
target-branch: "dev/patch"
directory: "/"
schedule:
interval: daily
interval: "weekly"
labels:
- "dependencies"
open-pull-requests-limit: 10
6 changes: 3 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<!--- Describe your changes here. --->

---
**Target Minecraft Versions:** <!-- 'any' means all supported versions -->
**Requirements:** <!-- Required plugins, Minecraft versions, server software... -->
**Related Issues:** <!-- Links to related issues -->
**Target Minecraft Versions:** any <!-- 'any' means all supported versions -->
**Requirements:** none <!-- Required plugins, server software... -->
**Related Issues:** none <!-- Links to related issues -->
39 changes: 39 additions & 0 deletions .github/workflows/cleanup-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Cleanup nightly documentation
on: delete
jobs:
cleanup-nightly-docs:
if: github.event.ref_type == 'branch'
runs-on: ubuntu-latest
steps:
- name: Configure workflow
id: configuration
env:
DELETED_BRANCH: ${{ github.event.ref }}
run: |
BRANCH_NAME="${DELETED_BRANCH#refs/*/}"
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT
echo "DOCS_OUTPUT_DIR=${GITHUB_WORKSPACE}/skript-docs/docs/nightly/${BRANCH_NAME}" >> $GITHUB_OUTPUT
echo "DOCS_REPO_DIR=${GITHUB_WORKSPACE}/skript-docs" >> $GITHUB_OUTPUT
- name: Checkout Skript
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
submodules: recursive
path: skript
- name: Setup documentation environment
uses: ./skript/.github/workflows/docs/setup-docs
with:
docs_deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }}
docs_output_dir: ${{ steps.configuration.outputs.DOCS_OUTPUT_DIR }}
- name: Cleanup nightly documentation
env:
DOCS_OUTPUT_DIR: ${{ steps.configuration.outputs.DOCS_OUTPUT_DIR }}
run: |
rm -rf ${DOCS_OUTPUT_DIR} || true
- name: Push nightly documentation cleanup
uses: ./skript/.github/workflows/docs/push-docs
with:
docs_repo_dir: ${{ steps.configuration.outputs.DOCS_REPO_DIR }}
git_name: Nightly Docs Bot
git_email: [email protected]
git_commit_message: "Delete ${{ steps.configuration.outputs.BRANCH_NAME }} branch nightly docs"
109 changes: 109 additions & 0 deletions .github/workflows/docs/generate-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Generate documentation

inputs:
docs_output_dir:
description: "The directory to generate the documentation into"
required: true
type: string
docs_repo_dir:
description: "The skript-docs repository directory"
required: true
type: string
skript_repo_dir:
description: "The skript repository directory"
required: true
type: string
is_release:
description: "Designates whether to generate nightly or release documentation"
required: false
default: false
type: boolean
cleanup_pattern:
description: "A pattern designating which files to delete when cleaning the documentation output directory"
required: false
default: "*"
type: string
generate_javadocs:
description: "Designates whether to generate javadocs for this nightly documentation"
required: false
default: false
type: boolean

outputs:
DOCS_CHANGED:
description: "Whether or not the documentation has changed since the last push"
value: ${{ steps.generate.outputs.DOCS_CHANGED }}

runs:
using: 'composite'
steps:
- name: generate-docs
id: generate
shell: bash
env:
DOCS_OUTPUT_DIR: ${{ inputs.docs_output_dir }}
DOCS_REPO_DIR: ${{ inputs.docs_repo_dir }}
SKRIPT_REPO_DIR: ${{ inputs.skript_repo_dir }}
IS_RELEASE: ${{ inputs.is_release }}
CLEANUP_PATTERN: ${{ inputs.cleanup_pattern }}
GENERATE_JAVADOCS: ${{ inputs.generate_javadocs }}
run: |
replace_in_directory() {
find $1 -type f -exec sed -i -e "s/$2/$3/g" {} \;
}
# this should be replaced with a more reliable jq command,
# but it can't be right now because docs.json is actually not valid json.
get_skript_version_of_directory() {
grep skriptVersion "$1/docs.json" | cut -d\" -f 4
}
if [ -d "${DOCS_REPO_DIR}/docs/templates" ]
then
export SKRIPT_DOCS_TEMPLATE_DIR=${DOCS_REPO_DIR}/docs/templates
else # compatibility for older versions
export SKRIPT_DOCS_TEMPLATE_DIR=${DOCS_REPO_DIR}/doc-templates
fi
export SKRIPT_DOCS_OUTPUT_DIR=/tmp/generated-docs
cd $SKRIPT_REPO_DIR
if [[ "${IS_RELEASE}" == "true" ]]; then
./gradlew genReleaseDocs releaseJavadoc
elif [[ "${GENERATE_JAVADOCS}" == "true" ]]; then
./gradlew genNightlyDocs javadoc
else
./gradlew genNightlyDocs
fi
if [ -d "${DOCS_OUTPUT_DIR}" ]; then
if [[ "${GENERATE_JAVADOCS}" == "true" ]]; then
mkdir -p "${SKRIPT_DOCS_OUTPUT_DIR}/javadocs" && cp -a "./build/docs/javadoc/." "$_"
fi
mkdir -p "/tmp/normalized-output-docs" && cp -a "${DOCS_OUTPUT_DIR}/." "$_"
mkdir -p "/tmp/normalized-generated-docs" && cp -a "${SKRIPT_DOCS_OUTPUT_DIR}/." "$_"

output_skript_version=$(get_skript_version_of_directory "/tmp/normalized-output-docs")
generated_skript_version=$(get_skript_version_of_directory "/tmp/normalized-generated-docs")

replace_in_directory "/tmp/normalized-output-docs" "${output_skript_version}" "Skript"
replace_in_directory "/tmp/normalized-generated-docs" "${generated_skript_version}" "Skript"

diff -qbr /tmp/normalized-output-docs /tmp/normalized-generated-docs || diff_exit_code=$?
# If diff exits with exit code 1, that means there were some differences
if [[ ${diff_exit_code} -eq 1 ]]; then
echo "DOCS_CHANGED=true" >> $GITHUB_OUTPUT
echo "Documentation has changed since last push"
else
echo "Documentation hasn't changed since last push"
fi
else
echo "DOCS_CHANGED=true" >> $GITHUB_OUTPUT
echo "No existing documentation found"
fi

rm -rf ${DOCS_OUTPUT_DIR}/${CLEANUP_PATTERN} || true
mkdir -p "${DOCS_OUTPUT_DIR}/" && cp -a "${SKRIPT_DOCS_OUTPUT_DIR}/." "$_"


43 changes: 43 additions & 0 deletions .github/workflows/docs/push-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Push documentation

inputs:
docs_repo_dir:
description: "The skript-docs repository directory"
required: true
type: string
git_email:
description: "The email to use for the Git commit"
required: true
type: string
git_name:
description: "The name to use for the Git commit"
required: true
type: string
git_commit_message:
description: "The message to use for the Git commit"
required: true
type: string

runs:
using: 'composite'
steps:
- shell: bash
if: success()
env:
DOCS_REPO_DIR: ${{ inputs.docs_repo_dir }}
GIT_EMAIL: ${{ inputs.git_email }}
GIT_NAME: ${{ inputs.git_name }}
GIT_COMMIT_MESSAGE: ${{ inputs.git_commit_message }}
run: |
cd "${DOCS_REPO_DIR}"
git config user.name "${GIT_NAME}"
git config user.email "${GIT_EMAIL}"
git add -A
git commit -m "${GIT_COMMIT_MESSAGE}" || (echo "Nothing to push!" && exit 0)
# Attempt rebasing and pushing 5 times in case another job pushes before us
for i in 1 2 3 4 5
do
git pull --rebase -X theirs origin main
git push origin main && break
sleep 5
done
43 changes: 43 additions & 0 deletions .github/workflows/docs/setup-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Setup documentation environment

inputs:
docs_deploy_key:
description: "Deploy key for the skript-docs repo"
required: true
type: string
docs_output_dir:
description: "The directory to generate the documentation into"
required: true
type: string
cleanup_pattern:
description: "A pattern designating which files to delete when cleaning the documentation output directory"
required: false
default: "*"
type: string

runs:
using: 'composite'
steps:
- name: Checkout skript-docs
uses: actions/checkout@v3
with:
repository: 'SkriptLang/skript-docs'
path: skript-docs
ssh-key: ${{ inputs.docs_deploy_key }}
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- shell: bash
run: chmod +x ./skript/gradlew
- shell: bash
env:
DOCS_DEPLOY_KEY: ${{ inputs.docs_deploy_key }}
DOCS_OUTPUT_DIR: ${{ inputs.docs_output_dir }}
CLEANUP_PATTERN: ${{ inputs.cleanup_pattern }}
run: |
eval `ssh-agent`
echo "$DOCS_DEPLOY_KEY" | tr -d '\r' | ssh-add - > /dev/null
mkdir ~/.ssh
ssh-keyscan www.github.com >> ~/.ssh/known_hosts
6 changes: 4 additions & 2 deletions .github/workflows/java-17-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ jobs:
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
Expand All @@ -26,7 +28,7 @@ jobs:
- name: Build Skript and run test scripts
run: ./gradlew clean skriptTestJava17
- name: Upload Nightly Build
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: success()
with:
name: skript-nightly
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/java-8-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ jobs:
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
Expand All @@ -26,7 +28,7 @@ jobs:
- name: Build Skript and run test scripts
run: ./gradlew clean skriptTestJava8
- name: Upload Nightly Build
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: success()
with:
name: skript-nightly
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/junit-17-builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: JUnit (MC 1.17+)

on:
push:
branches:
- master
- 'dev/**'
pull_request:

jobs:
build:
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Skript and run JUnit
run: ./gradlew clean JUnitJava17
29 changes: 29 additions & 0 deletions .github/workflows/junit-8-builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: JUnit (MC 1.13-1.16)

on:
push:
branches:
- master
- 'dev/**'
pull_request:

jobs:
build:
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Skript and run JUnit
run: ./gradlew clean JUnitJava8
Loading

0 comments on commit 8226f9f

Please sign in to comment.