Skip to content

Commit

Permalink
Merge branch 'main' into Improve-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
gaymeowing authored Aug 13, 2024
2 parents e5e3520 + 4439ea0 commit e2410cf
Show file tree
Hide file tree
Showing 80 changed files with 2,380 additions and 664 deletions.
80 changes: 10 additions & 70 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ on:
type: string
push:
paths:
- "libs/**.luau"
- "scripts/diff_to_tbl.luau"
- "scripts/test_runner.luau"
- "scripts/depgraph.luau"
- "testkit.luau"
pull_request:
paths:
- "libs/**.luau"
- "scripts/diff_to_tbl.luau"
- "scripts/test_runner.luau"
- "scripts/depgraph.luau"
- "testkit.luau"

jobs:
Expand All @@ -30,12 +34,6 @@ jobs:

- name: macOS
runner-os: macos-14

concurrency:
group: CI-${{ matrix.runner-os }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
runs-on: ${{ matrix.runner-os }}
name: ${{ matrix.name }}

steps:
- uses: CompeyDev/[email protected]
Expand All @@ -44,68 +42,10 @@ jobs:
- name: Install Toolchain
run: rokit install --no-trust-check

- name: Parse skips
id: parse
if: inputs.skip
shell: bash
run: |
skip_json="{}"
# Remove all whitespace and then split
IFS=',' read -ra SKIP_ITEMS <<< "$(echo "${{ inputs.skip }}" | tr -d '[:space:]')"
for item in "${SKIP_ITEMS[@]}"; do
if [[ $item =~ ^([A-Za-z0-9_]+)\(([A-Za-z0-9_,]+)\)$ ]]; then
lib="${BASH_REMATCH[1]}"
IFS=',' read -ra cases <<< "${BASH_REMATCH[2]}"
for case in "${cases[@]}"; do
if [[ ! $case =~ ^[A-Za-z0-9_]+$ ]]; then
echo "SYNTAX ERROR INVALID CASE NAME '$case' IN LIB '$item'"
exit 1
else
skip_json=$(echo $skip_json | jq --arg lib "$lib" --arg case "$case" '. + {($lib): (.[($lib)] + [$case] | unique)}')
fi
done
elif [[ $item =~ ^([A-Za-z0-9_]+)\.([A-Za-z0-9_]+)$ ]]; then
lib="${BASH_REMATCH[1]}"
case="${BASH_REMATCH[2]}"
skip_json=$(echo $skip_json | jq --arg lib "$lib" --arg case "$case" '. + {($lib): (.[($lib)] + [$case] | unique)}')
else
echo "SYNTAX ERROR INVALID FORMAT GIVEN FOR '$item'"
exit 1
fi
done
echo "skip_json=$(echo $skip_json | jq -c .)" >> $GITHUB_OUTPUT
- name: Append skips
if: inputs.skip && steps.parse.outcome.success
shell: bash
env:
SKIP_JSON: ${{ steps.parse.outputs.skip_json }}
run: |
find libs -name "*test.luau" | while read -r file; do
echo "Running test: $file"
# Extract lib name from filename
lib_name=$(basename "$file" | sed 's/\.test\.luau$//')
skip_cases=$(echo $SKIP_JSON | jq -r --arg lib "$lib_name" '.[$lib] // [] | .[]')
while IFS= read -r case; do
if [[ -n $case ]]; then
echo "SKIP(\"$case\")" >> "$file"
fi
done <<< "$skip_cases"
done
- name: Run Tests
- name: Fetch diff
id: fetch_diff
shell: bash
run: |
find libs -name "*test.luau" | while read -r file; do
# append the finish call to the end of the file, because im lazy!!
echo "\n\nassert(FINISH())" >> "$file"
lune run $file
done
- name: Run test runner
run: lune run scripts/test_runner
16 changes: 13 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,30 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: CompeyDev/[email protected]
- uses: actions/configure-pages@v2

- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Sort libraries
shell: bash
run: lune run scripts/sort_libraries

- uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
- run: npm ci

- name: Build
run: npm run docs:build
- uses: actions/configure-pages@v2
shell: bash
run: npm ci && npm run docs:build

- uses: actions/upload-pages-artifact@v1
with:
path: docs/.vitepress/dist

- name: Deploy
id: deployment
uses: actions/deploy-pages@v1
10 changes: 2 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ jobs:
- name: Create draft
id: create_draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view ${{ env.version }}; then
gh release edit ${{ env.version }} --draft
Expand All @@ -67,19 +65,15 @@ jobs:
env:
release_id: ${{needs.make_draft.outputs.release_id}}
version: ${{needs.make_draft.outputs.version}}
GH_TOKEN: ${{ github.token }}
steps:
- uses: CompeyDev/[email protected]
- uses: actions/checkout@v3

- name: Install Toolchain
run: rokit install --no-trust-check

- name: Run script
run: lune run release
run: lune run scripts/release

- name: Upload libraries
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd output
for dir in */; do
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/release_libs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release Libraries

on:
workflow_dispatch:
inputs:
libs:
description: 'List of libraries to force new releases for'
required: true
type: string
push:
branches: [ main ]
paths:
- "libs/**.luau"

jobs:
Main:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}

