Skip to content

Commit 2b7e388

Browse files
Merge upstream v10.0.7 (auto-resolved conflicts)
2 parents 8cd1fb5 + 364ebba commit 2b7e388

64 files changed

Lines changed: 3473 additions & 12 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
name: Generate OpenAPI Specs
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- np-integrate-open-api-spex
8+
paths-ignore:
9+
- "CHANGELOG.md"
10+
- "**/README.md"
11+
- "docker/*"
12+
- "docker-compose/*"
13+
workflow_dispatch:
14+
release:
15+
types: [published]
16+
17+
env:
18+
OTP_VERSION: '27.3.4.6'
19+
ELIXIR_VERSION: '1.19.4'
20+
RELEASE_VERSION: 10.0.7
21+
22+
jobs:
23+
matrix-builder:
24+
name: Build matrix
25+
runs-on: ubuntu-latest
26+
outputs:
27+
matrix: ${{ steps.set-matrix.outputs.matrix }}
28+
steps:
29+
- id: set-matrix
30+
run: |
31+
echo "matrix=$(node -e '
32+
33+
// Add/remove CI matrix chain types here
34+
const chainTypes = [
35+
"default",
36+
"arbitrum",
37+
"blackfort",
38+
"ethereum",
39+
"filecoin",
40+
"optimism",
41+
"optimism-celo",
42+
"polygon_zkevm",
43+
"rsk",
44+
"scroll",
45+
"shibarium",
46+
"stability",
47+
"zetachain",
48+
"zilliqa",
49+
"zksync",
50+
"neon"
51+
];
52+
53+
const matrix = { "chain-type": ${{ 'chainTypes' }} };
54+
console.log(JSON.stringify(matrix));
55+
')" >> $GITHUB_OUTPUT
56+
57+
build-and-cache:
58+
name: Build and Cache deps
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v5
62+
- uses: erlef/setup-beam@v1
63+
with:
64+
otp-version: ${{ env.OTP_VERSION }}
65+
elixir-version: ${{ env.ELIXIR_VERSION }}
66+
hexpm-mirrors: |
67+
https://builds.hex.pm
68+
https://cdn.jsdelivr.net/hex
69+
70+
- name: "ELIXIR_VERSION.lock"
71+
run: echo "${ELIXIR_VERSION}" > ELIXIR_VERSION.lock
72+
73+
- name: "OTP_VERSION.lock"
74+
run: echo "${OTP_VERSION}" > OTP_VERSION.lock
75+
76+
- name: Restore Mix Deps Cache
77+
uses: actions/cache@v4
78+
id: deps-cache
79+
with:
80+
path: |
81+
deps
82+
_build
83+
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }}
84+
restore-keys: |
85+
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-
86+
87+
- name: Conditionally build Mix deps cache
88+
if: steps.deps-cache.outputs.cache-hit != 'true'
89+
run: |
90+
mix local.hex --force
91+
mix local.rebar --force
92+
mix deps.get
93+
mix deps.compile --skip-umbrella-children
94+
95+
generate-swagger:
96+
strategy:
97+
fail-fast: false
98+
matrix: ${{ fromJson(needs.matrix-builder.outputs.matrix) }}
99+
name: Generate Open API spec
100+
runs-on: ubuntu-latest
101+
needs:
102+
- build-and-cache
103+
- matrix-builder
104+
steps:
105+
- uses: actions/checkout@v5
106+
- uses: erlef/setup-beam@v1
107+
with:
108+
otp-version: ${{ env.OTP_VERSION }}
109+
elixir-version: ${{ env.ELIXIR_VERSION }}
110+
hexpm-mirrors: |
111+
https://builds.hex.pm
112+
https://cdn.jsdelivr.net/hex
113+
114+
- name: Mix Deps Cache
115+
uses: actions/cache/restore@v4
116+
id: deps-cache
117+
with:
118+
path: |
119+
deps
120+
_build
121+
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }}
122+
restore-keys: |
123+
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-
124+
125+
- name: mix openapi.spec.yaml
126+
run: |
127+
mix openapi.spec.yaml --spec BlockScoutWeb.Specs.Public openapi.${{ matrix.chain-type }}.yaml --start-app=false
128+
env:
129+
CHAIN_TYPE: ${{ matrix.chain-type != 'default' && matrix.chain-type || '' }}
130+
MUD_INDEXER_ENABLED: false
131+
132+
- name: Generate MUD-enabled spec for Optimism
133+
if: matrix.chain-type == 'optimism'
134+
run: |
135+
mix openapi.spec.yaml --spec BlockScoutWeb.Specs.Public openapi.mud.yaml --start-app=false
136+
env:
137+
CHAIN_TYPE: optimism
138+
MUD_INDEXER_ENABLED: true
139+
140+
- name: Upload OpenAPI spec
141+
uses: actions/upload-artifact@v4
142+
with:
143+
name: openapi-spec-${{ matrix.chain-type }}
144+
path: openapi.${{ matrix.chain-type }}.yaml
145+
retention-days: 1
146+
147+
- name: Upload MUD-enabled spec
148+
if: matrix.chain-type == 'optimism'
149+
uses: actions/upload-artifact@v4
150+
with:
151+
name: openapi-spec-mud
152+
path: openapi.mud.yaml
153+
retention-days: 1
154+
155+
push-specs:
156+
needs:
157+
- generate-swagger
158+
- matrix-builder
159+
runs-on: ubuntu-latest
160+
name: Push all OpenAPI specs
161+
steps:
162+
- name: Validate required secrets
163+
run: |
164+
if [ -z "${{ secrets.API_SPECS_PAT }}" ]; then
165+
echo "Error: API_SPECS_PAT secret is not set"
166+
exit 1
167+
fi
168+
169+
- name: Checkout specs repository
170+
uses: actions/checkout@v5
171+
with:
172+
repository: ${{ vars.API_SPECS_REPOSITORY }}
173+
token: ${{ secrets.API_SPECS_PAT }}
174+
path: api-specs
175+
176+
- name: Download all swagger specs
177+
uses: actions/download-artifact@v5
178+
with:
179+
pattern: openapi-spec-*
180+
merge-multiple: true
181+
path: temp-specs
182+
183+
- name: Create specs directory structure
184+
run: |
185+
VERSION=${{ github.event_name == 'release' && env.RELEASE_VERSION || 'master' }}
186+
187+
for SPEC_FILE in temp-specs/*; do
188+
if [ -f "$SPEC_FILE" ]; then
189+
FILENAME=$(basename "$SPEC_FILE")
190+
191+
# Handle MUD spec specially
192+
if [ "$FILENAME" = "openapi.mud.yaml" ]; then
193+
mkdir -p "api-specs/blockscout/${VERSION}/mud"
194+
cp "$SPEC_FILE" "api-specs/blockscout/${VERSION}/mud/swagger.yaml"
195+
else
196+
# Extract chain type from filename (openapi.CHAINTYPE.yaml)
197+
CHAIN_TYPE=$(echo "$FILENAME" | sed 's/openapi\.\(.*\)\.yaml/\1/')
198+
mkdir -p "api-specs/blockscout/${VERSION}/${CHAIN_TYPE}"
199+
cp "$SPEC_FILE" "api-specs/blockscout/${VERSION}/${CHAIN_TYPE}/swagger.yaml"
200+
fi
201+
fi
202+
done
203+
204+
205+
- name: Commit and push changes
206+
working-directory: api-specs
207+
run: |
208+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
209+
git config --local user.name "github-actions[bot]"
210+
211+
git add .
212+
213+
# Only commit if there are changes
214+
if git diff --staged --quiet; then
215+
echo "No changes to commit"
216+
else
217+
git commit -m "[SKIP-GH-PAGES] create OpenAPI specs for Blockscout ${{ github.event_name == 'release' && env.RELEASE_VERSION || github.sha }}"
218+
git push
219+
fi
220+
221+
- name: Clean up
222+
if: always()
223+
run: |
224+
rm -rf temp-specs
225+
rm -rf api-specs
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Pre-release for Arbitrum
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
number:
7+
type: number
8+
description: Number of pre-release alpha iteration
9+
required: true
10+
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
env:
16+
OTP_VERSION: '27.3.4.6'
17+
ELIXIR_VERSION: '1.19.4'
18+
19+
jobs:
20+
push_to_registry:
21+
name: Push Docker image to GitHub Container Registry
22+
runs-on: build
23+
env:
24+
RELEASE_VERSION: 10.0.7
25+
steps:
26+
- uses: actions/checkout@v5
27+
- name: Setup repo
28+
uses: ./.github/actions/setup-repo
29+
id: setup
30+
with:
31+
github-token: ${{ secrets.GITHUB_TOKEN }}
32+
docker-remote-multi-platform: true
33+
docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }}
34+
docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }}
35+
36+
- name: Build and push Docker image for Arbitrum (indexer + API)
37+
uses: docker/build-push-action@v6
38+
with:
39+
context: .
40+
file: ./docker/Dockerfile
41+
push: true
42+
tags: ghcr.io/blockscout/blockscout-arbitrum-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}
43+
labels: ${{ steps.setup.outputs.docker-labels }}
44+
platforms: |
45+
linux/amd64
46+
linux/arm64/v8
47+
build-args: |
48+
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}
49+
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
50+
CHAIN_TYPE=arbitrum
51+
52+
- name: Build and push Docker image for Arbitrum (indexer)
53+
uses: docker/build-push-action@v6
54+
with:
55+
context: .
56+
file: ./docker/Dockerfile
57+
push: true
58+
tags: ghcr.io/blockscout/blockscout-arbitrum-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}-indexer
59+
labels: ${{ steps.setup.outputs.docker-labels }}
60+
platforms: |
61+
linux/amd64
62+
linux/arm64/v8
63+
build-args: |
64+
DISABLE_API=true
65+
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}
66+
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
67+
CHAIN_TYPE=arbitrum
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Pre-release for CELO
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
number:
7+
type: number
8+
description: Number of pre-release alpha iteration
9+
required: true
10+
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
env:
16+
OTP_VERSION: '27.3.4.6'
17+
ELIXIR_VERSION: '1.19.4'
18+
19+
jobs:
20+
push_to_registry:
21+
name: Push Docker image to GitHub Container Registry
22+
runs-on: build
23+
env:
24+
RELEASE_VERSION: 10.0.7
25+
API_GRAPHQL_MAX_COMPLEXITY: 10400
26+
steps:
27+
- uses: actions/checkout@v5
28+
- name: Setup repo
29+
uses: ./.github/actions/setup-repo
30+
id: setup
31+
with:
32+
github-token: ${{ secrets.GITHUB_TOKEN }}
33+
docker-remote-multi-platform: true
34+
docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }}
35+
docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }}
36+
37+
- name: Build and push Docker image for CELO (indexer + API)
38+
uses: docker/build-push-action@v6
39+
with:
40+
context: .
41+
file: ./docker/Dockerfile
42+
push: true
43+
tags: ghcr.io/blockscout/blockscout-celo-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}
44+
labels: ${{ steps.setup.outputs.docker-labels }}
45+
platforms: |
46+
linux/amd64
47+
linux/arm64/v8
48+
build-args: |
49+
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}
50+
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
51+
CHAIN_TYPE=optimism-celo
52+
53+
- name: Build and push Docker image for CELO (indexer)
54+
uses: docker/build-push-action@v6
55+
with:
56+
context: .
57+
file: ./docker/Dockerfile
58+
push: true
59+
tags: ghcr.io/blockscout/blockscout-celo-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}-indexer
60+
labels: ${{ steps.setup.outputs.docker-labels }}
61+
platforms: |
62+
linux/amd64
63+
linux/arm64/v8
64+
build-args: |
65+
DISABLE_API=true
66+
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}
67+
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
68+
CHAIN_TYPE=optimism-celo

0 commit comments

Comments
 (0)