Skip to content

Commit

Permalink
Merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
lemilonkh committed Mar 21, 2024
2 parents a6506aa + 414a168 commit 861f335
Show file tree
Hide file tree
Showing 88 changed files with 20,018 additions and 5,597 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/global-api-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- k8s/cc-global-api.yml
- k8s/cc-global-api-migrate.yml
tags:
- 'v*'
- '^v\d+\.\d+\.\d+$'

jobs:

Expand Down
33 changes: 20 additions & 13 deletions .github/workflows/web-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,25 @@ jobs:
- name: Run tests and generate coverage file
run: npm run ci:test

- name: Setup LCOV
uses: hrishikesh-kadam/setup-lcov@v1
- name: Report code coverage
uses: zgosalvez/github-actions-report-lcov@v3
with:
coverage-files: ./app/lcov*.info
minimum-coverage: 40
artifact-name: code-coverage-report
github-token: ${{ secrets.GITHUB_TOKEN }}
working-directory: ./app
update-comment: true
# - name: Setup LCOV
# uses: hrishikesh-kadam/setup-lcov@v1
# - name: Report code coverage
# uses: zgosalvez/github-actions-report-lcov@v3
# with:
# coverage-files: ./app/lcov*.info
# minimum-coverage: 40
# artifact-name: code-coverage-report
# github-token: ${{ secrets.GITHUB_TOKEN }}
# working-directory: ./app
# update-comment: true

- name: Upload coverage reports to Codecov
continue-on-error: true
uses: codecov/codecov-action@v4.0.1
with:
fail_ci_if_error: false
flags: unittests
name: citycatalyst-backend
token: ${{ secrets.CODECOV_TOKEN }}
slug: Open-Earth-Foundation/CityCatalyst

Expand Down Expand Up @@ -126,8 +130,11 @@ jobs:
kubectl set env deployment/cc-web-deploy SMTP_PASSWORD=${{secrets.SMTP_PASSWORD}}
kubectl set env deployment/cc-web-deploy NEXTAUTH_SECRET=${{secrets.NEXTAUTH_SECRET}}
kubectl set env deployment/cc-web-deploy RESET_TOKEN_SECRET=${{secrets.RESET_TOKEN_SECRET}}
kubectl set env deployment/cc-web-deploy CHAT_PROVIDER=huggingface
kubectl set env deployment/cc-web-deploy VERIFICATION_TOKEN_SECRET=${{secrets.VERIFICATION_TOKEN_SECRET}}
kubectl set env deployment/cc-web-deploy CHAT_PROVIDER=openai
kubectl set env deployment/cc-web-deploy OPENAI_API_KEY=${{secrets.OPENAI_API_KEY}}
kubectl set env deployment/cc-web-deploy HUGGINGFACE_API_KEY=${{secrets.HUGGINGFACE_API_KEY}}
kubectl set env deployment/cc-web-deploy "DEFAULT_ADMIN_EMAIL=${{secrets.DEFAULT_ADMIN_EMAIL}}"
kubectl set env deployment/cc-web-deploy "DEFAULT_ADMIN_PASSWORD=${{secrets.DEFAULT_ADMIN_PASSWORD}}"
kubectl create -f k8s/cc-create-admin.yml -n default
kubectl rollout restart deployment cc-web-deploy -n default
61 changes: 30 additions & 31 deletions .github/workflows/web-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ on:
- k8s/cc-migrate.yml
- k8s/cc-web-deploy.yml
- k8s/cc-web.yml
- .github/workflows/web-actions.yml
- .github/workflows/web-tag.yml
tags:
- 'v*'
- '^v\d+\.\d+\.\d+$'

jobs:
runTests:
Expand All @@ -28,7 +28,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache: "npm"
cache-dependency-path: app/package-lock.json

- name: Install dependencies
Expand Down Expand Up @@ -59,34 +59,33 @@ jobs:
needs: runTests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pushing citycatalyst to GHCR
env:
SHA: ${{ github.sha }}
REF: ${{ github.ref }}
IMAGE: ghcr.io/open-earth-foundation/citycatalyst
- name: Pushing citycatalyst to GHCR
env:
SHA: ${{ github.sha }}
REF: ${{ github.ref }}
IMAGE: ghcr.io/open-earth-foundation/citycatalyst

