Skip to content

Commit 0e3bbbd

Browse files
Merge branch 'feat/gitlab-pipelines' into 'main'
feat(ci): add GitLab CI/CD configuration See merge request flarenetwork/docs-team/developer-hub-v1!3
2 parents b88e1f7 + 5ad9556 commit 0e3bbbd

19 files changed

Lines changed: 323 additions & 23 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ yarn-error.log*
2424
.idea
2525
.lycheecache
2626
.eslintcache
27+
.pnpm-store/
2728

2829
flare-smart-contracts-v2/
2930
flare-smart-contracts/

.gitlab-ci.yml

Lines changed: 286 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,286 @@
1+
# GitLab CI/CD — merge request checks
2+
3+
workflow:
4+
rules:
5+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
6+
7+
variables:
8+
GIT_DEPTH: "0"
9+
NODE_VERSION: "24"
10+
11+
stages:
12+
- validate
13+
- lint
14+
- test
15+
- links
16+
17+
default:
18+
interruptible: true
19+
20+
.mr-only:
21+
rules:
22+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
23+
24+
.node:
25+
image: node:${NODE_VERSION}
26+
extends: .mr-only
27+
cache:
28+
key: pnpm-root-${CI_COMMIT_REF_SLUG}
29+
paths:
30+
- node_modules/
31+
- .pnpm-store/
32+
before_script:
33+
- corepack enable
34+
- pnpm config set store-dir .pnpm-store
35+
- pnpm install --frozen-lockfile
36+
37+
validate:mr-title:
38+
stage: validate
39+
image: alpine:3.20
40+
extends: .mr-only
41+
script:
42+
- apk add --no-cache grep
43+
- |
44+
title="$CI_MERGE_REQUEST_TITLE"
45+
echo "Checking MR title: $title"
46+
47+
# Allow work-in-progress titles (matches amannn/action-semantic-pull-request wip: true)
48+
if echo "$title" | grep -qiE '^(wip:|\[wip\])'; then
49+
echo "WIP title — skipping validation"
50+
exit 0
51+
fi
52+
53+
if ! echo "$title" | grep -qiE '^(feat|fix|docs|chore|test|refactor|ci)(\([^)]+\))?: .+'; then
54+
echo "Title must use Conventional Commits format:"
55+
echo " feat|fix|docs|chore|test|refactor|ci: description"
56+
echo " feat(scope): description"
57+
exit 1
58+
fi
59+
60+
subject=$(echo "$title" | sed -E 's/^[^:]+: //')
61+
if echo "$subject" | grep -qE '^[A-Z]'; then
62+
echo "Subject must not start with an uppercase letter"
63+
exit 1
64+
fi
65+
66+
lint:eslint:
67+
stage: lint
68+
extends: .node
69+
script:
70+
- pnpm run lint:check --max-warnings=0
71+
72+
lint:typecheck:
73+
stage: lint
74+
extends: .node
75+
script:
76+
- pnpm run typecheck
77+
78+
lint:format:
79+
stage: lint
80+
extends: .node
81+
script:
82+
- pnpm run format:check
83+
84+
lint:build:
85+
stage: lint
86+
extends: .node
87+
script:
88+
- pnpm run build
89+
90+
lint:sentence-newline:
91+
stage: lint
92+
extends: .node
93+
rules:
94+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
95+
changes:
96+
- docs/**/*.md
97+
- docs/**/*.mdx
98+
- .gitlab-ci.yml
99+
script:
100+
- |
101+
CHANGED=$(git diff --name-only --diff-filter=ACMR \
102+
"${CI_MERGE_REQUEST_DIFF_BASE_SHA}" "${CI_COMMIT_SHA}" \
103+
-- 'docs/**/*.md' 'docs/**/*.mdx' || true)
104+
105+
if [ -z "$CHANGED" ]; then
106+
echo "No changed markdown files under docs/"
107+
exit 0
108+
fi
109+
110+
echo "Linting changed files:"
111+
echo "$CHANGED"
112+
pnpm exec textlint --config .textlintrc.json $CHANGED
113+
114+
spell-check:
115+
stage: lint
116+
image: alpine:3.20
117+
rules:
118+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
119+
changes:
120+
- "**/*.md"
121+
- "**/*.mdx"
122+
- .gitlab-ci.yml
123+
before_script:
124+
- apk add --no-cache curl git jq
125+
- |
126+
ARCH=$(uname -m)
127+
case "$ARCH" in
128+
x86_64) TYPOS_ARCH=x86_64 ;;
129+
aarch64) TYPOS_ARCH=aarch64 ;;
130+
*)
131+
echo "Unsupported architecture: $ARCH"
132+
exit 1
133+
;;
134+
esac
135+
TAG=$(curl -fsSL https://api.github.com/repos/crate-ci/typos/releases/latest | jq -r .tag_name)
136+
ASSET="typos-${TAG}-${TYPOS_ARCH}-unknown-linux-musl.tar.gz"
137+
URL=$(curl -fsSL https://api.github.com/repos/crate-ci/typos/releases/latest \
138+
| jq -r --arg asset "$ASSET" '.assets[] | select(.name == $asset) | .browser_download_url')
139+
if [ -z "$URL" ] || [ "$URL" = "null" ]; then
140+
echo "Could not find typos release asset: $ASSET"
141+
exit 1
142+
fi
143+
curl -fsSL "$URL" | tar -xz -C /usr/local/bin
144+
script:
145+
- |
146+
CHANGED=$(git diff --name-only --diff-filter=ACMR \
147+
"${CI_MERGE_REQUEST_DIFF_BASE_SHA}" "${CI_COMMIT_SHA}" \
148+
-- '**/*.md' '**/*.mdx' || true)
149+
150+
if [ -z "$CHANGED" ]; then
151+
echo "No changed markdown files"
152+
exit 0
153+
fi
154+
155+
echo "Spell-checking changed files:"
156+
echo "$CHANGED"
157+
typos --config ./.github/config/typos.toml $CHANGED
158+
159+
check:external-links:
160+
stage: links
161+
image: alpine:3.20
162+
extends: .mr-only
163+
rules:
164+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
165+
changes:
166+
- docs/**/*
167+
- .gitlab-ci.yml
168+
cache:
169+
key: lychee-${CI_COMMIT_REF_SLUG}
170+
paths:
171+
- .lycheecache
172+
before_script:
173+
- apk add --no-cache curl git
174+
- |
175+
ARCH=$(uname -m)
176+
case "$ARCH" in
177+
x86_64) LYCHEE_ARCH=x86_64 ;;
178+
aarch64) LYCHEE_ARCH=aarch64 ;;
179+
*)
180+
echo "Unsupported architecture: $ARCH"
181+
exit 1
182+
;;
183+
esac
184+
LYCHEE_ASSET_DIR="lychee-${LYCHEE_ARCH}-unknown-linux-musl"
185+
curl -fsSL "https://github.com/lycheeverse/lychee/releases/latest/download/${LYCHEE_ASSET_DIR}.tar.gz" \
186+
| tar -xz -C /usr/local/bin --strip-components=1 "${LYCHEE_ASSET_DIR}/lychee"
187+
script:
188+
- |
189+
set +e
190+
lychee --config lychee.toml docs
191+
status=$?
192+
set -e
193+
194+
if [ "$status" -ne 0 ]; then
195+
if [ -f lychee/out.md ]; then
196+
echo "Broken links:"
197+
cat lychee/out.md
198+
else
199+
echo "Lychee detected broken links but no report file was generated"
200+
fi
201+
exit "$status"
202+
fi
203+
204+
test:python-examples:
205+
stage: test
206+
image: python:3.12
207+
rules:
208+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
209+
changes:
210+
- examples/developer-hub-python/**/*
211+
- .gitlab-ci.yml
212+
cache:
213+
key: uv-python-${CI_COMMIT_REF_SLUG}
214+
paths:
215+
- examples/developer-hub-python/.venv/
216+
before_script:
217+
- pip install uv
218+
- cd examples/developer-hub-python
219+
- uv sync --frozen --all-extras --dev
220+
script:
221+
- uv run ruff format --diff
222+
- uv run ruff check --diff
223+
- uv run pytest -v
224+
225+
test:javascript-examples:
226+
stage: test
227+
image: node:${NODE_VERSION}
228+
rules:
229+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
230+
changes:
231+
- examples/developer-hub-javascript/**/*
232+
- .gitlab-ci.yml
233+
cache:
234+
key: pnpm-js-${CI_COMMIT_REF_SLUG}
235+
paths:
236+
- node_modules/
237+
- .pnpm-store/
238+
before_script:
239+
- corepack enable
240+
- pnpm config set store-dir .pnpm-store
241+
- pnpm install --frozen-lockfile
242+
script:
243+
- pnpm --filter ./examples/developer-hub-javascript run format:check
244+
- pnpm --filter ./examples/developer-hub-javascript run lint:check
245+
- pnpm --filter ./examples/developer-hub-javascript run test
246+
247+
test:go-examples:
248+
stage: test
249+
image: golang:1.24
250+
rules:
251+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
252+
changes:
253+
- examples/developer-hub-go/**/*
254+
- .gitlab-ci.yml
255+
cache:
256+
key: go-${CI_COMMIT_REF_SLUG}
257+
paths:
258+
- /go/pkg/mod/
259+
before_script:
260+
- cd examples/developer-hub-go
261+
- go mod download
262+
script:
263+
- go vet ./...
264+
- go test ./coston2 -v
265+
- go test ./flare -v
266+
267+
test:rust-examples:
268+
stage: test
269+
image: rust:latest
270+
rules:
271+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
272+
changes:
273+
- examples/developer-hub-rust/**/*
274+
- .gitlab-ci.yml
275+
cache:
276+
key: rust-${CI_COMMIT_REF_SLUG}
277+
paths:
278+
- examples/developer-hub-rust/target/
279+
before_script:
280+
- rustup component add rustfmt clippy
281+
- cd examples/developer-hub-rust
282+
script:
283+
- cargo fmt -- --check
284+
- cargo clippy --bins -- -D warnings
285+
- cargo build --bins --locked
286+
- ./test.sh

