Improved RPM getter and overall service performance #37
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: Master CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build-test: | |
name: Build & Test | |
runs-on: ubuntu-latest | |
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" | |
concurrency: ci-${{ github.ref }} | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Start MongoDB | |
uses: supercharge/[email protected] | |
with: | |
mongodb-version: 6.0 | |
- name: Install dependencies | |
run: npm install | |
- name: Lint | |
run: npm run lint | |
- name: Run tests | |
run: npm test | |
env: | |
NODE_OPTIONS: "--experimental-vm-modules" | |
MONGODB_URI: mongodb://127.0.0.1:27017/switcher-api-test | |
JWT_CLIENT_TOKEN_EXP_TIME: 5m | |
JWT_SECRET: ${{ secrets.JWT_SECRET }} | |
RELAY_BYPASS_HTTPS: true | |
RELAY_BYPASS_VERIFICATION: true | |
METRICS_ACTIVATED: true | |
MAX_REQUEST_PER_MINUTE: 0 | |
SWITCHER_API_ENABLE: false | |
SWITCHER_API_LOGGER: false | |
- name: SonarCloud Scan | |
uses: sonarsource/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
docker: | |
name: Publish Docker Image | |
needs: [ build-test ] | |
runs-on: ubuntu-latest | |
if: success() && github.ref == 'refs/heads/master' | |
outputs: | |
digest: ${{ steps.docker_build.outputs.digest }} | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: trackerforce/switcher-resolver-node:latest | |
update-kustomize: | |
name: Deploy | |
needs: [ docker ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: 'master' | |
- name: Checkout Kustomize | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.ARGOCD_PAT }} | |
repository: switcherapi/switcher-deployment | |
ref: master | |
- name: Set up arkade-get | |
uses: alexellis/arkade-get@master | |
with: | |
kubectl: latest | |
kustomize: latest | |
- name: Update GitOps repository | |
run: | | |
cd switcher-resolver-node/base | |
echo RELEASE_TIME=`date` > environment-properties.env | |
kustomize edit set image trackerforce/switcher-resolver-node:latest=trackerforce/switcher-resolver-node@${{ needs.docker.outputs.digest }} | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
git config --global user.name "${{ github.actor }}" | |
git add . | |
git commit -m "[argocd] switcher-resolver-node: ${{ needs.docker.outputs.digest }}" | |
git push |