feat: add operator rework #3647
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Default | |
on: | |
merge_group: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [ assigned, opened, synchronize, reopened, labeled ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
Dirty: | |
runs-on: "formance-runner" | |
steps: | |
- uses: 'actions/checkout@v4' | |
with: | |
fetch-depth: 0 | |
- name: Setup Env | |
uses: ./.github/actions/env | |
- run: > | |
earthly | |
--allow-privileged | |
--secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY | |
--secret GITHUB_TOKEN=$GITHUB_TOKEN | |
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }} | |
+pre-commit | |
env: | |
GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} | |
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }} | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v40 | |
with: | |
since_last_remote_commit: true | |
- name: Run step if test file(s) change | |
if: steps.changed-files.outputs.all_changed_files == 'true' | |
run: | | |
echo "One or more test file(s) has changed." | |
echo "List all the files that have changed: ${{ steps.changed-files.outputs.all_changed_files }}" | |
exit 1 | |
Main: | |
runs-on: "formance-runner" | |
needs: | |
- Dirty | |
steps: | |
- uses: 'actions/checkout@v4' | |
with: | |
fetch-depth: 0 | |
- name: Setup Env | |
uses: ./.github/actions/env | |
- run: > | |
earthly | |
--no-output | |
--allow-privileged | |
--secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY | |
--secret SEGMENT_WRITE_KEY=$SEGMENT_WRITE_KEY | |
--secret GITHUB_TOKEN=$GITHUB_TOKEN | |
--secret FURY_TOKEN=$FURY_TOKEN | |
--secret GORELEASER_KEY=$GORELEASER_KEY | |
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }} | |
+tests | |
env: | |
GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} | |
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }} | |
FURY_TOKEN: ${{ secrets.FURY_TOKEN }} | |
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} | |
Extract: | |
name: Extract | |
runs-on: "ubuntu-latest" | |
outputs: | |
components: ${{ steps.extract.outputs.components }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Extract service name | |
id: extract | |
run: echo "components=$(node .github/actions/find-directory/index.js)" >> $GITHUB_OUTPUT | |
GoReleaser: | |
runs-on: "ubuntu-latest" | |
if: contains(github.event.pull_request.labels.*.name, 'build-images') || github.ref == 'refs/heads/main' | |
needs: | |
- Extract | |
strategy: | |
matrix: | |
components: ${{ fromJson(needs.Extract.outputs.components) }} | |
steps: | |
- uses: earthly/actions-setup@v1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
version: "latest" | |
- uses: 'actions/checkout@v4' | |
with: | |
fetch-depth: 0 | |
- name: Setup Env | |
uses: ./.github/actions/env | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: "NumaryBot" | |
password: ${{ secrets.NUMARY_GITHUB_TOKEN }} | |
- run: > | |
earthly | |
--no-output | |
--allow-privileged | |
--secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY | |
--secret SEGMENT_WRITE_KEY=$SEGMENT_WRITE_KEY | |
--secret GITHUB_TOKEN=$GITHUB_TOKEN | |
--secret FURY_TOKEN=$FURY_TOKEN | |
--secret GORELEASER_KEY=$GORELEASER_KEY | |
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }} | |
+goreleaser --type=${{ matrix.components.type }} --components=${{ matrix.components.component }} --mode=ci | |
env: | |
GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} | |
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }} | |
FURY_TOKEN: ${{ secrets.FURY_TOKEN }} | |
SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY_OSS }} | |
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} | |
Deploy: | |
runs-on: "ubuntu-latest" | |
if: github.ref == 'refs/heads/main' | |
environment: | |
name: staging | |
permissions: | |
id-token: write | |
contents: read | |
needs: | |
- GoReleaser | |
- Main | |
steps: | |
- uses: earthly/actions-setup@v1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
version: "latest" | |
- uses: 'actions/checkout@v4' | |
with: | |
fetch-depth: 0 | |
- name: Setup Env | |
uses: ./.github/actions/env | |
- name: Install and configure kubectl | |
run: | | |
VERSION=$(curl --silent https://storage.googleapis.com/kubernetes-release/release/stable.txt) | |
curl https://storage.googleapis.com/kubernetes-release/release/$VERSION/bin/linux/amd64/kubectl \ | |
--progress-bar \ | |
--location \ | |
--remote-name | |
chmod +x kubectl | |
sudo mv kubectl /usr/local/bin/ | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::955332203423:role/github-access | |
aws-region: eu-west-1 | |
output-credentials: true | |
- name: Update kube config | |
run: aws eks update-kubeconfig --name staging-eu-west-1-hosting --region eu-west-1 | |
- run: kubectl config use-context arn:aws:eks:eu-west-1:955332203423:cluster/staging-eu-west-1-hosting | |
- name: Deploy in staging | |
run: | | |
kubectl set image deployment -n formance-system agent agent=ghcr.io/formancehq/agent:${GITHUB_SHA}-scratch | |
kubectl set image deployment -n formance-system operator operator=ghcr.io/formancehq/operator:${GITHUB_SHA}-scratch | |
kubectl patch Versions default -p "{\"spec\":{\"ledger\": \"${GITHUB_SHA}-scratch\"}}" --type=merge | |
kubectl patch Versions default -p "{\"spec\":{\"payments\": \"${GITHUB_SHA}-scratch\"}}" --type=merge | |
kubectl patch Versions default -p "{\"spec\":{\"auth\": \"${GITHUB_SHA}-scratch\"}}" --type=merge | |
kubectl patch Versions default -p "{\"spec\":{\"gateway\": \"${GITHUB_SHA}-scratch\"}}" --type=merge | |
kubectl patch Versions default -p "{\"spec\":{\"orchestration\": \"${GITHUB_SHA}-scratch\"}}" --type=merge | |
kubectl patch Versions default -p "{\"spec\":{\"reconciliation\": \"${GITHUB_SHA}-scratch\"}}" --type=merge | |
kubectl patch Versions default -p "{\"spec\":{\"search\": \"${GITHUB_SHA}-scratch\"}}" --type=merge | |
kubectl patch Versions default -p "{\"spec\":{\"stargate\": \"${GITHUB_SHA}-scratch\"}}" --type=merge | |
kubectl patch Versions default -p "{\"spec\":{\"wallets\": \"${GITHUB_SHA}-scratch\"}}" --type=merge | |
kubectl patch Versions default -p "{\"spec\":{\"webhooks\": \"${GITHUB_SHA}-scratch\"}}" --type=merge |