docs/fdc/reference/IJsonApi.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The `JsonApi` attestation type is the predecessor of [`Web2Json`](/fdc/reference
1111
The field names below intentionally use the legacy `postprocessJq` / `abi_signature` / `abi_encoded_data` snake_case form.
1212
:::
1313

14-
Sourced from `IJsonApi.sol` on [GitHub](https://github.com/flare-foundation/flare-smart-contracts-v2/blob/main/contracts/userInterfaces/IJsonApi.sol).
14+
Legacy `IJsonApi.sol` is superseded by [`IWeb2Json.sol`](https://github.com/flare-foundation/flare-smart-contracts-v2/blob/main/contracts/userInterfaces/fdc/IWeb2Json.sol) on [GitHub](https://github.com/flare-foundation/flare-smart-contracts-v2).
1515

1616
## Structs
1717

docs/fdc/reference/IWeb2Json.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: Attestation type that fetches JSON over HTTP, applies a jq filter,
77
The `Web2Json` attestation type fetches data from a URL, post-processes the returned JSON with a `jq` filter, and returns the result as ABI-encoded bytes.
88
The interface only declares the request/response/proof structs — verification is exposed via [`IFdcVerification.verifyWeb2Json`](/fdc/reference/IFdcVerification#verifyweb2json).
99

10-
Sourced from `IWeb2Json.sol` on [GitHub](https://github.com/flare-foundation/flare-smart-contracts-v2/blob/main/contracts/userInterfaces/IWeb2Json.sol).
10+
Sourced from `IWeb2Json.sol` on [GitHub](https://github.com/flare-foundation/flare-smart-contracts-v2/blob/main/contracts/userInterfaces/fdc/IWeb2Json.sol).
1111

1212
## Structs
1313

docs/fdc/reference/IWeb2JsonVerification.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: Verifier interface for Web2Json proofs.
77
`IWeb2JsonVerification` is the verifier surface for the [`Web2Json`](/fdc/reference/IWeb2Json) attestation type.
88
It is one of the parent interfaces inherited by [`IFdcVerification`](/fdc/reference/IFdcVerification) — in practice most consumers call `verifyWeb2Json` through `ContractRegistry.getFdcVerification()` rather than holding a separate `IWeb2JsonVerification` reference.
99

10-
Sourced from `IWeb2JsonVerification.sol` on [GitHub](https://github.com/flare-foundation/flare-smart-contracts-v2/blob/main/contracts/userInterfaces/IWeb2JsonVerification.sol).
10+
Sourced from `IWeb2JsonVerification.sol` on [GitHub](https://github.com/flare-foundation/flare-smart-contracts-v2/blob/main/contracts/userInterfaces/fdc/IWeb2JsonVerification.sol).
1111

1212
## Functions
1313

docs/fxrp/firelight/01-status.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The `main()` function executes the following steps:
3838
4. **Log asset information:** Displays the asset address, symbol, and decimals.
3939
5. **Log vault balances and exchange rate:** Shows total assets, total supply, and the current exchange rate.
4040
6. **Log period configuration:** Displays period timing and configuration.
41-
Firelight vaults operate on [period-based logic](https://docs.firelight.finance/technical-documents#period-based-logic).
41+
Firelight vaults operate on [period-based logic](https://firelight.finance/).
4242
7. **Get and log user information:** Shows user balances and maximum limits for deposit, mint, withdraw, and redeem.
4343
8. **Log user withdrawals:** Displays pending withdrawals for current and previous periods.
4444

docs/fxrp/firelight/04-withdraw.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import CodeBlock from "@theme/CodeBlock";
1111
import FirelightWithdraw from "!!raw-loader!/examples/developer-hub-javascript/firelight-withdraw.ts";
1212

1313
This guide demonstrates how to create a withdrawal request from a Firelight vault.
14-
The Firelight vault implements the [ERC-4626](https://eips.ethereum.org/EIPS/eip-4626) standard and uses a [period-based logic](https://docs.firelight.finance/technical-documents#period-based-logic) for withdrawals.
14+
The Firelight vault implements the [ERC-4626](https://eips.ethereum.org/EIPS/eip-4626) standard and uses a [period-based logic](https://firelight.finance/) for withdrawals.
1515

1616
Withdrawing assets creates a withdrawal request that is processed after the current period ends.
1717
The assets are not immediately transferred; they must be claimed once the period has ended.
@@ -52,7 +52,7 @@ The Firelight vault uses a period-based withdrawal system:
5252
2. **Period End**: The withdrawal is processed after the current period ends.
5353
3. **Claim Withdrawal**: Once the period has ended, you must claim the withdrawal to receive your assets.
5454

55-
This delayed withdrawal mechanism is part of the vault's [period-based logic](https://docs.firelight.finance/technical-documents#period-based-logic) and helps manage liquidity and ensure fair distribution of rewards.
55+
This delayed withdrawal mechanism is part of the vault's [period-based logic](https://firelight.finance/) and helps manage liquidity and ensure fair distribution of rewards.
5656

5757
## Running the Script
5858

docs/fxrp/firelight/05-redeem.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import CodeBlock from "@theme/CodeBlock";
1111
import FirelightRedeem from "!!raw-loader!/examples/developer-hub-javascript/firelight-redeem.ts";
1212

1313
This guide demonstrates how to create a redemption request from a Firelight vault.
14-
The Firelight vault implements the [ERC-4626](https://eips.ethereum.org/EIPS/eip-4626) standard and uses a [period-based logic](https://docs.firelight.finance/technical-documents#period-based-logic) for redemptions.
14+
The Firelight vault implements the [ERC-4626](https://eips.ethereum.org/EIPS/eip-4626) standard and uses a [period-based logic](https://firelight.finance/) for redemptions.
1515

1616
Redeeming shares burns vault shares and allows assets to be withdrawn.
1717
Redemptions create a withdrawal request that is processed after the current period ends.
@@ -53,7 +53,7 @@ The Firelight vault uses a period-based redemption system:
5353
2. **Period End**: The redemption is processed after the current period ends.
5454
3. **Claim Redemption**: Once the period has ended, you must claim the redemption to receive your assets.
5555

56-
This delayed redemption mechanism is part of the vault's [period-based logic](https://docs.firelight.finance/technical-documents#period-based-logic) and helps manage liquidity and ensure fair distribution of rewards.
56+
This delayed redemption mechanism is part of the vault's [period-based logic](https://firelight.finance/) and helps manage liquidity and ensure fair distribution of rewards.
5757

5858
## Running the Script
5959

docs/fxrp/firelight/06-claim.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import CodeBlock from "@theme/CodeBlock";
1111
import FirelightClaim from "!!raw-loader!/examples/developer-hub-javascript/firelight-claim.ts";
1212

1313
This guide demonstrates how to claim pending withdrawals from a Firelight vault.
14-
The Firelight vault implements the [ERC-4626](https://eips.ethereum.org/EIPS/eip-4626) standard and uses a [period-based logic](https://docs.firelight.finance/technical-documents#period-based-logic) for withdrawals.
14+
The Firelight vault implements the [ERC-4626](https://eips.ethereum.org/EIPS/eip-4626) standard and uses a [period-based logic](https://firelight.finance/) for withdrawals.
1515

1616
Claiming is the final step in the withdrawal process.
1717
After you have created a withdrawal request using [`withdraw`](/fxrp/firelight/withdraw) or [`redeem`](/fxrp/firelight/redeem), you must wait for the period to end and then claim your assets.
@@ -21,7 +21,7 @@ After you have created a withdrawal request using [`withdraw`](/fxrp/firelight/w
2121
- [Flare Hardhat Starter Kit](/network/guides/hardhat-foundry-starter-kit)
2222
- [Flare Network Periphery Contracts](https://www.npmjs.com/package/@flarenetwork/flare-periphery-contracts)
2323
- Understanding of [FAssets](/fassets/overview).
24-
- A pending withdrawal request from a previous [period](https://docs.firelight.finance/technical-documents#period-based-logic).
24+
- A pending withdrawal request from a previous [period](https://firelight.finance/).
2525

2626
## Understanding the Claim Process
2727

@@ -30,7 +30,7 @@ The Firelight vault uses a period-based withdrawal system with three steps:
3030
1. **Withdrawal Request:** When you call [`withdraw`](/fxrp/firelight/withdraw) or [`redeem`](/fxrp/firelight/redeem), it creates a withdrawal request associated with the current period.
3131
Your shares are burned at this point.
3232
2. **Period End:** The withdrawal is processed after the current period ends.
33-
3. **Claim Withdrawal:** Once the period has ended, you must call [`claimWithdraw`](https://docs.firelight.finance/technical-documents#claimwithdraw) function to transfer the assets to your wallet.
33+
3. **Claim Withdrawal:** Once the period has ended, you must call the `claimWithdraw` function to transfer the assets to your wallet.
3434

3535
## Firelight Vault Claim Script
3636

0 commit comments

Comments
 (0)