Skip to content

Commit f39269a

Browse files
authored
Initial commit
0 parents  commit f39269a

21 files changed

+680
-0
lines changed

.github/workflows/commit.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Validate Commit
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
8+
validate:
9+
runs-on: windows-latest
10+
11+
strategy:
12+
matrix:
13+
scene: [main]
14+
include:
15+
- name: main
16+
steps:
17+
# Checkout your Git repo
18+
- uses: actions/checkout@v2
19+
20+
# Install foreman and all foreman tools
21+
- uses: Roblox/setup-foreman@v1
22+
with:
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
# Install wally packages
25+
- name: update wally packages
26+
run: wally-update patch
27+
28+
- name: install wally packages
29+
run: wally install
30+
31+
- name: generate sourcemap
32+
run: rojo sourcemap dev.project.json --output sourcemap.json
33+
34+
- name: export wally package types
35+
run: wally-package-types --sourcemap sourcemap.json Packages
36+
37+
- name: Install testing files
38+
shell: bash
39+
run: |
40+
# type definitions
41+
if [ ! -d "types" ]; then
42+
mkdir "types"
43+
fi
44+
curl -L "https://gist.github.com/nightcycle/50ca8f42147077b8f584b503030c8500/raw" > "types/testEZ.d.lua"
45+
curl -L "https://gist.github.com/nightcycle/ae7ea3376337512772d1d2b314ef467b/raw" > "types/remodel.d.lua"
46+
curl -L "https://raw.githubusercontent.com/JohnnyMorganz/luau-lsp/main/scripts/globalTypes.d.lua" > "types/globalTypes.d.lua"
47+
48+
# lint definitions
49+
if [ ! -d "lints" ]; then
50+
mkdir "lints"
51+
fi
52+
curl -L "https://gist.github.com/nightcycle/a57e04de443dfa89bd08c8eb001b03c6/raw" > "lints/lua51.yml"
53+
curl -L "https://gist.github.com/nightcycle/93c4b9af5bbf4ed09f39aa908dffccd0/raw" > "lints/luau.yml"
54+
55+
# apply code styling
56+
- name: style src scripts
57+
run: stylua src
58+
59+
- name: generate sourcemap
60+
run: rojo sourcemap dev.project.json --output sourcemap.json
61+
62+
# Test validity
63+
- name: typecheck src files
64+
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 --flag:LuauParseDeclareClassIndexer=true src
65+
66+
- name: lint src files
67+
run: selene src

.github/workflows/release.yml

