Skip to content

Commit

Permalink
chore(workflows): move busted to individual configs on ant and contract
Browse files Browse the repository at this point in the history
  • Loading branch information
Atticus committed Jun 7, 2024
1 parent 5b0f05e commit 773897b
Show file tree
Hide file tree
Showing 18 changed files with 114 additions and 74 deletions.
23 changes: 0 additions & 23 deletions .busted

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
run: luarocks install ar-io-ao-0.1-1.rockspec

- name: Run Busted Tests
run: busted .
run: cd ant && busted .

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/registry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Test / Deploy

on: [push, workflow_dispatch]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
name: Check out repository code

- name: Setup Lua
uses: leafo/gh-actions-lua@v10
with:
luaVersion: '5.3' # Specify the Lua version you need

- name: Setup LuaRocks

uses: leafo/gh-actions-luarocks@v4.3.0

- name: Install Busted
run: luarocks install ar-io-ao-0.1-1.rockspec

- name: Run Busted Tests
run: cd contract && busted .

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}

deploy:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/develop'

steps:
- uses: actions/checkout@v4
name: Check out repository code

- name: Setup Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: '20'

- name: Install aos
run: npm i -g https://get_ao.g8way.io

- name: Setup wallet
run: echo '${{ secrets.WALLET }}' > wallet.json

# TODO: should we deploy this way or use ao cli to deploy the module?
# - name: Deploy to AOS
# run: aos --load contract/src/main.lua --wallet wallet.json devnet
14 changes: 14 additions & 0 deletions ant/.busted
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
print("Loading .busted configuration...")
return {
_all = {
verbose = true,
coverage = true,
output = "utfTerminal",
jobs = 4,
},
default = {
ROOT = {"ant"},
pattern = "**/*_spec.lua$",
helper = "spec/setup.lua",
}
}
8 changes: 4 additions & 4 deletions ant/spec/ant_spec.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local balances = require("ant.src.balances")
local controllers = require("ant.src.controllers")
local initialize = require("ant.src.initialize")
local records = require("ant.src.records")
local balances = require("src.balances")
local controllers = require("src.controllers")
local initialize = require("src.initialize")
local records = require("src.records")

local fake_address = "1111111111111111111111111111111111111111111"

Expand Down
4 changes: 2 additions & 2 deletions ant/src/balances.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local utils = require("ant.src.utils")
local json = require("ant.src.json")
local utils = require(".utils")
local json = require(".json")

Balances = Balances or {}

Expand Down
4 changes: 2 additions & 2 deletions ant/src/controllers.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local json = require("ant.src.json")
local utils = require("ant.src.utils")
local json = require(".json")
local utils = require(".utils")

Controllers = Controllers or {}

Expand Down
12 changes: 6 additions & 6 deletions ant/src/process.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
-- Adjust package.path to include the current directory
local json = require("ant.src.json")
local balances = require("ant.src.balances")
local utils = require("ant.src.utils")
local initialize = require("ant.src.initialize")
local records = require("ant.src.records")
local controllers = require("ant.src.controllers")
local json = require(".json")
local balances = require(".balances")
local utils = require(".utils")
local initialize = require(".initialize")
local records = require(".records")
local controllers = require(".controllers")

Name = Name or "Arweave Name Token"
Ticker = Ticker or "ANT"
Expand Down
4 changes: 2 additions & 2 deletions ant/src/records.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local utils = require("ant.src.utils")
local json = require("ant.src.json")
local utils = require(".utils")
local json = require(".json")
local records = {}

Records = Records or {}
Expand Down
2 changes: 1 addition & 1 deletion ant/src/utils.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local constants = require("ant.src.constants")
local constants = require(".constants")
local utils = {}

function utils.hasMatchingTag(tag, value)
Expand Down
20 changes: 0 additions & 20 deletions busted_setup.lua

This file was deleted.

14 changes: 14 additions & 0 deletions contract/.busted
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
print("Loading .busted configuration...")
return {
_all = {
verbose = true,
coverage = true,
output = "utfTerminal",
jobs = 4,
},
default = {
ROOT = {"contract"},
pattern = "**/*_spec.lua$",
helper = "spec/setup.lua",
}
}
8 changes: 4 additions & 4 deletions contract/spec/arns_spec.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
local testProcessId = "NdZ3YRwMB2AMwwFYjKn1g88Y9nRybTo0qhS1ORq_E7g"
local constants = require("contract.src.constants")
local arns = require("contract.src.arns")
local balances = require("contract.src.balances")
local demand = require("contract.src.demand")
local constants = require("src.constants")
local arns = require("src.arns")
local balances = require("src.balances")
local demand = require("src.demand")

describe("arns", function()
local timestamp = 0
Expand Down
2 changes: 1 addition & 1 deletion contract/spec/balances_spec.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local balances = require("contract.src.balances")
local balances = require("src.balances")

describe("balances", function()
before_each(function()
Expand Down
4 changes: 2 additions & 2 deletions contract/spec/demand_spec.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local constants = require("contract.src.constants")
local demand = require("contract.src.demand")
local constants = require("src.constants")
local demand = require("src.demand")

describe("demand", function()
before_each(function()
Expand Down
6 changes: 3 additions & 3 deletions contract/spec/epochs_spec.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local epochs = require("contract.src.epochs")
local gar = require("contract.src.gar")
local balances = require("contract.src.balances")
local epochs = require("src.epochs")
local gar = require("src.gar")
local balances = require("src.balances")

local testSettings = {
fqdn = "test.com",
Expand Down
2 changes: 1 addition & 1 deletion contract/spec/gar_spec.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local gar = require("contract.src.gar")
local gar = require("src.gar")
local testSettings = {
fqdn = "test.com",
protocol = "https",
Expand Down
4 changes: 2 additions & 2 deletions contract/spec/vaults_spec.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local vaults = require("contract.src.vaults")
local constants = require("contract.src.constants")
local vaults = require("src.vaults")
local constants = require("src.constants")
local startTimestamp = 0

describe("vaults", function()
Expand Down

0 comments on commit 773897b

Please # to comment.