generated from nightcycle/wally-package-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 175af15
Showing
25 changed files
with
842 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,76 @@ | ||
name: Validate Commit | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
|
||
validate: | ||
runs-on: windows-latest | ||
|
||
strategy: | ||
matrix: | ||
scene: [main] | ||
include: | ||
- name: main | ||
steps: | ||
# Checkout your Git repo | ||
- uses: actions/checkout@v2 | ||
|
||
# Install foreman and all foreman tools | ||
- uses: ok-nick/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Install wally packages | ||
- name: install wally packages | ||
run: wally install | ||
|
||
- name: generate sourcemap | ||
run: rojo sourcemap dev.project.json --output sourcemap.json | ||
|
||
- name: export wally package types | ||
run: wally-package-types --sourcemap sourcemap.json Packages | ||
|
||
- name: Install testing files | ||
shell: bash | ||
run: | | ||
# type definitions | ||
if [ ! -d "types" ]; then | ||
mkdir "types" | ||
fi | ||
curl -L "https://gist.github.com/nightcycle/50ca8f42147077b8f584b503030c8500/raw" > "types/testEZ.d.lua" | ||
curl -L "https://gist.github.com/nightcycle/ae7ea3376337512772d1d2b314ef467b/raw" > "types/remodel.d.lua" | ||
curl -L "https://raw.githubusercontent.com/JohnnyMorganz/luau-lsp/main/scripts/globalTypes.d.lua" > "types/globalTypes.d.lua" | ||
# lint definitions | ||
if [ ! -d "lints" ]; then | ||
mkdir "lints" | ||
fi | ||
curl -L "https://gist.github.com/nightcycle/a57e04de443dfa89bd08c8eb001b03c6/raw" > "lints/lua51.yml" | ||
curl -L "https://gist.github.com/nightcycle/93c4b9af5bbf4ed09f39aa908dffccd0/raw" > "lints/luau.yml" | ||
# apply code styling | ||
- name: style src scripts | ||
run: stylua src | ||
|
||
# - name: style built scripts | ||
# shell: bash | ||
# run: | | ||
# if [ ! -d "out" ]; then | ||
# mkdir "out" | ||
# fi | ||
# stylua out | ||
|
||
- name: generate sourcemap | ||
run: rojo sourcemap dev.project.json --output sourcemap.json | ||
|
||
# Test validity | ||
- name: typecheck src files | ||
run: luau-lsp analyze --sourcemap="sourcemap.json" --ignore="Packages/**" --ignore="src/Server/NPC/Animate.server.lua" --ignore="**/Packages/**" --ignore="*.spec.luau" --ignore="out/**" --flag:LuauTypeInferIterationLimit=0 --flag:LuauCheckRecursionLimit=0 --flag:LuauTypeInferRecursionLimit=0 --flag:LuauTarjanChildLimit=0 --flag:LuauTypeInferTypePackLoopLimit=0 --flag:LuauVisitRecursionLimit=0 --definitions=types/globalTypes.d.lua src | ||
|
||
- name: lint src files | ||
run: selene src | ||
|
||
# - name: lint built files | ||
# run: selene out |
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,166 @@ | ||
name: Build and Publish | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
get_published_release: | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
release_id: ${{ steps.release_info.outputs.release_id }} | ||
upload_url: ${{ steps.release_info.outputs.upload_url }} | ||
tag_name: ${{ steps.release_info.outputs.tag_name }} | ||
repo_desc: ${{ steps.release_info.outputs.repo_desc }} | ||
repo_name: ${{ steps.release_info.outputs.repo_name }} | ||
repo_owner_name: ${{ steps.release_info.outputs.repo_owner_name }} | ||
steps: | ||
- name: Set Release Info | ||
id: release_info | ||
run: | | ||
echo "::set-output name=tag_name::${{ github.event.release.tag_name }}" | ||
echo "::set-output name=release_id::${{ github.event.release.id }}" | ||
echo "::set-output name=upload_url::${{ github.event.release.upload_url }}" | ||
repo_owner_name=${{ github.repository_owner }} | ||
echo "::set-output name=repo_owner_name::$repo_owner_name" | ||
repo_name=${{ github.repository }} | ||
forward_repo_pattern="${repo_owner_name}/" | ||
empty_str="" | ||
repo_name="${repo_name/${forward_repo_pattern}/${empty_str}}" | ||
echo "::set-output name=repo_name::$repo_name" | ||
# Use the GitHub API to fetch the repository description | ||
description_prefix="\"description\":" | ||
curl -L "https://api.github.com/repos/${repo_owner_name}/${repo_name}" > "desc.text" | ||
desc=$(<desc.text) | ||
desc=$(echo "$desc" | grep -F "$description_prefix") | ||
desc="${desc/${description_prefix}/${empty_str}}" | ||
repo_desc=$(echo "$desc" | grep -o '"[^"]*"') | ||
echo "::set-output name=repo_desc::$repo_desc" | ||
build_and_publish_to_wally: | ||
needs: get_published_release | ||
runs-on: windows-latest | ||
|
||
steps: | ||
# Checkout your Git repo | ||
- uses: actions/checkout@v2 | ||
|
||
# Install foreman and all foreman tools | ||
- uses: ok-nick/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Install wally packages | ||
- name: install wally packages | ||
run: wally install | ||
|
||
- name: generate sourcemap | ||
run: rojo sourcemap dev.project.json --output sourcemap.json | ||
|
||
- name: export wally package types | ||
run: wally-package-types --sourcemap sourcemap.json Packages | ||
|
||
- name: Install testing files | ||
shell: bash | ||
run: | | ||
# type definitions | ||
if [ ! -d "types" ]; then | ||
mkdir "types" | ||
fi | ||
curl -L "https://gist.github.com/nightcycle/50ca8f42147077b8f584b503030c8500/raw" > "types/testEZ.d.lua" | ||
curl -L "https://gist.github.com/nightcycle/ae7ea3376337512772d1d2b314ef467b/raw" > "types/remodel.d.lua" | ||
curl -L "https://raw.githubusercontent.com/JohnnyMorganz/luau-lsp/main/scripts/globalTypes.d.lua" > "types/globalTypes.d.lua" | ||
# lint definitions | ||
if [ ! -d "lints" ]; then | ||
mkdir "lints" | ||
fi | ||
curl -L "https://gist.github.com/nightcycle/a57e04de443dfa89bd08c8eb001b03c6/raw" > "lints/lua51.yml" | ||
curl -L "https://gist.github.com/nightcycle/93c4b9af5bbf4ed09f39aa908dffccd0/raw" > "lints/luau.yml" | ||
# apply code styling | ||
- name: style src scripts | ||
run: stylua src | ||
|
||
- name: style built scripts | ||
shell: bash | ||
run: | | ||
if [ ! -d "out" ]; then | ||
mkdir "out" | ||
fi | ||
stylua out | ||
- name: generate sourcemap | ||
run: rojo sourcemap dev.project.json --output sourcemap.json | ||
|
||
# Test validity | ||
- name: typecheck src files | ||
run: luau-lsp analyze --sourcemap="sourcemap.json" --ignore="Packages/**" --ignore="**/Packages/**" --ignore="*.spec.luau" --ignore="out/**" --flag:LuauTypeInferIterationLimit=0 --flag:LuauCheckRecursionLimit=0 --flag:LuauTypeInferRecursionLimit=0 --flag:LuauTarjanChildLimit=0 --flag:LuauTypeInferTypePackLoopLimit=0 --flag:LuauVisitRecursionLimit=0 --definitions=types/globalTypes.d.lua src | ||
|
||
- name: lint src files | ||
run: selene src | ||
|
||
- name: Update version and labels | ||
shell: bash | ||
run: | | ||
repo_owner="${{needs.get_published_release.outputs.repo_owner_name}}" | ||
repo_name="${{needs.get_published_release.outputs.repo_name}}" | ||
repo_desc=${{needs.get_published_release.outputs.repo_desc}} | ||
goal_version_str="${{needs.get_published_release.outputs.tag_name}}" | ||
# remove letters | ||
goal_version_str=$(echo "$goal_version_str" | sed 's/[a-zA-Z]//g') | ||
# read file | ||
wally_toml_contents=$(<wally.toml) | ||
# swap out version | ||
goal_version_line="version = \"${goal_version_str}\"" | ||
target_version_line=$(echo "$wally_toml_contents" | grep -F "version = ") | ||
wally_toml_contents="${wally_toml_contents/${target_version_line}/${goal_version_line}}" | ||
# swap out name | ||
goal_name_line="name = \"${repo_owner}/${repo_name}\"" | ||
target_name_line=$(echo "$wally_toml_contents" | grep -F "name = ") | ||
wally_toml_contents="${wally_toml_contents/${target_name_line}/${goal_name_line}}" | ||
# swap out description | ||
goal_desc_line="description = \"${repo_desc}\"" | ||
target_desc_line=$(echo "$wally_toml_contents" | grep -F "description = ") | ||
wally_toml_contents="${wally_toml_contents/${target_desc_line}/${goal_desc_line}}" | ||
# update file | ||
echo "$wally_toml_contents" > "wally.toml" | ||
# read json file | ||
default_json_contents=$(<default.project.json) | ||
target_json_name_line=$(echo "$default_json_contents" | grep -F "\"name\": ") | ||
goal_json_name_line=" \"name\": \"${repo_name}\"," | ||
default_json_contents="${default_json_contents/${target_json_name_line}/${goal_json_name_line}}" | ||
# update file | ||
echo "$default_json_contents" > "default.project.json" | ||
- name: Build place file | ||
run: | | ||
rojo build dev.project.json -o Package.rbxl | ||
- name: Upload Package.rbxl file to release | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.get_published_release.outputs.upload_url }} | ||
asset_path: Package.rbxl | ||
asset_name: Package.rbxl | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Publish release to Wally | ||
shell: bash | ||
run: | | ||
wally login --token "${{secrets.WALLY_TOKEN}}" | ||
wally publish |
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 @@ | ||
|
||
|
||
# Directories | ||
out/** | ||
Packages/** | ||
types | ||
lints | ||
tests/lsp/** | ||
tests/selene/** | ||
|
||
# Files | ||
sourcemap.json | ||
wally.lock | ||
package-lock.json | ||
keys.txt | ||
|
||
# File types | ||
*.lock | ||
*.gitconfig | ||
*.rbxlx | ||
*.lock | ||
|
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,11 @@ | ||
{ | ||
"recommendations": [ | ||
"emeraldwalk.runonsave", | ||
"formulahendry.code-runner", | ||
"tamasfe.even-better-toml", | ||
"johnnymorganz.luau-lsp", | ||
"johnnymorganz.stylua", | ||
"redhat.vscode-yaml", | ||
"ms-toolsai.jupyter" | ||
] | ||
} |
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,80 @@ | ||
{ | ||
"import scripts": { | ||
"prefix": "import scripts", | ||
"body": [ | ||
"local $name = require(game:GetService(\"ServerStorage\"):WaitForChild(\"Scripts\"):WaitForChild(\"$name\")$0)" | ||
], | ||
"description": "Imports a scripts module.", | ||
"scope": "lua,luau" | ||
}, | ||
"import sub-scripts": { | ||
"prefix": "import sub-scripts", | ||
"body": [ | ||
"local $name${sub} = require(game:GetService(\"ServerStorage\"):WaitForChild(\"Scripts\"):WaitForChild(\"$name\"):WaitForChild(\"$sub\")$0)" | ||
], | ||
"description": "Imports a scripts sub-module.", | ||
"scope": "lua,luau" | ||
}, | ||
"import server": { | ||
"prefix": "import server", | ||
"body": [ | ||
"local $name = require(game:GetService(\"ServerScriptService\"):WaitForChild(\"Server\"):WaitForChild(\"$name\")$0)" | ||
], | ||
"description": "Imports a server module.", | ||
"scope": "lua,luau" | ||
}, | ||
"import child": { | ||
"prefix": "import child", | ||
"body": [ | ||
"local $name = require(script:WaitForChild(\"$name\")$0)" | ||
], | ||
"description": "Imports a child module.", | ||
"scope": "lua,luau" | ||
}, | ||
"import etype": { | ||
"prefix": "import etype", | ||
"body": [ | ||
"export type $name = $name.$name" | ||
], | ||
"description": "Unpacks and exports a type.", | ||
"scope": "lua,luau" | ||
}, | ||
"import ptype": { | ||
"prefix": "import ptype", | ||
"body": [ | ||
"type $name = $name.$name" | ||
], | ||
"description": "Unpacks and a type.", | ||
"scope": "lua,luau" | ||
}, | ||
"import packages": { | ||
"prefix": "import package", | ||
"body": [ | ||
"local $name = require(_Packages:WaitForChild(\"$name\"))" | ||
], | ||
"description": "Imports a package module.", | ||
"scope": "lua,luau" | ||
}, | ||
"import header": { | ||
"prefix": "import header", | ||
"body": [ | ||
"--!strict", | ||
"--!native", | ||
"local _Package = script", | ||
"local _Packages = _Package.Parent", | ||
"-- Services", | ||
"-- stylua: ignore start", | ||
"-- Packages", | ||
"-- Modules", | ||
"-- stylua: ignore end", | ||
"-- Types", | ||
"-- Constants", | ||
"-- Variables", | ||
"-- References", | ||
"-- Private Functions", | ||
"-- Class", | ||
], | ||
"description": "A basic header for a file.", | ||
"scope": "lua,luau" | ||
}, | ||
} |
Oops, something went wrong.