-
Notifications
You must be signed in to change notification settings - Fork 26
96 lines (93 loc) · 2.77 KB
/
build.yml
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
name: Build Contracts & Schemas
on:
pull_request:
branches: [main, development]
workflow_dispatch:
inputs:
network:
description: "Network to deploy to"
required: true
type: string
kernel_address:
description: "Kernel address"
required: false
type: string
deploy_os:
description: "Deploy OS"
required: false
type: boolean
contracts:
description: "Contracts to deploy"
required: false
type: string
jobs:
build:
runs-on: ubuntu-latest
name: Contracts
if: >
!contains(github.event.pull_request.labels.*.name, 'ci: skip-build')
steps:
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: 1.75.0
- run: rustup override set 1.75.0
- run: rustup target add wasm32-unknown-unknown
- uses: actions/checkout@v4
- name: Build
run: |
chmod +x "${GITHUB_WORKSPACE}/scripts/build_all.sh"
make build
sudo make version-map
- name: Check contract sizes
run: |
chmod +x "${GITHUB_WORKSPACE}/.github/file-size.sh"
"${GITHUB_WORKSPACE}/.github/file-size.sh"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: contracts
path: ./artifacts/
if-no-files-found: error
build-schemas:
runs-on: ubuntu-latest
name: Schemas
if: >
!contains(github.event.pull_request.labels.*.name, 'ci: skip-build')
steps:
- uses: actions/checkout@v4
- name: Build Schema
run: |
chmod +x "${GITHUB_WORKSPACE}/scripts/build_schema.sh"
make schemas
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: schema
path: ./schemas/
if-no-files-found: error
trigger-deploy:
needs: [build, build-schemas]
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Trigger Deploy Workflow
uses: actions/github-script@v7
with:
github-token: ${{ secrets.CI_PAT }}
script: |
try {
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'deploy.yml',
ref: github.ref,
inputs: {
network: '${{ inputs.network }}',
kernel_address: '${{ inputs.kernel_address }}',
deploy_os: '${{ inputs.deploy_os }}',
contracts: '${{ inputs.contracts }}'
}
});
} catch (error) {
core.setFailed(`Failed to trigger deploy workflow: ${error.message}`);
}