Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
magic-akari committed Feb 29, 2024
0 parents commit c542112
Show file tree
Hide file tree
Showing 302 changed files with 12,355 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Check http://editorconfig.org for more information
# This is the main config file for this project:
root = true

[*]
charset = utf-8
indent_size = 4
end_of_line = lf

[*.{js,ts,mjs}]
indent_style = tab
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Auto detect text files and perform LF normalization
* text=auto
*.ts linguist-detectable=false
*.mjs linguist-detectable=false
test_data/** linguist-detectable=false
102 changes: 102 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Publish

on:
push:
tags:
- "v*"

env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: "always"
RUST_LOG: "off"

jobs:
wasm-build:
name: Wasm build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Build wasm
run: ./crates/lua_fmt/scripts/build.sh

- name: Upload
uses: actions/upload-artifact@v4
with:
name: build
path: crates/lua_fmt/pkg

publish-npm:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: wasm-build
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build
path: crates/lua_fmt/pkg/

- uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
registry-url: "https://registry.npmjs.org"

- name: Publish
working-directory: crates/lua_fmt/pkg
run: npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

publish-github:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: wasm-build
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build
path: crates/lua_fmt/pkg/

- uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
registry-url: "https://npm.pkg.github.com"

- name: Publish
working-directory: crates/lua_fmt/pkg
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-github-release:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: wasm-build
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build
path: crates/lua_fmt/pkg/

- name: Package
working-directory: crates/lua_fmt/pkg
run: npm pack

- name: Release
uses: softprops/action-gh-release@975c1b265e11dd76618af1c374e7981f9a6ff44a
with:
files: |
crates/*/pkg/*.tgz
crates/*/pkg/*.wasm
105 changes: 105 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Test

on:
push:
branches:
- "*"
pull_request:
types: ["opened", "reopened", "synchronize"]

env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: "always"
DIFF: 0
RUST_LOG: "off"

jobs:
cargo-fmt:
name: Cargo fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo fmt -- --check

cargo-clippy:
name: Cargo clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo clippy

cargo-test:
name: Cargo test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo check
- run: cargo test

wasm-build:
name: Wasm build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Build wasm
run: ./crates/lua_fmt/scripts/build.sh

- run: npm pack
working-directory: crates/lua_fmt/pkg

- name: Upload
uses: actions/upload-artifact@v4
with:
name: build
path: crates/lua_fmt/pkg

node-test:
runs-on: ubuntu-latest
needs: wasm-build
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build
path: crates/lua_fmt/pkg/

- uses: actions/setup-node@v4
with:
node-version-file: ".node-version"

- run: node --test

deno-test:
runs-on: ubuntu-latest
needs: wasm-build
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build
path: crates/lua_fmt/pkg/

- uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- run: deno test --allow-read

bun-test:
runs-on: ubuntu-latest
needs: wasm-build
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build
path: crates/lua_fmt/pkg/

- uses: oven-sh/setup-bun@v1
name: Install bun

- run: bun test test_bun
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
.DS_Store
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.11.1
16 changes: 16 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# group_imports = "StdExternalCrate"
# imports_granularity = "Crate"
reorder_imports = true
use_small_heuristics = "Max"

# normalize_comments = true
# wrap_comments = true

# condense_wildcard_suffixes = true
# enum_discrim_align_threshold = 20
# reorder_impl_items = true
use_field_init_shorthand = true

# format_code_in_doc_comments = true
# format_macro_matchers = true
# format_strings = true
5 changes: 5 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://taplo.tamasfe.dev/configuration/formatter-options.html
[formatting]
align_entries = true
indent_tables = true
reorder_keys = true
Loading

0 comments on commit c542112

Please sign in to comment.