Skip to content

Commit

Permalink
Merge branch 'develop' into issues/7501/EmptyList
Browse files Browse the repository at this point in the history
  • Loading branch information
Sulochan-khadka authored Apr 11, 2024
2 parents 11d719d + d615772 commit 8af2d09
Show file tree
Hide file tree
Showing 233 changed files with 14,258 additions and 8,571 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
],
"tailwindcss/no-custom-classname": "off",
"tailwindcss/migration-from-tailwind-2": "error",
"tailwindcss/classnames-order": "error",
"tailwindcss/classnames-order": "off",
"tailwindcss/enforces-shorthand": "off",
"tailwindcss/no-contradicting-classname": "error"
},
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,21 @@ jobs:
max_attempts: 5
command: curl -o /dev/null -s -w "%{http_code}\n" http://localhost:9000
on_retry_command: sleep 5

- name: Determine PR Origin
id: pr_origin
run: echo "::set-output name=is_forked::$( echo ${{ github.event.pull_request.head.repo.fork }})"

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install dependencies 📦
run: npm install

- name: Build & Compile rescript files ⚙️
run: "npm run build"
run: npm run build

- name: Install Specific Chrome Version
run: |
Expand Down Expand Up @@ -117,4 +122,3 @@ jobs:
with:
name: cypress-videos
path: cypress/videos

152 changes: 56 additions & 96 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ on:
push:
branches:
- develop
- master
- staging
tags:
- v*
pull_request:
branches:
- develop
- master
- staging
workflow_dispatch:

concurrency:
Expand All @@ -29,25 +31,26 @@ jobs:
runs-on: ubuntu-latest
name: Test
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Cache Docker layers
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('package-lock.json', 'Dockerfile') }}
key: ${{ runner.os }}-buildx-test-${{ hashFiles('package-lock.json', 'Dockerfile') }}
restore-keys: |
${{ runner.os }}-buildx-
${{ runner.os }}-buildx-test-
- name: Test build
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: false
provenance: false
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new

