-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
92f120c
commit d5eec84
Showing
4 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Test action | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Build Dockerfile | ||
run: docker build . --file Dockerfile | ||
- name: Create custom test script | ||
run: | | ||
mkdir test-scripts | ||
printf 'test "github actions":\nassert true is true with "it worked!"' > test-scripts/actions.sk | ||
- name: Run skript-test-action | ||
uses: ./ | ||
with: | ||
test-script-directory: test-scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM alpine:3.19.1 | ||
LABEL authors="SkriptLang" | ||
|
||
RUN apk add --no-cache git | ||
COPY run-tests.sh /run-tests.sh | ||
|
||
ENTRYPOINT ["/run-tests.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: 'Skript Tests' | ||
description: 'Runs Skript tests' | ||
inputs: | ||
test-script-directory: | ||
description: 'The directory containing the tests to run' | ||
required: true | ||
skript-repo-ref: | ||
description: 'The Git reference of the Skript version to test with (this can be a commit sha, branch, tag, etc.)' | ||
required: false | ||
run-vanilla-tests: | ||
description: 'Controls whether or not the vanilla Skript tests are run. It is recommended you keep this on to ensure your addon doesn''t change vanilla behavior' | ||
required: false | ||
default: 'true' | ||
|
||
outputs: | ||
passed: | ||
description: 'Whether or not the tests passed' | ||
|
||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- ${{ inputs.test-script-directory }} | ||
- ${{ inputs.skript-repo-ref }} | ||
- ${{ inputs.run-vanilla-tests }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh -l | ||
|
||
test_script_directory="$1" | ||
skript_repo_ref="$2" | ||
run_vanilla_tests="$3" | ||
skript_test_directory="src/test/skript/tests" | ||
|
||
git clone --recurse-submodules https://github.com/SkriptLang/Skript.git | ||
cd Skript || exit 1 | ||
if [ -n "$skript_repo_ref" ]; then | ||
git checkout -f "$skript_repo_ref" | ||
fi | ||
if [ "$run_vanilla_tests" = "false" ]; then | ||
rm -rf "${skript_test_directory:?}/*" | ||
fi | ||
cp "/github/workspace/$test_script_directory" "${skript_test_directory:?}/custom" | ||
./gradlew quickTest |