-
Notifications
You must be signed in to change notification settings - Fork 49
76 lines (65 loc) · 2.5 KB
/
run-tests-build.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
name: Build Next.js examples
on:
workflow_dispatch:
pull_request:
types: [opened, reopened, synchronize]
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
fail-fast: true
matrix:
example:
[
asset-list,
authz,
vote-proposal,
ibc-transfer,
swap-tokens,
provide-liquidity,
nft,
connect-chain,
connect-multi-chain,
website,
]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set template_path Environment Variable
run: |
# Store first
example_json="${{ toJson(matrix.example) }}"
if echo "$example_json" | jq -e '.[] | select(. == "connect-chain" or . == "connect-multi-chain" or . == "website")'; then
echo "template_path=templates" >> $GITHUB_ENV
echo "ci_template_path=ci-templates" >> $GITHUB_ENV
elif [ "$example_json" != "[]" ]; then
echo "template_path=examples" >> $GITHUB_ENV
echo "ci_template_path=ci-examples" >> $GITHUB_ENV
else
echo "template_path=" >> $GITHUB_ENV # setting it empty if both are empty arrays
echo "ci_template_path=" >> $GITHUB_ENV # setting it empty if both are empty arrays
fi
- name: Log
run: |
echo "Using template_path: $template_path"
echo "Using ci_template_path: $ci_template_path"
- name: Clone example
run: |
echo "Cloning example: ./$template_path/${{ matrix.example }}/" into "${{ github.workspace }}/$ci_template_path/${{ matrix.example }}"
mkdir -p ${{ github.workspace }}/$ci_template_path/${{ matrix.example }}
cp -r ./$template_path/${{ matrix.example }}/ ${{ github.workspace }}/$ci_template_path/${{ matrix.example }}
cd ${{ github.workspace }}/$ci_template_path/${{ matrix.example }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Set up Yarn
uses: threeal/[email protected]
- name: Build example project
run: |
echo "Building example: ${{ matrix.example }} in directory ${{ github.workspace }}/$ci_template_path/${{ matrix.example }}/${{ matrix.example }}"
cd ${{ github.workspace }}/$ci_template_path/${{ matrix.example }}/${{ matrix.example }}
ls -la
yarn install
yarn build