Skip to content

Commit 1ed1238

Browse files
committed
Merge branch 'master' of https://github.com/paritytech/substrate-telemetry into ny-sync-fork
2 parents c2b8ebf + d4a557c commit 1ed1238

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1410
-677
lines changed

.github/workflows/backend.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Backend CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- ".github/workflows/backend*"
9+
- "backend/**"
10+
- "!frontend/**"
11+
pull_request:
12+
paths:
13+
- ".github/workflows/backend*"
14+
- "backend/**"
15+
- "!frontend/**"
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
19+
cancel-in-progress: true
20+
21+
env:
22+
CARGO_TERM_COLOR: always
23+
24+
defaults:
25+
run:
26+
working-directory: ./backend
27+
28+
jobs:
29+
check:
30+
name: Check Code
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout sources
34+
uses: actions/checkout@v4
35+
36+
- name: Install Rust stable toolchain
37+
uses: actions-rs/toolchain@v1
38+
with:
39+
profile: minimal
40+
toolchain: stable
41+
override: true
42+
43+
- name: Rust Cache
44+
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
45+
with:
46+
workspaces: backend
47+
48+
- name: Build
49+
run: cargo check --all-targets --verbose
50+
tests:
51+
name: Run tests
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Checkout sources
55+
uses: actions/checkout@v4
56+
57+
- name: Install Rust stable toolchain
58+
uses: actions-rs/toolchain@v1
59+
with:
60+
profile: minimal
61+
toolchain: stable
62+
override: true
63+
64+
- name: Rust Cache
65+
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
66+
with:
67+
workspaces: backend
68+
cache-on-failure: true
69+
70+
- name: Cargo test
71+
run: cargo test --verbose --jobs 1
72+
docs:
73+
name: Check Documentation
74+
runs-on: ubuntu-latest
75+
steps:
76+
- name: Checkout sources
77+
uses: actions/checkout@v4
78+
79+
- name: Install Rust stable toolchain
80+
uses: actions-rs/toolchain@v1
81+
with:
82+
profile: minimal
83+
toolchain: stable
84+
override: true
85+
86+
- name: Rust Cache
87+
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
88+
with:
89+
workspaces: backend
90+
91+
- name: Check internal documentation links
92+
run: RUSTDOCFLAGS="--deny broken_intra_doc_links" cargo doc --verbose --workspace --no-deps --document-private-items
93+
fmt:
94+
name: Run rustfmt
95+
runs-on: ubuntu-latest
96+
steps:
97+
- name: Checkout sources
98+
uses: actions/checkout@v4
99+
100+
- name: Install Rust stable toolchain
101+
uses: actions-rs/toolchain@v1
102+
with:
103+
profile: minimal
104+
toolchain: stable
105+
override: true
106+
components: clippy, rustfmt
107+
108+
- name: Cargo fmt
109+
run: cargo fmt --verbose --all -- --check

.github/workflows/backend_check.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/backend_docs.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/backend_fmt.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/backend_tests.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/docker-build.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Docker Build
2+
# Workflow checks that docker build works
3+
4+
on:
5+
pull_request:
6+
types: [opened, synchronize, reopened, ready_for_review]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
env:
13+
IMAGE_NAME: parity/substrate-telemetry
14+
15+
jobs:
16+
set-variables:
17+
name: Set variables
18+
runs-on: ubuntu-latest
19+
outputs:
20+
VERSION: ${{ steps.version.outputs.VERSION }}
21+
steps:
22+
- name: Define version
23+
id: version
24+
run: |
25+
export COMMIT_SHA=${{ github.sha }}
26+
export COMMIT_SHA_SHORT=${COMMIT_SHA:0:8}
27+
export REF_NAME=${{ github.ref_name }}
28+
export REF_SLUG=${REF_NAME//\//_}
29+
if [[ ${REF_SLUG} == "main" ]]
30+
then
31+
echo "VERSION=${REF_SLUG}-${COMMIT_SHA_SHORT}" >> $GITHUB_OUTPUT
32+
else
33+
echo "VERSION=${REF_SLUG}" >> $GITHUB_OUTPUT
34+
fi
35+
echo "set VERSION=${VERSION}"
36+
37+
build_backend:
38+
name: Build backend docker image
39+
runs-on: ubuntu-latest
40+
needs: [set-variables]
41+
env:
42+
VERSION: ${{ needs.set-variables.outputs.VERSION }}
43+
steps:
44+
- name: Check out the repo
45+
uses: actions/checkout@v4
46+
47+
- name: Build and push Docker image from main
48+
uses: docker/build-push-action@v5
49+
with:
50+
context: backend
51+
file: ./backend/Dockerfile
52+
push: false
53+
tags: |
54+
${{ env.IMAGE_NAME }}-backend:${{ env.VERSION }}
55+
56+
build_frontend:
57+
name: Build frontend docker image
58+
runs-on: ubuntu-latest
59+
needs: [set-variables]
60+
env:
61+
VERSION: ${{ needs.set-variables.outputs.VERSION }}
62+
steps:
63+
- name: Check out the repo
64+
uses: actions/checkout@v4
65+
66+
- name: Build and push Docker image from main
67+
uses: docker/build-push-action@v5
68+
with:
69+
context: frontend
70+
file: ./frontend/Dockerfile
71+
push: false
72+
tags: |
73+
${{ env.IMAGE_NAME }}-frontend:${{ env.VERSION }}

.github/workflows/frontend.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
- 'frontend/**'
1616
- '!backend/**'
1717

18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
20+
cancel-in-progress: true
21+
1822
defaults:
1923
run:
2024
working-directory: ./frontend
@@ -28,10 +32,10 @@ jobs:
2832
node-version: [14.x]
2933

3034
steps:
31-
- uses: actions/checkout@v3
35+
- uses: actions/checkout@v4
3236

3337
- name: Use Node.js ${{ matrix.node-version }}
34-
uses: actions/setup-node@v3
38+
uses: actions/setup-node@v4
3539
with:
3640
node-version: ${{ matrix.node-version }}
3741

0 commit comments

Comments
 (0)