Skip to content

Commit

Permalink
Remove search-indexer and emails microservices in services/, and more.
Browse files Browse the repository at this point in the history
* search-indexer and emails microservices will no longer be in the monorepo.
    * emails makes sense to be in its separate repository (which is still is, https://github.com/charted-dev/emails-service)
    * search-indexer will be apart of charted-server as a CLI command, so it can be processed in the background with a Kubernetes Job, Docker container, etc.
* Repositories database controller now exists, patch and delete are not implemented.
* BAZEL_ARGS can be used to append more startup arguments in ./dev script and available in devtools.
* Fix more errors with OpenAPI #[controller] proc-macro.
* Update thirdparty dependencies.
  • Loading branch information
auguwu committed Aug 31, 2023
1 parent 1e565e0 commit fdeac75
Show file tree
Hide file tree
Showing 196 changed files with 2,394 additions and 7,308 deletions.
5 changes: 1 addition & 4 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build --@rules_rust//:clippy.toml=//:clippy.toml
build --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect
build --output_groups=+clippy_checks

# Required on windows
# Required for Windows
common --enable_platform_specific_config
startup --windows_enable_symlinks
build:windows --enable_runfiles
Expand All @@ -18,9 +18,6 @@ common --experimental_allow_tags_propagation
# Always show test output.
test --test_output=all

# Include ./services/search-indexer/scripts/stamp.sh when building
build --stamp --workspace_status_command=./services/search-indexer/scripts/stamp.sh

# Allows importing from user-defined .bazelrc files; this is ignored
# by Git by default.
try-import %workspace%/.user.bazelrc
249 changes: 226 additions & 23 deletions .github/workflows/Release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,35 @@ env:
jobs:
binary:
name: Build Binary
runs-on: ${{matrix.runner}}
runs-on: ${{matrix.data.runner}}
strategy:
fail-fast: true
matrix:
runner: [macos-latest, ubuntu-latest, self-hosted]
include:
data:
- runner: ubuntu-latest
bazel-cache-dir: ~/.cache/bazel
bazelisk-cache-dir: ~/.cache/bazelisk
os: linux
arch: x86_64
ext: ""
bazel-args: ""
- runner: self-hosted
bazel-cache-dir: ~/.cache/bazel
bazelisk-cache-dir: ~/.cache/bazelisk
os: linux
arch: aarch64
ext: ""
bazel-args: ""
- runner: macos-latest
bazel-cache-dir: /private/var/tmp/_bazel_runner/
bazelisk-cache-dir: ~/Library/Caches/bazelisk
os: darwin
arch: x86_64
ext: ""
bazel-args: ""
- runner: macos-latest
bazelisk-cache-dir: ~/Library/Caches/bazelisk
os: darwin
arch: aarch64
ext: ""
bazel-args: "--platforms=//build/platforms:apple_silicon"
steps:
- name: Checkout source code
uses: actions/checkout@v3
Expand All @@ -50,51 +64,240 @@ jobs:
with:
path: |
${{runner.temp}}/_bazel_${{runner.os}}_${{runner.arch}}
${{matrix.runner}}
restore-keys: bazel-cache-${{matrix.runner}}-
key: bazel-cache-${{matrix.runner}}-${{ hashFiles('WORKSPACE', 'BUILD.bazel', '.bazelversion') }}

- name: Synchronize dependencies
run: ./dev sync-deps
env:
BAZEL_ARGS: ${{env.BAZEL_ARGS}} --disk_cache=${{runner.temp}}/_bazel_${{runner.os}}_${{runner.arch}}
${{matrix.data.runner}}
restore-keys: bazel-cache-${{matrix.data.runner}}-
key: bazel-cache-${{matrix.data.runner}}-${{ hashFiles('WORKSPACE', 'BUILD.bazel', '.bazelversion') }}

- name: Build release binary
id: binary
run: |
echo "===> Building release binary..."
bazel ${BAZEL_ARGS} build //cli:release_binary
bazel ${{env.BAZEL_ARGS}} ${{matrix.data.bazel-args}} build //cli:release_binary
echo "===> Marking location as an output"
location=$(bazel cquery //cli:release_binary --output=files >/dev/null 2>&1 | grep bazel-out)
location=$(bazel ${{env.BAZEL_ARGS}} ${{matrix.data.bazel-args}} cquery //cli:release_binary --output=files >/dev/null 2>&1 | grep bazel-out)
echo "location=$(location)" >> "${GITHUB_OUTPUT}"
- name: Create and update binary location
run: |
echo "===> Copying ${{steps.binary.outputs.location}} -> ./bin/charted"
mkdir -p ./bin && cp ${{steps.binary.outputs.location}} ./bin
mv ./bin/release_binary ./bin/charted
- name: Shutdown Bazel server
run: bazel shutdown

- name: Upload to S3 bucket (/charted/server/${{steps.tag.outputs.version}})
uses: Noelware/s3-action@2.2.1
with:
enforce-path-access-style: true
access-key-id: ${{secrets.S3_ACCESS_KEY}}
path-format: $(prefix)/charted/server/${{steps.tag.outputs.version}}/binaries/charted-$(os)-$(arch)
path-format: $(prefix)/charted/server/${{steps.tag.outputs.version}}/charted-${{matrix.data.os}}-${{matrix.data.arch}}${{matrix.data.ext}}
secret-key: ${{secrets.S3_SECRET_KEY}}
endpoint: ${{secrets.S3_ENDPOINT}}
region: us-east-1
prefix: /noelware/artifacts
bucket: august
files: ${{steps.binary.outputs.location}}

- name: Upload to S3 bucket (/charted/server/latest)
uses: Noelware/s3-action@2.2.1
with:
enforce-path-access-style: true
access-key-id: ${{secrets.S3_ACCESS_KEY}}
path-format: $(prefix)/charted/server/latest/binaries/charted-$(os)-$(arch)
path-format: $(prefix)/charted/server/latest/charted-${{matrix.data.os}}-${{matrix.data.arch}}${{matrix.data.ext}}
secret-key: ${{secrets.S3_SECRET_KEY}}
endpoint: ${{secrets.S3_ENDPOINT}}
region: us-east-1
prefix: /noelware/artifacts
bucket: august
files: ${{steps.binary.outputs.location}}
docker-debian:
name: Build Debian image
runs-on: ${{matrix.runner}}
strategy:
fail-fast: true
matrix:
runner: [ubuntu-latest, self-hosted]
include:
- runner: ubuntu-latest
platform: linux/amd64
arch: amd64
- runner: self-hosted
platform: linux/arm64
arch: arm64
steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Get current release tag
uses: auguwu/git-tag-action@master
id: tag

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

- name: Login
uses: docker/login-action@v2
with:
registry: cr.noelware.cloud
username: noelbot
password: ${{secrets.REGISTRY_PASSWORD}}

- name: Build and push
uses: docker/build-push-action@v4
with:
provenance: false
platforms: ${{matrix.platform}}
context: .
cache-from: type=gha,scope=debian-${{matrix.arch}}
file: ./distribution/docker/debian.Dockerfile
tags: |
cr.noelware.cloud/charted/charted:${{steps.tag.outputs.version}}-${{matrix.arch}},
cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}.${{steps.tag.outputs.minor}}-${{matrix.arch}},
cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}-${{matrix.arch}},
cr.noelware.cloud/charted/charted:latest-${{matrix.arch}}
docker-alpine:
name: Build Alpine image
runs-on: ${{matrix.runner}}
strategy:
fail-fast: true
matrix:
runner: [ubuntu-latest]
include:
- runner: ubuntu-latest
platform: linux/amd64
arch: amd64
steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Get current release tag
uses: auguwu/git-tag-action@master
id: tag

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

- name: Login
uses: docker/login-action@v2
with:
registry: cr.noelware.cloud
username: noelbot
password: ${{secrets.REGISTRY_PASSWORD}}

- name: Build and push
uses: docker/build-push-action@v4
with:
provenance: false
platforms: ${{matrix.platform}}
context: .
cache-from: type=gha,scope=alpine-${{matrix.arch}}
file: ./distribution/docker/alpine.Dockerfile
tags: |
cr.noelware.cloud/charted/charted:${{steps.tag.outputs.version}}-alpine-${{matrix.arch}},
cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}.${{steps.tag.outputs.minor}}-alpine-${{matrix.arch}},
cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}-alpine-${{matrix.arch}},
cr.noelware.cloud/charted/charted:alpine-${{matrix.arch}}
docker-manifests:
name: Merge Manifests
runs-on: ubuntu-latest
needs: [docker-alpine, docker-debian]
if: ${{github.repository == 'charted-dev/charted'}}
steps:
- name: Get current release tag
uses: auguwu/git-tag-action@master
id: tag

