Skip to content

Commit

Permalink
Merge pull request #56 from TAServers/LEST-19-local-dev-experience
Browse files Browse the repository at this point in the history
LEST-19 - Turn lest into a publishable NPM package
  • Loading branch information
Derpius authored Jul 2, 2023
2 parents a8dc4a6 + 50eec2c commit fd07812
Show file tree
Hide file tree
Showing 75 changed files with 2,137 additions and 211 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/lest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Lest CI

on:
workflow_call:
push:
branches-ignore:
- master

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run prettier
run: npm run format:lest

- uses: JohnnyMorganz/stylua-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --check ./packages/lest

test:
runs-on: ubuntu-latest
strategy:
matrix:
luaVersion: ["5.1.5", "5.2.4", "5.3.6", "5.4.4", "luajit-openresty", "luajit-2.0.5", "luajit-2.1.0-beta3"]

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18
cache: "npm"

- uses: leafo/gh-actions-lua@v10
with:
luaVersion: ${{ matrix.luaVersion }}

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm run test:lest

build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18
cache: "npm"

- uses: leafo/gh-actions-lua@v10
with:
luaVersion: "5.4.4"

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build:lest

- uses: actions/upload-artifact@v3
with:
name: lest
path: packages/lest/dist
36 changes: 0 additions & 36 deletions .github/workflows/lua.yml

This file was deleted.

41 changes: 21 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,23 @@ on:
- master

jobs:
lua:
uses: ./.github/workflows/lua.yml
lest:
uses: ./.github/workflows/lest.yml

release:
runs-on: ubuntu-latest
needs: lua
needs: lest

permissions:
id-token: write

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18
cache: "npm"

- name: Install Lua
uses: leafo/gh-actions-lua@v10
- uses: actions/download-artifact@v3
with:
luaVersion: "5.4.4"

- name: Install dependencies
run: npm ci

- name: Build release bundle
run: npm run build:lua
name: lest
path: packages/lest/dist

- name: Generate changelog
id: changelog
Expand All @@ -40,13 +32,13 @@ jobs:
output-file: "false"
skip-commit: "true"
skip-version-file: "true"
git-path: "packages/lua"
git-path: "packages/lest"

- name: Push release
uses: softprops/action-gh-release@v1
if: steps.changelog.outputs.skipped != 'true'
with:
files: packages/lua/dist/lest.lua
files: packages/lest/dist/lua/lest.lua
tag_name: ${{ steps.changelog.outputs.tag }}
name: Lest - ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
Expand All @@ -59,7 +51,16 @@ jobs:
uses: softprops/action-gh-release@v1
if: steps.changelog.outputs.skipped != 'true'
with:
files: packages/lua/dist/lest.lua
files: packages/lest/dist/lua/lest.lua
tag_name: latest
name: Lest - ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}

- name: Update package.json version
run: "sed -i 's/{{VERSION}}/${{ steps.changelog.outputs.tag }}/g' packages/lest/package.json"

- name: Publish to NPM
working-directory: packages/lest
run: npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
11 changes: 11 additions & 0 deletions .idea/runConfigurations/lest__watch_tests.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ See our [Code of Conduct](https://github.com/TAServers/lest/blob/master/CODE_OF_
## Repository structure

The Lest monorepo is split into a number of smaller *packages* which you can find in the `/packages` directory:
- `lua` - The testing framework itself
- `lest` - The testing framework itself
- `docs` - API documentation in plain JSON format
- `site` - Docusaurus site (https://taservers.github.io/lest)

Expand Down
Loading

0 comments on commit fd07812

Please sign in to comment.