Skip to content

Commit

Permalink
CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleitnick committed Nov 1, 2021
1 parent 8ac01dc commit bb3729c
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 2 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- uses: Roblox/setup-foreman@v1
name: Install Foreman
with:
version: "^1.0.0"
token: ${{ SECRETS.GITHUB_TOKEN }}

- name: Lint
run: |
selene ./modules
unit-tests:
name: Unit Tests
runs-on: windows-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
architecture: 'x64'

- name: Install Roblox Studio
uses: OrbitalOwen/[email protected]
with:
cookie: ${{ secrets.ROBLOSECURITY }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Foreman
uses: rojo-rbx/setup-foreman@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Build tests
run: python build_tests.py

- name: Build test place
run: rojo build default.project.json -o test.rbxl

- name: Run tests
shell: bash
run: run-in-roblox --place test.rbxl --script test/RunTests.server.lua > test-out.txt
continue-on-error: true

- name: Check test status
shell: bash
run: cat test-out.txt | grep "0 failed, 0 skipped" || (cat test-out.txt && exit 1)
3 changes: 3 additions & 0 deletions foreman.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[tools]
wally = { source = "UpliftGames/wally", version = "0.2.1" }
selene = { source = "Kampfkarren/selene", version = "x" }
rojo = { source = "rojo-rbx/rojo", version = "6.2.0" }
run-in-roblox = { source = "rojo-rbx/run-in-roblox", version = "0.3.0" }
5 changes: 3 additions & 2 deletions test/RunTests.server.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
print("Running unit tests...")
local TestService = game:GetService("TestService")
local tests = {}
for _,testFolder in ipairs(script.Parent.modules:GetChildren()) do
for _,testFolder in ipairs(TestService.modules:GetChildren()) do
local name = testFolder.Name:match("(.+)_test$")
local module = testFolder[name]
table.insert(tests, module)
end
require(script.Parent.Packages.TestEZ).TestBootstrap:run(tests)
require(TestService.Packages.TestEZ).TestBootstrap:run(tests)

0 comments on commit bb3729c

Please sign in to comment.