- name: Login
uses: docker/login-action@v2
with:
registry: cr.noelware.cloud
username: noelbot
password: ${{secrets.REGISTRY_PASSWORD}}

- name: Merge Manifests [cr.noelware.cloud/charted/charted:latest]
uses: Noelware/docker-manifest-action@0.4.0
with:
images: cr.noelware.cloud/charted/charted:latest
inputs: cr.noelware.cloud/charted/charted:latest-amd64,cr.noelware.cloud/charted/charted:latest-arm64
push: true

- name: Merge Manifests [cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}]
uses: Noelware/docker-manifest-action@0.4.0
with:
images: cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}
inputs: cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}-amd64,cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}-arm64
push: true

- name: Merge Manifests [cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}.${{steps.tag.outputs.minor}}]
uses: Noelware/docker-manifest-action@0.4.0
with:
images: cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}.${{steps.tag.outputs.minor}}
inputs: cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}.${{steps.tag.outputs.minor}}-amd64,cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}.${{steps.tag.outputs.minor}}-arm64
push: true

- name: Merge Manifests [cr.noelware.cloud/charted/charted:${{steps.tag.outputs.version}}]
uses: Noelware/docker-manifest-action@0.4.0
with:
images: cr.noelware.cloud/charted/charted:${{steps.tag.outputs.version}}
inputs: cr.noelware.cloud/charted/charted:${{steps.tag.outputs.version}}-amd64,cr.noelware.cloud/charted/charted:${{steps.tag.outputs.version}}-arm64
push: true

