-
Notifications
You must be signed in to change notification settings - Fork 4
130 lines (111 loc) · 4.26 KB
/
ant.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Arweave Name Token
on: [push, workflow_dispatch]
jobs:
unit:
runs-on: ubuntu-24.04
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/[email protected]
- name: Install Busted
run: luarocks install ar-io-ao-0.1-1.rockspec
- name: Run Busted Tests
run: busted .
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
lint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: leafo/gh-actions-lua@v10
with:
luaVersion: '5.3'
- name: Setup LuaRocks
uses: leafo/[email protected]
- name: Install Luacheck
run: luarocks install luacheck
- run: luacheck src spec
# TODO: add ar-io-sdk e2e tests against lua code to be bundled on changes (e.g. create a new ant, publish it and validate it works with the sdk)
integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn --frozen-lockfile
- run: curl -L https://install_ao.g8way.io | sh && ao -V
- run: yarn copy-aos-process
- run: yarn module:build
- run: yarn test
publish:
runs-on: ubuntu-latest
environment: main
needs: [lint, unit, integration]
permissions:
contents: write # to be able to publish a GitHub release
outputs:
published_lua_code_id: ${{ steps.publish-lua-code.outputs.srcTxId }}
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn --frozen-lockfile
- run: curl -L https://install_ao.g8way.io | sh
- name: Publish Lua Code
id: publish-lua-code
env:
WALLET: ${{ secrets.WALLET }}
GITHUB_SHA: ${{ github.sha }}
DRY_RUN: ${{github.ref_name != 'main'}}
run: |
PUBLISH_OUTPUT=$(yarn aos:publish 2>&1)
# This line extracts the transaction ID of the published Lua source code from the output
# It uses grep to find the line containing "Generated source code data item with id:"
# Then it uses sed to extract the 43-character transaction ID
LUA_SOURCE_CODE_TX_ID=$(echo "$PUBLISH_OUTPUT" | grep -oE "Generated source code data item with id:\s[a-zA-Z0-9_-]{43}" | sed -E 's/.*([a-zA-Z0-9_-]{43})/\1/')
echo "::set-output name=srcTxId::$LUA_SOURCE_CODE_TX_ID"
- name: Create Tag for Lua ID
if: ${{github.ref_name == 'main'}}
run: |
git tag "${{ steps.publish-lua-code.outputs.srcTxId }}"
git push origin "${{ steps.publish-lua-code.outputs.srcTxId }}"
notify:
runs-on: ubuntu-latest
needs: [unit, integration, publish]
if: always()
steps:
- name: Notify Slack on Success
if: (github.ref_name == 'main' || github.ref_name == 'develop') && needs.unit.result == 'success' && needs.integration.result == 'success'
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
text: |
Unit Tests: ${{ needs.unit.result }}
Integration Tests: ${{ needs.integration.result }}
Published Lua Id: ${{ needs.publish.outputs.published_lua_code_id || 'N/A' }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Notify Slack on Failure
if: failure()
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
text: |
Unit Tests: ${{ needs.unit.result }}
Integration Tests: ${{ needs.integration.result }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}