Expand All @@ -60,132 +63,89 @@ jobs:
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
build-staging:
build:
needs: test
name: Build & Push Staging to container registries
if: github.ref == 'refs/heads/develop'
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/staging' || startsWith(github.event.ref, 'refs/tags/v')
name: Build & Push to container registries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Docker meta
- name: Generate docker tags
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
${{ secrets.DOCKER_HUB_USERNAME }}/${{ env.IMAGE_NAME }}
ghcr.io/${{ github.repository }}
${{ secrets.DOCKER_HUB_USERNAME }}/${{ github.event.repository.name }}
tags: |
type=raw,value=production-latest,enable=${{ github.ref == 'refs/heads/v*' }}
type=raw,value=production-latest-${{ github.run_number }}-{{date 'YYYYMMDD'}}-{{sha}},enable=${{ github.ref == 'refs/heads/v*' }}
type=raw,value=staging-latest,enable=${{ github.ref == 'refs/heads/staging' }}
type=raw,value=staging-latest-${{ github.run_number }}-{{date 'YYYYMMDD'}}-{{sha}},enable=${{ github.ref == 'refs/heads/staging' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/develop' }}
type=raw,value=latest-${{ github.run_number }}-{{date 'YYYYMMDD'}}-{{sha}}
type=raw,value=latest-${{ github.run_number }},enable=${{ github.ref == 'refs/heads/develop' }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
flavor: |
latest=true
latest=false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Setup QEMU
uses: docker/setup-qemu-action@v3

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('package-lock.json', 'Dockerfile') }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build image
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new

- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
build-production:
needs: test
name: Build & Push Production to container registries
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
${{ secrets.DOCKER_HUB_USERNAME }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=production-latest,enable=${{ github.ref == 'refs/heads/master' }}
type=raw,value=production-latest-${{ github.run_number }}-{{date 'YYYYMMDD'}}-{{sha}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
flavor: |
latest=false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Cache Docker layers
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('package-lock.json', 'Dockerfile') }}
key: ${{ runner.os }}-buildx-build-${{ hashFiles('package-lock.json', 'Dockerfile') }}
restore-keys: |
${{ runner.os }}-buildx-
${{ runner.os }}-buildx-build-
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build image
uses: docker/build-push-action@v3
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
provenance: false
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
notify-release:
needs: build
if: startsWith(github.event.ref, 'refs/tags/v')
name: Notify release
runs-on: ubuntu-latest
steps:
- name: Notify release
run: |
echo "Release ${{ github.sha }} is ready to be deployed to production"
deploy-staging-gcp:
needs: build-staging
needs: build
if: github.ref == 'refs/heads/staging'
name: Deploy to staging GCP cluster
runs-on: ubuntu-latest
environment:
Expand Down Expand Up @@ -231,7 +191,7 @@ jobs:
kubectl apply -f care-fe.yaml
deploy-production-manipur:
needs: build-production
needs: notify-release
name: Deploy to GKE Manipur
runs-on: ubuntu-latest
environment:
Expand Down Expand Up @@ -277,7 +237,7 @@ jobs:
kubectl apply -f care-fe.yaml
deploy-production-karnataka:
needs: build-production
needs: notify-release
name: Deploy to GKE Karnataka
runs-on: ubuntu-latest
environment:
Expand Down Expand Up @@ -323,7 +283,7 @@ jobs:
kubectl apply -f care-fe.yaml
deploy-production-sikkim:
needs: build-production
needs: notify-release
name: Deploy to GKE Sikkim
runs-on: ubuntu-latest
environment:
Expand Down Expand Up @@ -369,7 +329,7 @@ jobs:
kubectl apply -f care-fe.yaml
deploy-production-assam:
needs: build-production
needs: notify-release
name: Deploy to GKE Assam
runs-on: ubuntu-latest
environment:
Expand Down Expand Up @@ -415,7 +375,7 @@ jobs:
kubectl apply -f care-fe.yaml
deploy-production-nagaland:
needs: build-production
needs: notify-release
name: Deploy to GKE Nagaland
runs-on: ubuntu-latest
environment:
Expand Down Expand Up @@ -461,7 +421,7 @@ jobs:
kubectl apply -f care-fe.yaml
deploy-production-meghalaya:
needs: build-production
needs: notify-release
name: Deploy to GKE Meghalaya
runs-on: ubuntu-latest
environment:
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Create Release on Branch Push

on:
push:
branches:
- production

permissions:
contents: write

jobs:
release:
name: Release on Push
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Necessary to fetch all tags

- name: Calculate next tag
id: calc_tag
run: |
YEAR=$(date +"%y")
WEEK=$(date +"%V")
LAST_TAG=$(git tag -l "v$YEAR.$WEEK.*" | sort -V | tail -n1)
LAST_TAG=$(echo "$LAST_TAG" | tr -d '\r' | sed 's/[[:space:]]*$//')
echo "Last Tag: $LAST_TAG"
if [[ $LAST_TAG == "" ]]; then
MINOR=0
else
MINOR=$(echo $LAST_TAG | awk -F '.' '{print $NF}')
echo "Minor Version: $MINOR"
MINOR=$((MINOR + 1))
fi
TAG="v$YEAR.$WEEK.$MINOR"
echo "TAG=$TAG" >> $GITHUB_ENV
echo "Next Tag: $TAG"
- name: Configure git
run: |
git config user.name github-actions
git config user.email [email protected]
- name: Create and push tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git tag -a "$TAG" -m "Release $TAG"
git push origin "$TAG"
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "$TAG" \
--repo="$GITHUB_REPOSITORY" \
--title="$TAG" \
--generate-notes \
--draft
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

9 changes: 7 additions & 2 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"semi": true,
"jsxSingleQuote": false,
"arrowParens": "always",
"tailwindFunctions": ["classNames"]
}
"tailwindFunctions": [
"classNames"
],
"plugins": [
"prettier-plugin-tailwindcss"
]
}
Loading

0 comments on commit 8af2d09

Please sign in to comment.