- name: Merge Manifests [cr.noelware.cloud/charted/charted:alpine]
uses: Noelware/docker-manifest-action@0.4.0
with:
images: cr.noelware.cloud/charted/charted:alpine
inputs: cr.noelware.cloud/charted/charted:alpine-amd64,cr.noelware.cloud/charted/charted:alpine-arm64
push: true

- name: Merge Manifests [cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}-alpine]
uses: Noelware/docker-manifest-action@0.4.0
with:
images: cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}-alpine
inputs: cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}-alpine-amd64,cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}-alpine-arm64
push: true

- name: Merge Manifests [cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}.${{steps.tag.outputs.minor}}-alpine]
uses: Noelware/docker-manifest-action@0.4.0
with:
images: cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}.${{steps.tag.outputs.minor}}-alpine
inputs: cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}.${{steps.tag.outputs.minor}}--alpineamd64,cr.noelware.cloud/charted/charted:${{steps.tag.outputs.major}}.${{steps.tag.outputs.minor}}-alpine-arm64
push: true

- name: Merge Manifests [cr.noelware.cloud/charted/charted:${{steps.tag.outputs.version}}-alpine]
uses: Noelware/docker-manifest-action@0.4.0
with:
images: cr.noelware.cloud/charted/charted:${{steps.tag.outputs.version}}-alpine
inputs: cr.noelware.cloud/charted/charted:${{steps.tag.outputs.version}}-alpine-amd64,cr.noelware.cloud/charted/charted:${{steps.tag.outputs.version}}-alpine-arm64
push: true
sentry:
name: Create Sentry release
runs-on: ubuntu-latest
if: ${{github.repository == 'charted-dev/charted'}}
steps:
- name: Get current release tag
uses: auguwu/git-tag-action@master
id: tag

- name: Create!
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN}}
SENTRY_PROJECT: charted-server
SENTRY_URL: https://sentry.noelware.cloud
with:
environment: production
version: ${{steps.tag.outputs.version}}
prod:
name: Push to Production
runs-on: ubuntu-latest
if: ${{github.repository == 'charted-dev/charted'}}
needs: [sentry, docker-manifests]
steps:
- name: Get current release tag
uses: auguwu/git-tag-action@master
id: tag

- name: Update ~/.kube/config file
run: echo "${{secrets.KUBECONFIG}}" >> ~/.kube/config

- name: Rollout
run: kubectl set image deployment/charted-server charted-server=cr.noelware.cloud/charted/charted:${{steps.tag.outputs.version}}-alpine

- name: Wait for completion!
run: kubectl rollout status deployment/charted-server
Loading

0 comments on commit fdeac75

Please sign in to comment.