Skip to content

Commit

Permalink
Merge branch 'main' into feat/eugene/wss
Browse files Browse the repository at this point in the history
  • Loading branch information
0xterminator committed Dec 10, 2024
2 parents e0a2e92 + c659a35 commit fb1415a
Show file tree
Hide file tree
Showing 121 changed files with 2,353 additions and 26,360 deletions.
4 changes: 0 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,3 @@ trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[{Makefile,**.mk}]
# Use tabs for indentation (Makefiles require tabs)
indent_style = tab
5 changes: 1 addition & 4 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
KEYPAIR=generated-p2p-secret
NATS_URL=nats://localhost:4222
NATS_ADMIN_PASS=generated-secret
NATS_PUBLIC_PASS=temp-public-pass
SURREALDB_URL=127.0.0.1:8000
SURREALDB_USER=root
SURREALDB_PASS=root
NATS_SYSTEM_PASS=generated-secret
USE_ELASTIC_LOGGING=false
USE_METRICS=true
PUBLISHER_MAX_THREADS=16
Expand Down
19 changes: 18 additions & 1 deletion .github/actions/docker-publish/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,21 @@ runs:
username: ${{ inputs.username }}
password: ${{ inputs.password }}
logout: false

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
images: |
${{ inputs.image }}
tags: |
type=ref,event=branch
type=sha,prefix=
type=semver,pattern={{raw}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push the image to ghcr.io
uses: docker/build-push-action@v6
id: publish
Expand All @@ -73,10 +76,24 @@ runs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
build-args: ${{ inputs.build-args }}
cache-from: type=gha
cache-to: type=gha,mode=max

- id: imageOutput
shell: bash
run: |-
echo "imageUrl=${{ fromJSON(steps.publish.outputs.metadata)['image.name'] }}" >> $GITHUB_OUTPUT
- name: Build Summary
shell: bash
run: |-
echo "---" >> $GITHUB_STEP_SUMMARY
echo "### Docker Build Summary 🐳" >> $GITHUB_STEP_SUMMARY
echo "| Detail | Value |" >> $GITHUB_STEP_SUMMARY
echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| Image | \`${{ inputs.image }}\` |" >> $GITHUB_STEP_SUMMARY
echo "| Tags | \`$(echo ${{ steps.meta.outputs.tags }} | tr '\n' ' ')\` |" >> $GITHUB_STEP_SUMMARY
echo "| Digest | \`${{ steps.publish.outputs.digest }}\` |" >> $GITHUB_STEP_SUMMARY
echo "| Image ID | \`${{ steps.publish.outputs.imageid }}\` |" >> $GITHUB_STEP_SUMMARY
28 changes: 24 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,25 @@ jobs:
- name: Install dependencies
run: cargo fetch

test-helm:
needs: install-deps
name: Test Helm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: "latest"

- name: Install helm unittest plugin
run: |
helm plugin install https://github.com/helm-unittest/helm-unittest.git
- name: Run Helm unit tests
run: |
make helm-test
test:
needs: install-deps
name: Test ${{ matrix.package }}
Expand All @@ -200,7 +219,6 @@ jobs:
matrix:
package:
# - fuel-data-parser
# - fuel-indexer
- fuel-streams
- fuel-streams-core
- fuel-streams-macros
Expand All @@ -223,14 +241,14 @@ jobs:

- name: Start Nats
run: |
make start/nats
make start-nats
- name: Run tests
run: make test PROFILE=ci PACKAGE=${{ matrix.package }}
run: make test PACKAGE=${{ matrix.package }} PROFILE=ci

- name: Stop Nats
if: always()
run: make stop/nats
run: make stop-nats

build:
needs: install-deps
Expand Down Expand Up @@ -347,6 +365,8 @@ jobs:
contains(github.event.head_commit.message, 'ci(release): Preparing')) ||
github.event_name == 'workflow_dispatch'
needs:
- test
- test-helm
- build
runs-on: ubuntu-latest
permissions:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/cleanup_artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ jobs:
# Debug information
echo "Repository Owner: ${REPO_OWNER}"
echo "Repository Name: ${REPO_NAME}"
make cleanup_artifacts \
REPO_OWNER="${REPO_OWNER}" \
REPO_NAME="${REPO_NAME}" \
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/docker_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,16 @@ jobs:
github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
- name: Build and push Fuel publisher image

- name: Get short SHA
id: sha
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Build and push Docker (${{ steps.sha.outputs.short_sha }})
uses: ./.github/actions/docker-publish
id: publish-fuel-streams-nats
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
image: ghcr.io/fuellabs/fuel-streams-publisher
dockerfile: docker/fuel-streams-publisher.Dockerfile
- name: Build and push fule ws streams image
uses: ./.github/actions/docker-publish
id: publish-fuel-ws-nats
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
image: ghcr.io/fuellabs/fuel-streams-ws
dockerfile: docker/fuel-streams-ws.Dockerfile
dockerfile: cluster/docker/fuel-streams-publisher.Dockerfile
91 changes: 76 additions & 15 deletions .github/workflows/helm_publish.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,109 @@
name: Build and publish Helm Chart
name: Build and Publish Helm Chart

on:
workflow_dispatch:
inputs:
chart:
description: "Select the Helm chart to deploy"
required: true
type: choice
options:
- fuel-streams-publisher
- fuel-streams
push:
branches:
- main
paths:
- cluster/charts/fuel-streams-publisher/Chart.yaml
- cluster/charts/fuel-streams-ws/Chart.yaml
- cluster/charts/fuel-nats/Chart.yaml
- cluster/charts/fuel-streams/Chart.yaml

permissions:
contents: read

jobs:
helm-release:
name: Build Helm Chart
name: Build Helm Charts
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'release' && github.event.action == 'published') ||
github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
github.ref == 'refs/heads/main' ||
github.event_name == 'pull_request'
permissions:
contents: read
packages: write
strategy:
matrix:
chart:
- fuel-streams-publisher
- fuel-streams-ws
- fuel-nats
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Helm Dependencies Update For fuel-nats
- name: Determine charts to process
id: charts
run: |
cd cluster/charts/${{ matrix.chart }} && helm dependency update
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "charts=${{ github.event.inputs.chart }}" >> $GITHUB_OUTPUT
else
echo "charts=fuel-streams-publisher fuel-streams" >> $GITHUB_OUTPUT
fi
- name: Validate Chart Names
run: |
for chart in ${{ steps.charts.outputs.charts }}; do
if [ ! -d "cluster/charts/$chart" ]; then
echo "Error: Chart '$chart' does not exist."
exit 1
fi
done
- name: Helm Dependencies Update
run: |
set -e
for chart in ${{ steps.charts.outputs.charts }}; do
echo "Updating dependencies for $chart"
helm dependency update cluster/charts/$chart
done
- name: Get chart versions
id: versions
run: |
publisher_version=$(awk '/^version:/ {print $2}' cluster/charts/fuel-streams-publisher/Chart.yaml)
streams_version=$(awk '/^version:/ {print $2}' cluster/charts/fuel-streams/Chart.yaml)
echo "publisher_version=$publisher_version" >> $GITHUB_OUTPUT
echo "streams_version=$streams_version" >> $GITHUB_OUTPUT
- name: "Build chart: [fuel-streams-publisher v${{ steps.versions.outputs.publisher_version }}]"
if: contains(steps.charts.outputs.charts, 'fuel-streams-publisher')
uses: bsord/[email protected]
with:
useOCIRegistry: true
registry-url: oci://ghcr.io/fuellabs/helmcharts
username: ${{ github.repository_owner }}
access-token: ${{ secrets.GITHUB_TOKEN }}
force: true
chart-folder: ./cluster/charts/fuel-streams-publisher

- name: Package and Push Charts
- name: "Build chart: [fuel-streams v${{ steps.versions.outputs.streams_version }}]"
if: contains(steps.charts.outputs.charts, 'fuel-streams')
uses: bsord/[email protected]
with:
useOCIRegistry: true
registry-url: oci://ghcr.io/fuellabs/helmcharts
username: ${{ github.repository_owner }}
access-token: ${{ secrets.GITHUB_TOKEN }}
force: true
chart-folder: ./cluster/charts/${{ matrix.chart }}
chart-folder: ./cluster/charts/fuel-streams

- name: Build Summary
run: |-
echo "### Helm Charts Build Summary 📊" >> $GITHUB_STEP_SUMMARY
echo "| Chart | Version | Status |" >> $GITHUB_STEP_SUMMARY
echo "|-------|---------|--------|" >> $GITHUB_STEP_SUMMARY
for chart in ${{ steps.charts.outputs.charts }}; do
version=""
if [ "$chart" = "fuel-streams-publisher" ]; then
version="${{ steps.versions.outputs.publisher_version }}"
elif [ "$chart" = "fuel-streams" ]; then
version="${{ steps.versions.outputs.streams_version }}"
fi
echo "| $chart | $version | ✅ Published |" >> $GITHUB_STEP_SUMMARY
done
4 changes: 1 addition & 3 deletions .github/workflows/publish_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ jobs:
echo "$1=${!1:-$2}" >> $GITHUB_ENV
echo "$1=${!1:-$2}" >> .env
}
set_env_var "NATS_URL" "nats://127.0.0.1:4222"
set_env_var "NATS_ADMIN_PASS" "default_pass"
set_env_var "NATS_PUBLIC_PASS" "temp-public-pass"
set_env_var "NATS_ADMIN_PASS" "null"
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/update_deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ jobs:
toolchain: stable

- name: Update Cargo Dependencies
run: cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
run: |
cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
if [ ! -s cargo_update.log ]; then
echo "No updates found" > cargo_update.log
fi
- name: Cargo audit dependencies
uses: actions-rs/[email protected]
Expand Down Expand Up @@ -106,9 +110,9 @@ jobs:
title: ${{ env.PR_TITLE }}
body: |
${{ env.PR_MESSAGE }}
'```txt'
```txt
$(cat cargo_update.log)
'```'
```
branch: cargo_update
labels: dependencies
env:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ profile.json
coverage/
docs/
**/**/charts/**.tgz
values-publisher-env.yaml
values-publisher-secrets.yaml
1 change: 0 additions & 1 deletion .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ extend-exclude = [
"crates/fuel-streams-publisher/README.md",
"crates/fuel-streams-publisher/src/elastic.rs",
"crates/fuel-streams-ws/README.md",
"crates/fuel-indexer/*",
"docker/chain-config",
"docker/monitoring",
"cluster",
Expand Down
Loading

0 comments on commit fb1415a

Please sign in to comment.