-
Notifications
You must be signed in to change notification settings - Fork 29
176 lines (168 loc) · 5.25 KB
/
ci.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: CI
on:
pull_request:
schedule:
- cron: "0 0 * * 0"
env:
WORK_DIR: packages/starknet
jobs:
dump-context:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- name: Show default environment variables
run: |
echo "The job_id is: $GITHUB_JOB" # reference the default environment variables
echo "The id of this action is: $GITHUB_ACTION" # reference the default environment variables
echo "The run id is: $GITHUB_RUN_ID"
echo "The GitHub Actor's username is: $GITHUB_ACTOR"
echo "GitHub SHA: $GITHUB_SHA"
analyze:
runs-on: ubuntu-latest
steps:
- name: Print $GITHUB_CONTEXT
shell: bash
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v2
- uses: dart-lang/[email protected]
with:
sdk: stable
- id: install
name: Install dependencies
run: dart pub get
working-directory: ${{ env.WORK_DIR }}
- name: Check formatting
run: dart format --output=none --set-exit-if-changed .
working-directory: ${{ env.WORK_DIR }}
- name: Analyze code
run: dart analyze --fatal-infos
if: always() && steps.install.outcome == 'success'
working-directory: ${{ env.WORK_DIR }}
test-unit:
needs: analyze
defaults:
run:
working-directory: ${{ env.WORK_DIR }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dart-lang/[email protected]
with:
sdk: stable
- id: install
name: Install dependencies
run: dart pub get
- name: Run tests on testnet
run: dart test -t unit
test-integration-testnet:
needs: analyze
defaults:
run:
working-directory: ${{ env.WORK_DIR }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dart-lang/[email protected]
with:
sdk: stable
- id: install
name: Install dependencies
run: dart pub get
- name: Run tests on testnet
run: dart test -t integration-testnet --exclude-tags='rpc-node-bug'
test-integration-devnet:
needs: analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
#
# devnet setup
#
- name: Setup python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached env
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != true
run: poetry install --no-interaction
- name: Start devnet
uses: JarvusInnovations/background-action@v1
id: start-devnet
with:
run: |
poetry run devnet start &
wait-on: http://localhost:5050/is_alive
tail: true
log-output-resume: stderr
wait-for: 1m
log-output: stderr,stdout
log-output-if: failure
- name: Setup devnet
run: poetry run devnet setup
#
# End of devnet setup
#
- uses: dart-lang/[email protected]
with:
sdk: stable
- id: install
name: Install dependencies
run: dart pub get
working-directory: ${{ env.WORK_DIR }}
- name: Run tests on devnet
env:
NETWORK: devnet
run: dart test -t integration-devnet-040
working-directory: ${{ env.WORK_DIR }}
publish:
if: github.event.pull_request.head.repo.fork == false
needs: test-integration-devnet
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v2
# Only publishes if package version is different from the latest published on pub.dev
# See the docs: https://github.com/marketplace/actions/dart-and-flutter-package-publisher
- name: "Publish package (dry run)"
uses: k-paxian/dart-package-publisher@master
with:
accessToken: ${{ secrets.OAUTH_ACCESS_TOKEN }}
refreshToken: ${{ secrets.OAUTH_REFRESH_TOKEN }}
skipTests: true # Tests have already been run before
dryRunOnly: true
relativePath: ${{ env.WORK_DIR }}