Skip to content

Commit 1bc0982

Browse files
authored
Merge pull request #780 from mlco2/feat/allow-multiple-runs-true
[Version 3] feat: allow_multiple_runs is true by default
2 parents ab080e6 + 344feb6 commit 1bc0982

File tree

143 files changed

+14616
-3676
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+14616
-3676
lines changed

.github/FUNDING.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# These are supported funding model platforms
2+
3+
github: mlco2 # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
#patreon: # Replace with a single Patreon username
5+
#open_collective: # Replace with a single Open Collective username
6+
#ko_fi: # Replace with a single Ko-fi username
7+
#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
#liberapay: # Replace with a single Liberapay username
10+
#issuehunt: # Replace with a single IssueHunt username
11+
#lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12+
#polar: # Replace with a single Polar username
13+
#buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14+
#thanks_dev: # Replace with a single thanks.dev username
15+
#custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/workflows/build-server.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: build server
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "carbonserver/**"
7+
- "pyproject.toml"
8+
push:
9+
paths:
10+
- "carbonserver/**"
11+
- "pyproject.toml"
12+
branches: [master]
13+
14+
jobs:
15+
build_server:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: 3.12
23+
- name: Clean pip cache
24+
run: pip cache purge
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
29+
- name: Unit tests on api
30+
run: |
31+
pip install hatch==1.13.0 hatchling==1.25.0
32+
hatch run api:test-unit
33+
34+
test_api_server:
35+
runs-on: ubuntu-latest
36+
# Service containers to run with `container-job`
37+
services:
38+
# Label used to access the service container
39+
postgres:
40+
# Docker Hub image
41+
image: postgres:16
42+
# Provide the password for postgres
43+
env:
44+
POSTGRES_DB: codecarbon_db
45+
POSTGRES_PASSWORD: supersecret
46+
POSTGRES_USER: codecarbon-user
47+
POSTGRES_HOST: localhost
48+
# Set health checks to wait until postgres has started
49+
options: >-
50+
--health-cmd pg_isready
51+
--health-interval 10s
52+
--health-timeout 5s
53+
--health-retries 5
54+
ports:
55+
- 5480:5432
56+
57+
steps:
58+
# Downloads a copy of the code in your repository before running CI tests
59+
- name: Check out repository code
60+
uses: actions/checkout@v4
61+
62+
# Performs a clean installation of all dependencies
63+
- name: Set up Python
64+
uses: actions/setup-python@v5
65+
with:
66+
python-version: 3.12
67+
- name: Install dependencies
68+
run: |
69+
python -m pip install --upgrade pip
70+
pip install hatch==1.13.0 hatchling==1.25.0
71+
72+
- name: Setup PostgreSQL
73+
# Runs a script that creates a PostgreSQL table, populates
74+
# the table with data, and then retrieves the data.
75+
run: hatch run api:setup-db
76+
77+
env:
78+
# The hostname used to communicate with the PostgreSQL service container
79+
DATABASE_URL: postgresql://codecarbon-user:supersecret@localhost:5480/codecarbon_db
80+
81+
- name: Run API tests
82+
env:
83+
CODECARBON_API_URL: http://localhost:8008
84+
# The hostname used to communicate with the PostgreSQL service container
85+
DATABASE_URL: postgresql://codecarbon-user:supersecret@localhost:5480/codecarbon_db
86+
run: |
87+
# hatch run api:server-ci &
88+
sleep 2
89+
# netstat -o -n -a | grep 8008
90+
# hatch run api:test-integ

.github/workflows/build-ui.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: build ui
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "webapp/**"
7+
- "pyproject.toml"
8+
push:
9+
paths:
10+
- "webapp/**"
11+
- "pyproject.toml"
12+
branches: [master]
13+
14+
jobs:
15+
build-ui:
16+
runs-on: ubuntu-22.04
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Use Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: "18"
23+
- name: Setup pnpm
24+
uses: pnpm/action-setup@v2
25+
with:
26+
version: 8
27+
- name: Install dependencies
28+
working-directory: ./webapp
29+
run: pnpm install
30+
- name: Build
31+
working-directory: ./webapp
32+
run: pnpm run build
33+
- name: Check formatting with Prettier
34+
working-directory: ./webapp
35+
run: pnpm exec prettier . --check

.github/workflows/build.yml

Lines changed: 0 additions & 192 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Deploy to Clever Cloud
2+
3+
on:
4+
push:
5+
paths:
6+
- "carbonserver/**"
7+
- "webapp/**"
8+
- "pyproject.toml"
9+
branches: [master]
10+
11+
jobs:
12+
production:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0 # Same as git fetch --unshallow
19+
clean: true # Remove any untracked files or modifications
20+
21+
- name: Install Clever Tools CLI
22+
run: |
23+
CC_VERSION=latest
24+
curl -s -O https://clever-tools.clever-cloud.com/releases/${CC_VERSION}/clever-tools-${CC_VERSION}_linux.tar.gz
25+
tar -xvf clever-tools-${CC_VERSION}_linux.tar.gz
26+
PATH=${PATH}:$(pwd)/clever-tools-${CC_VERSION}_linux
27+
28+
- name: Login to Clever Cloud
29+
env:
30+
CLEVER_TOKEN: ${{ secrets.CLEVER_TOKEN }}
31+
run: ./clever-tools-latest_linux/clever login --token ${{ secrets.CLEVER_TOKEN }} --secret ${{ secrets.CLEVER_SECRET }}
32+
33+
- name: Deploy backend to Clever Cloud (PROD)
34+
env:
35+
CLEVER_APP_ID: ${{ secrets.BE_CLEVER_APP_ID_PROD }}
36+
APP_NAME: cc_api_prod
37+
run: |
38+
./clever-tools-latest_linux/clever link $CLEVER_APP_ID
39+
./clever-tools-latest_linux/clever deploy -f -a $APP_NAME --quiet
40+
41+
- name: Deploy frontend to Clever Cloud (PROD)
42+
env:
43+
CLEVER_APP_ID: ${{ secrets.FE_CLEVER_APP_ID_PROD }}
44+
APP_NAME: cc_dashboard_prod
45+
run: |
46+
./clever-tools-latest_linux/clever link $CLEVER_APP_ID
47+
./clever-tools-latest_linux/clever deploy -f -a $APP_NAME --quiet

0 commit comments

Comments
 (0)