Disable cron stats #190
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: 💫 CI | |
on: | |
push: | |
branches: [master] | |
jobs: | |
test: | |
name: ☔️ Tests | |
runs-on: ubuntu-latest | |
container: golang:1.19 | |
# Setup postgres service for tests | |
services: | |
db: | |
image: postgres:14 | |
env: | |
POSTGRES_DB: testing | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
ports: | |
- 5432:5432 | |
# set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@master | |
- name: Run Tests | |
env: | |
DB_MOCK_HOST: db | |
DB_MOCK_PORT: 5432 | |
DB_MOCK_USER: postgres | |
DB_MOCK_PASS: postgres | |
DB_SSLMODE: disable | |
run: | | |
go test -v -parallel 1 $(go list -f '{{.Dir}}/...' -m | xargs) | |
build_and_publish: | |
name: ⚒️ Build and Publish Server | |
needs: test | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_RUN_ID: ${{ github.run_id }} | |
steps: | |
- uses: actions/checkout@master | |
- name: Get branch name (merge) | |
if: github.event_name != 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV | |
- name: Get branch name (pull request) | |
if: github.event_name == 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV | |
- name: Login to registry | |
if: success() | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
if: success() | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
platforms: linux/amd64 | |
push: true | |
file: ./apps/server/Dockerfile | |
tags: bananocoin/boompow-next:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }} | |
build_and_publish_moneybags: | |
name: ⚒️ Build and Publish Moneybags | |
needs: test | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_RUN_ID: ${{ github.run_id }} | |
steps: | |
- uses: actions/checkout@master | |
- name: Get branch name (merge) | |
if: github.event_name != 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV | |
- name: Get branch name (pull request) | |
if: github.event_name == 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV | |
- name: Login to registry | |
if: success() | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
if: success() | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
platforms: linux/amd64 | |
push: true | |
file: ./services/moneybags/Dockerfile | |
tags: bananocoin/boompow-payments:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }} | |
deploy_go: | |
name: 🥳 Deploy Server | |
needs: build_and_publish | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_RUN_ID: ${{ github.run_id }} | |
steps: | |
- uses: actions/checkout@master | |
- uses: imranismail/setup-kustomize@v1 | |
with: | |
kustomize-version: "3.5.4" | |
- name: Get branch name (merge) | |
if: github.event_name != 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV | |
- name: Get branch name (pull request) | |
if: github.event_name == 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV | |
- name: Set image | |
working-directory: ./kubernetes | |
run: | | |
kustomize edit set image replaceme=bananocoin/boompow-next:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }} | |
kustomize build . > go-deployment.yaml | |
- name: Deploy image to k8s cluster | |
uses: bbedward/kubectl@master | |
env: | |
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} | |
with: | |
args: apply -f ./kubernetes/go-deployment.yaml | |
deploy_cron: | |
name: 💰 Deploy Moneybags | |
needs: build_and_publish_moneybags | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_RUN_ID: ${{ github.run_id }} | |
steps: | |
- uses: actions/checkout@master | |
- uses: imranismail/setup-kustomize@v1 | |
with: | |
kustomize-version: "3.5.4" | |
- name: Get branch name (merge) | |
if: github.event_name != 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV | |
- name: Get branch name (pull request) | |
if: github.event_name == 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV | |
- name: Set image | |
working-directory: ./kubernetes/moneybags | |
run: | | |
kustomize edit set image replaceme=bananocoin/boompow-payments:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }} | |
kustomize build . > cron-deployment.yaml | |
- name: Deploy image to k8s cluster | |
uses: bbedward/kubectl@master | |
env: | |
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} | |
with: | |
args: apply -f ./kubernetes/moneybags/cron-deployment.yaml |