steps:
- uses: CompeyDev/[email protected]
- uses: actions/checkout@v3

- name: Install Toolchain
run: rokit install --no-trust-check

- name: Fetch diff
id: fetch_diff
shell: bash
run: |
echo "diff=$(gh api repos/${{ github.repository }}/commits/${{ github.sha }} --header 'Accept: application/vnd.github.v3.diff')" >> .diff
- name: Run test runner
run: lune run scripts/test_runner ${{ inputs.libs }}

- name: Run releases script
run: lune run scripts/make_lib_releases implprop ${{ inputs.libs }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ docs/.vitepress/dist
docs/.vitepress/cache
sourcemap.json
output
darklua-output
darklua-output
docs/.vitepress/sidebar-libs.json
5 changes: 1 addition & 4 deletions .luaurc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@
"LocalUnused": false,
"LocalShadow": false
},
"aliases": {
"libs": "./libs",
"testkit": "./testkit"
}
"globals": ["_RUNTIME"]
}
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"recommendations": [
"github.vscode-github-actions",
"JohnnyMorganz.luau-lsp"
],
}
72 changes: 37 additions & 35 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
{
"luau-lsp.completion.autocompleteEnd": true,
"luau-lsp.require.mode": "relativeToFile",
"luau-lsp.require.directoryAliases": {
"@lune/": "~/.lune/.typedefs/0.8.3/",
"libs/": "libs",
},
"luau-lsp.completion.imports.requireStyle": "alwaysRelative",
"luau-lsp.completion.imports.separateGroupsWithLine": false,
"explorer.autoRevealExclude": {
"**/bower_components": false,
"**/darklua_output": true,
"sourcemap.json": true
},
"explorer.excludeGitIgnore": false,
"explorer.fileNesting.enabled": false,
"explorer.sortOrderLexicographicOptions": "upper",
"search.exclude": {
"**/darklua_output": true,
"**/output": true
},
"editor.formatOnPaste": false,
"luau-lsp.completion.imports.enabled": false,
"luau-lsp.diagnostics.strictDatamodelTypes": true,
"luau-lsp.require.fileAliases": {
"testkit": "testkit"
},
"luau-lsp.completion.imports.ignoreGlobs": [
"**/_Index/**",
"**/output/**",
"**/darklua_output/**"
],
"luau-lsp.fflags.override": {
"DebugLuauDeferredConstraintResolution": "true"
},
"luau-lsp.bytecode.vectorType": "vector",
// luau-lsp
"luau-lsp.completion.imports.requireStyle": "alwaysRelative",
"luau-lsp.completion.autocompleteEnd": true,
"luau-lsp.require.mode": "relativeToFile",
"luau-lsp.bytecode.vectorType": "vector",
"luau-lsp.completion.imports.ignoreGlobs": [
"**/node_modules/**/**/**",
"**/darklua_output/**",
"**/output/**",
],
"luau-lsp.ignoreGlobs": [
"**/node_modules/**",
"*.lua"
],
"luau-lsp.require.directoryAliases": {
"@lune/": "~/.lune/.typedefs/0.8.6/"
},

// vscode
"explorer.sortOrderLexicographicOptions": "upper",
"explorer.sortOrder": "foldersNestsFiles",
"search.exclude": {
"**/darklua_output/**": true,
"**/node_modules/**": true,
"**/output/**": true
},
/**
this is set to sync, because it makes my life easier
as i dont have to do more w getting a diff for test running
and auto generating releases, blah blah blah

ok just don't change this,
because it'll make u end up having to do extra work
and thats lame, esp when it'll otherwise be done automatically
**/
"git.postCommitCommand": "sync",
"git.rememberPostCommitCommand": true,
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A collection of libraries for luau and roblox
## Notable libraries:
- [text chat](<https://libs.luau.lol/text-chat>) - utility library for working with TextChatService and its annoying quirks in behavior
- [retryer](<https://libs.luau.lol/retryer>) - a nice easy to use library for retrying functions
- [pages](<https://libs.luau.lol/pages>) - roblox pages utility, with an easy to use iterator function for pages instances
- [pages util](<https://libs.luau.lol/pages-util>) - roblox pages utility, with an easy to use iterator function for pages instances
- [safe teleport](<https://libs.luau.lol/safe-teleport>) - a typed version of roblox's safe teleport function from the TeleportService docs
- [grouper](<https://libs.luau.lol/grouper>) - a module for getting accurate group ranks for players on the server, and detecting rank changes
- [character](<https://libs.luau.lol/character>) - a simple utility module for getting more accurate character types with character added and character removing
35 changes: 15 additions & 20 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from 'vitepress'
import fs from 'fs'

// https://vitepress.dev/reference/site-config
export default defineConfig({
Expand All @@ -19,12 +20,21 @@ export default defineConfig({
}
},
themeConfig: {
lastUpdated: {
text: 'Last edit',
formatOptions: {
dateStyle: 'short',
timeStyle: 'short',
forceLocale: true,
}
},

logo: "/rbxlibs_logo_small.svg",
editLink: {
pattern: 'https://github.com/kalrnlo/rbxlibs/edit/main/docs/:path'
},
search: {
provider: 'local'
provider: 'local',
},

// https://vitepress.dev/reference/default-theme-config
Expand All @@ -45,26 +55,11 @@ export default defineConfig({
},
{
text: 'Libraries',
items: [
{ text: 'Character', link: '/character' },
{ text: 'Grouper', link: '/grouper' },
{ text: 'Is Empty', link: '/is-empty' },
{ text: 'Leventine', link: '/leventine' },
{ text: 'Linked List', link: '/linked-list' },
{ text: 'Log Analytics', link: '/log-analytics' },
{ text: 'Observer', link: '/observer' },
{ text: 'Pages Util', link: '/pages-util' },
{ text: 'Player Zone', link: '/player-zone' },
{ text: 'Race', link: '/race' },
{ text: 'Random', link: '/random' },
{ text: 'Ratelimit', link: '/ratelimit' },
{ text: 'RbxThumb', link: '/rbx-thumb' },
{ text: 'Retryer', link: '/retryer' },
{ text: 'Safe Teleport', link: '/safe-teleport' },
{ text: 'Text Chat', link: '/text-chat' },
{ text: 'Url', link: '/url' },
]
items: JSON.parse(fs.readFileSync("docs/.vitepress/sidebar-libs.json", {
encoding: 'utf8'
}))
}
],
}
})

Loading

0 comments on commit e2410cf

Please sign in to comment.