Skip to content

Commit

Permalink
Bootstrap from playground
Browse files Browse the repository at this point in the history
  • Loading branch information
sdankel committed Mar 21, 2024
1 parent 771796a commit 15fa475
Show file tree
Hide file tree
Showing 58 changed files with 21,933 additions and 15 deletions.
147 changes: 147 additions & 0 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: Backend CI
on:
push:
branches:
- master
pull_request:

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
REGISTRY: ghcr.io
RUST_VERSION: 1.70.0

jobs:
cancel-previous-runs:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}

cargo-fmt-check:
needs: cancel-previous-runs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Check Formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all --verbose -- --check

cargo-clippy:
needs: cancel-previous-runs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v1
- name: Check Clippy Linter
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features --all-targets -- -D warnings

cargo-check:
needs: cancel-previous-runs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v1
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: check
args: --verbose

cargo-test:
needs: cancel-previous-runs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v1
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --all --all-features

build-and-publish-image:
needs:
- cargo-fmt-check
- cargo-clippy
- cargo-check
- cargo-test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/fuellabs/forc.pub
tags: |
type=ref,event=branch
type=sha,prefix=
type=semver,pattern={{raw}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to the ghcr.io registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push the image to ghcr.io
uses: docker/build-push-action@v2
with:
context: .
file: deployment/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

deploy:
if: github.ref == 'refs/heads/master'
needs:
- build-and-publish-image
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- name: Set Environment Variables
run: |
tag=(`echo $GITHUB_SHA | cut -c1-7`)
echo "IMAGE_TAG=`echo $tag`" >> $GITHUB_ENV
- name: Deploy forc.pub Backend Environment
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Deploy forc.pub on k8s
repo: FuelLabs/fuel-deployment
ref: refs/heads/master
token: ${{ secrets.REPO_TOKEN }}
inputs: '{ "cluster": "${{ env.CONFIG }}", "deployment-version": "${{ github.sha }}", "image-version": "${{ env.IMAGE_TAG }}" }'
env:
CONFIG: 'fuel-prod-1'
23 changes: 23 additions & 0 deletions .github/workflows/frontend-build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Frontend - Build and Test

on:
push:
branches-ignore:
- master

env:
NODE_VERSION: '16'

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: npm ci and build
env:
CI: true
run: |
cd app && npm ci && npm run build
cp -r build ../build
31 changes: 31 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: GitHub Pages

on:
push:
branches:
- master
workflow_dispatch:

env:
NODE_VERSION: '16'

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: npm ci and build
env:
CI: true
run: |
cd app && npm ci && npm run build
cp -r build ../build
cp ../CNAME ../build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
36 changes: 36 additions & 0 deletions .github/workflows/helm-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build and publish Helm Chart

on:
push:
branches:
- master
paths:
- 'helm/forc.pub/Chart.yaml'

permissions:
contents: read

jobs:
helm-release:
name: Build Helm Chart
runs-on: buildjet-4vcpu-ubuntu-2204
if: |
(github.event_name == 'release' && github.event.action == 'published') ||
github.ref == 'refs/heads/master' || github.event_name == 'pull_request'
permissions:
contents: read
packages: write

steps:
- name: Check out code
uses: actions/checkout@v3

- name: Package and Push Charts
uses: bsord/helm-push@v4.1.0
with:
useOCIRegistry: true
registry-url: oci://ghcr.io/fuellabs/helmcharts
username: ${{ github.repository_owner }}
access-token: ${{ secrets.GITHUB_TOKEN }}
force: true
chart-folder: ./helm/forc.pub
23 changes: 9 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
/target
out
target
.vercel
/certs/*
build
node_modules
tmp
.vscode/*
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
forc.pub
Loading

0 comments on commit 15fa475

Please sign in to comment.