run: |
export VERSION=${REF#refs/tags/v}
export MAJOR=${VERSION%.*.*}
export MINOR=${VERSION%.*}
echo Version: ${VERSION} Major: ${MAJOR} Minor: ${MINOR}
docker build -t $IMAGE:$SHA app
docker tag $IMAGE:$SHA $IMAGE:$VERSION
docker tag $IMAGE:$SHA $IMAGE:$MAJOR
docker tag $IMAGE:$SHA $IMAGE:$MINOR
docker tag $IMAGE:$SHA $IMAGE:stable
docker push $IMAGE:$SHA
docker push $IMAGE:$VERSION
docker push $IMAGE:$MAJOR
docker push $IMAGE:$MINOR
docker push $IMAGE:stable
run: |
export VERSION=${REF#refs/tags/v}
export MAJOR=${VERSION%.*.*}
export MINOR=${VERSION%.*}
echo Version: ${VERSION} Major: ${MAJOR} Minor: ${MINOR}
docker build -t $IMAGE:$SHA app
docker tag $IMAGE:$SHA $IMAGE:$VERSION
docker tag $IMAGE:$SHA $IMAGE:$MAJOR
docker tag $IMAGE:$SHA $IMAGE:$MINOR
docker tag $IMAGE:$SHA $IMAGE:stable
docker push $IMAGE:$SHA
docker push $IMAGE:$VERSION
docker push $IMAGE:$MAJOR
docker push $IMAGE:$MINOR
docker push $IMAGE:stable
1 change: 1 addition & 0 deletions app/env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ VERIFICATION_TOKEN_SECRET="80c70dfdeedf2c01757b880d39c79214e915c786dd48d5473c9c0
HUGGINGFACE_API_KEY=hf_MY_SECRET_KEY
OPENAI_API_KEY=sk-MY_SECRET_KEY
CHAT_PROVIDER=huggingface
NEXT_PUBLIC_OPENCLIMATE_API_URL="https://openclimate.openearth.dev"
53 changes: 53 additions & 0 deletions app/migrations/20240213184421-city-invite.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
'use strict';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up (queryInterface, Sequelize) {
await queryInterface.createTable('CityInvite', {
id: {
type: Sequelize.UUID,
primaryKey:true,
},
city_id: {
type: Sequelize.UUID,
allowNull: true,
references: {
model:'City',
key: 'city_id'
}
},
user_id: {
type: Sequelize.STRING,
allowNull:true,
},
inviting_user_id: {
type: Sequelize.UUID,
allowNull: true,
references: {
model:'User',
key: 'user_id'
}
},
status: {
type: Sequelize.STRING,
allowNull:false,
defaultValue: 'pending'
},
created: {
type: Sequelize.DATE,
allowNull: true,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
},
last_updated: {
type: Sequelize.DATE,
allowNull: true,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
onUpdate: Sequelize.literal('CURRENT_TIMESTAMP'),
}
})
},

async down (queryInterface, Sequelize) {
await queryInterface.dropTable('CityInvite');
}
};
22 changes: 22 additions & 0 deletions app/migrations/20240308152708-add-cityId-to-userFile.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

/** @type {import('sequelize-cli').Migration} */

module.exports = {
async up (queryInterface, Sequelize) {
await queryInterface.addColumn('UserFile', 'city_id', {
type: Sequelize.UUID,
allowNull: true,
references: {
model: 'City',
key: 'city_id',
},
onUpdate: 'CASCADE',
onDelete: 'SET NULL',
});
},

async down (queryInterface, Sequelize) {
await queryInterface.removeColumn('UserFile', 'city_id');
}
};
16 changes: 16 additions & 0 deletions app/migrations/20240318105130-region-population.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use strict";

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.addColumn(
"Population",
"region_population",
Sequelize.BIGINT,
);
},

async down(queryInterface) {
await queryInterface.removeColumn("Population", "region_population");
},
};
Loading

0 comments on commit 861f335

Please sign in to comment.