Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Merges app-rewrite branch to master #1

Merged
merged 12 commits into from
Oct 26, 2022
Prev Previous commit
Next Next commit
ignore more CI
  • Loading branch information
tonypls committed Oct 26, 2022
commit 077740e0b56865745199db72ac042562e899a4b8
207 changes: 104 additions & 103 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,109 +1,110 @@
version: 2.1
# version: 2.1

executors:
js-exec:
docker:
- image: cimg/node:16.15
# executors:
# js-exec:
# docker:
# - image: cimg/node:16.15

jobs:
verify_python:
docker:
- image: circleci/python:3.8.12
steps:
- checkout
- restore_cache:
key: venv-{{ checksum "poetry.lock" }}
- run:
name: Upgrade pip
command: sudo pip install -q --upgrade pip
- run:
name: Install dependencies
command: |
set -eux -o pipefail
sudo apt-get update
sudo apt-get install libxml2-dev tesseract-ocr tesseract-ocr-eng
poetry install -E parsers
- run:
name: Verify changes
command: |
set -eux -o pipefail
poetry run check
- save_cache:
key: venv-{{ checksum "poetry.lock" }}
paths:
- ".venv"
# jobs:
# verify_python:
# docker:
# - image: circleci/python:3.8.12
# steps:
# - checkout
# - restore_cache:
# key: venv-{{ checksum "poetry.lock" }}
# - run:
# name: Upgrade pip
# command: sudo pip install -q --upgrade pip
# - run:
# name: Install dependencies
# command: |
# set -eux -o pipefail
# sudo apt-get update
# sudo apt-get install libxml2-dev tesseract-ocr tesseract-ocr-eng
# poetry install -E parsers
# - run:
# name: Verify changes
# command: |
# set -eux -o pipefail
# poetry run check
# - save_cache:
# key: venv-{{ checksum "poetry.lock" }}
# paths:
# - ".venv"

lint_json:
executor: js-exec
steps:
- checkout
- run:
command: |
npm install -g jsonlint-mod
jsonlint -q web/public/locales/*.json
# lint_json:
# executor: js-exec
# steps:
# - checkout
# - run:
# command: |
# npm install -g jsonlint-mod
# jsonlint -q web/public/locales/*.json

verify_web_js:
executor: js-exec
steps:
- checkout
- restore_cache:
key: node_modules-{{ .Branch }}-{{ checksum "web/yarn.lock" }}
- run:
command: |
set -eux -o pipefail
cd web
yarn install --frozen-lockfile
yarn verify
- save_cache:
key: node_modules-{{ .Branch }}-{{ checksum "web/yarn.lock" }}
paths:
- web/node_modules
# verify_web_js:
# executor: js-exec
# steps:
# - checkout
# - restore_cache:
# key: node_modules-{{ .Branch }}-{{ checksum "web/yarn.lock" }}
# - run:
# command: |
# set -eux -o pipefail
# cd web
# yarn install --frozen-lockfile
# yarn verify
# - save_cache:
# key: node_modules-{{ .Branch }}-{{ checksum "web/yarn.lock" }}
# paths:
# - web/node_modules

build_test:
machine:
image: ubuntu-2004:202201-02
docker_layer_caching: true
steps:
- checkout
- run:
name: Build
command: |
set -euo pipefail
docker-compose build web
# Make sure files are available outside of container
CONTAINER_ID=$(docker create eu.gcr.io/tmrow-152415/electricitymap_web:latest)
docker cp $CONTAINER_ID:/home/src/electricitymap/contrib/web/public/dist web/public/dist
no_output_timeout: 30m
- run:
name: Start environment
command: |
set -euo pipefail
# Only start the `web` container
# and avoid the `watch` container from starting and compiling
# the already built frontend
docker-compose up -d web
sleep 20
docker-compose logs web
- run:
name: Run tests
command: |
docker-compose ps
curl --fail -i http:https://localhost:8000/
curl --fail -i http:https://localhost:8000/v1/co2?countryCode=FR
curl --fail -i http:https://localhost:8000/v1/exchanges?countryCode=FR
curl --fail -i http:https://localhost:8000/v1/production?countryCode=FR
curl --fail -i http:https://localhost:8000/v1/price?countryCode=FR
curl --fail -i http:https://localhost:8000/v2/history?countryCode=FR
# build_test:
# machine:
# image: ubuntu-2004:202201-02
# docker_layer_caching: true
# steps:
# - checkout
# - run:
# name: Build
# command: |
# set -euo pipefail
# docker-compose build web
# # Make sure files are available outside of container
# CONTAINER_ID=$(docker create eu.gcr.io/tmrow-152415/electricitymap_web:latest)
# docker cp $CONTAINER_ID:/home/src/electricitymap/contrib/web/public/dist web/public/dist
# no_output_timeout: 30m
# - run:
# name: Start environment
# command: |
# set -euo pipefail
# # Only start the `web` container
# # and avoid the `watch` container from starting and compiling
# # the already built frontend
# docker-compose up -d web
# sleep 20
# docker-compose logs web
# - run:
# name: Run tests
# command: |
# docker-compose ps
# curl --fail -i http:https://localhost:8000/
# curl --fail -i http:https://localhost:8000/v1/co2?countryCode=FR
# curl --fail -i http:https://localhost:8000/v1/exchanges?countryCode=FR
# curl --fail -i http:https://localhost:8000/v1/production?countryCode=FR
# curl --fail -i http:https://localhost:8000/v1/price?countryCode=FR
# curl --fail -i http:https://localhost:8000/v2/history?countryCode=FR

workflows:
version: 2
# all:
# jobs:
# - verify_python
# - verify_web_js
# - lint_json
# - build_test:
# requires:
# - verify_python
# - verify_web_js
# - lint_json
# workflows:
# version: 2
# all:
# jobs:
# - ignore-branch
# - verify_python
# - verify_web_js
# - lint_json
# - build_test:
# requires:
# - verify_python
# - verify_web_js
# - lint_json
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ jobs:
echo "workflows changed: ${{ steps.check-workflows.outputs.any_changed }}"

# Repository wide checks
prettier:
name: Prettier
uses: ./.github/workflows/prettier.yml
# prettier:
# name: Prettier
# uses: ./.github/workflows/prettier.yml

validate_local_links:
name: Validate Markdown
Expand Down