+169
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
name: Build and Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
get_published_release:
9+
runs-on: ubuntu-latest
10+
11+
outputs:
12+
release_id: ${{ steps.release_info.outputs.release_id }}
13+
upload_url: ${{ steps.release_info.outputs.upload_url }}
14+
tag_name: ${{ steps.release_info.outputs.tag_name }}
15+
repo_desc: ${{ steps.release_info.outputs.repo_desc }}
16+
repo_name: ${{ steps.release_info.outputs.repo_name }}
17+
repo_owner_name: ${{ steps.release_info.outputs.repo_owner_name }}
18+
steps:
19+
- name: Set Release Info
20+
id: release_info
21+
run: |
22+
echo "::set-output name=tag_name::${{ github.event.release.tag_name }}"
23+
echo "::set-output name=release_id::${{ github.event.release.id }}"
24+
echo "::set-output name=upload_url::${{ github.event.release.upload_url }}"
25+
26+
repo_owner_name=${{ github.repository_owner }}
27+
echo "::set-output name=repo_owner_name::$repo_owner_name"
28+
29+
repo_name=${{ github.repository }}
30+
forward_repo_pattern="${repo_owner_name}/"
31+
empty_str=""
32+
repo_name="${repo_name/${forward_repo_pattern}/${empty_str}}"
33+
echo "::set-output name=repo_name::$repo_name"
34+
35+
# Use the GitHub API to fetch the repository description
36+
description_prefix="\"description\":"
37+
curl -L "https://api.github.com/repos/${repo_owner_name}/${repo_name}" > "desc.text"
38+
desc=$(<desc.text)
39+
desc=$(echo "$desc" | grep -F "$description_prefix")
40+
desc="${desc/${description_prefix}/${empty_str}}"
41+
repo_desc=$(echo "$desc" | grep -o '"[^"]*"')
42+
echo "::set-output name=repo_desc::$repo_desc"
43+
44+
build_and_publish_to_wally:
45+
needs: get_published_release
46+
runs-on: windows-latest
47+
48+
steps:
49+
# Checkout your Git repo
50+
- uses: actions/checkout@v2
51+
52+
# Install foreman and all foreman tools
53+
- uses: Roblox/setup-foreman@v1
54+
with:
55+
token: ${{ secrets.GITHUB_TOKEN }}
56+
57+
# Install wally packages
58+
- name: update wally packages
59+
run: wally-update patch
60+
61+
- name: install wally packages
62+
run: wally install
63+
64+
- name: generate sourcemap
65+
run: rojo sourcemap dev.project.json --output sourcemap.json
66+
67+
- name: export wally package types
68+
run: wally-package-types --sourcemap sourcemap.json Packages
69+
70+
- name: Install testing files
71+
shell: bash
72+
run: |
73+
# type definitions
74+
if [ ! -d "types" ]; then
75+
mkdir "types"
76+
fi
77+
curl -L "https://gist.github.com/nightcycle/50ca8f42147077b8f584b503030c8500/raw" > "types/testEZ.d.lua"
78+
curl -L "https://gist.github.com/nightcycle/ae7ea3376337512772d1d2b314ef467b/raw" > "types/remodel.d.lua"
79+
curl -L "https://raw.githubusercontent.com/JohnnyMorganz/luau-lsp/main/scripts/globalTypes.d.lua" > "types/globalTypes.d.lua"
80+
81+
# lint definitions
82+
if [ ! -d "lints" ]; then
83+
mkdir "lints"
84+
fi
85+
curl -L "https://gist.github.com/nightcycle/a57e04de443dfa89bd08c8eb001b03c6/raw" > "lints/lua51.yml"
86+
curl -L "https://gist.github.com/nightcycle/93c4b9af5bbf4ed09f39aa908dffccd0/raw" > "lints/luau.yml"
87+
88+
# apply code styling
89+
- name: style src scripts
90+
run: stylua src
91+
92+
- name: style built scripts
93+
shell: bash
94+
run: |
95+
if [ ! -d "out" ]; then
96+
mkdir "out"
97+
fi
98+
stylua out
99+
100+
- name: generate sourcemap
101+
run: rojo sourcemap dev.project.json --output sourcemap.json
102+
103+
# Test validity
104+
- name: typecheck src files
105+
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 --flag:LuauParseDeclareClassIndexer=true src
106+
107+
- name: lint src files
108+
run: selene src
109+
110+
- name: Update version and labels
111+
shell: bash
112+
run: |
113+
repo_owner="${{needs.get_published_release.outputs.repo_owner_name}}"
114+
repo_name="${{needs.get_published_release.outputs.repo_name}}"
115+
repo_desc=${{needs.get_published_release.outputs.repo_desc}}
116+
goal_version_str="${{needs.get_published_release.outputs.tag_name}}"
117+
118+
# remove letters
119+
goal_version_str=$(echo "$goal_version_str" | sed 's/[a-zA-Z]//g')
120+
121+
# read file
122+
wally_toml_contents=$(<wally.toml)
123+
124+
# swap out version
125+
goal_version_line="version = \"${goal_version_str}\""
126+
target_version_line=$(echo "$wally_toml_contents" | grep -F "version = ")
127+
wally_toml_contents="${wally_toml_contents/${target_version_line}/${goal_version_line}}"
128+
129+
# swap out name
130+
goal_name_line="name = \"${repo_owner}/${repo_name}\""
131+
target_name_line=$(echo "$wally_toml_contents" | grep -F "name = ")
132+
wally_toml_contents="${wally_toml_contents/${target_name_line}/${goal_name_line}}"
133+
134+
# swap out description
135+
goal_desc_line="description = \"${repo_desc}\""
136+
target_desc_line=$(echo "$wally_toml_contents" | grep -F "description = ")
137+
wally_toml_contents="${wally_toml_contents/${target_desc_line}/${goal_desc_line}}"
138+
139+
# update file
140+
echo "$wally_toml_contents" > "wally.toml"
141+
142+
# read json file
143+
default_json_contents=$(<default.project.json)
144+
target_json_name_line=$(echo "$default_json_contents" | grep -F "\"name\": ")
145+
goal_json_name_line=" \"name\": \"${repo_name}\","
146+
default_json_contents="${default_json_contents/${target_json_name_line}/${goal_json_name_line}}"
147+
148+
# update file
149+
echo "$default_json_contents" > "default.project.json"
150+
151+
- name: Build place file
152+
run: |
153+
rojo build dev.project.json -o Package.rbxl
154+
155+
- name: Upload Package.rbxl file to release
156+
uses: actions/upload-release-asset@v1
157+
env:
158+
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
159+
with:
160+
upload_url: ${{ needs.get_published_release.outputs.upload_url }}
161+
asset_path: Package.rbxl
162+
asset_name: Package.rbxl
163+
asset_content_type: application/octet-stream
164+
165+
- name: Publish release to Wally
166+
shell: bash
167+
run: |
168+
wally login --token "${{secrets.WALLY_TOKEN}}"
169+
wally publish

.gitignore

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
3+
# Directories
4+
out/**
5+
Packages/**
6+
types
7+
lints
8+
tests/lsp/**
9+
tests/selene/**
10+
11+
# Files
12+
sourcemap.json
13+
wally.lock
14+
package-lock.json
15+
keys.txt
16+
17+
# File types
18+
*.lock
19+
*.gitconfig
20+
*.rbxlx
21+
*.lock
22+

0 commit comments

Comments
 (0)