Merge pull request #3018 from mozilla/fix-circleci-config

Fix Circle CI Deploy
This commit is contained in:
mansaj 2023-05-02 15:45:22 -07:00 коммит произвёл GitHub
Родитель 01e7208f74 c9590e649b
Коммит 8400271149
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 3 добавлений и 80 удалений

Просмотреть файл

@ -65,77 +65,6 @@ jobs:
command: |
moz-l10n-lint l10n.toml
compare-locales l10n.toml . `ls locales`
unit-tests:
executor: ubuntu
environment:
DATABASE_URL: postgresql://postgres:test-pass@localhost/blurts
steps:
- checkout
- run:
name: Install Postgres
# Installing Postgres on a host machine.
# Originally attempted to use a container, but communication between container-within-a-container is not well supported currently
# The solutions here were attempted without success: https://stackoverflow.com/questions/48546124/what-is-linux-equivalent-of-host-docker-internal
command: |
sudo apt-get update
sudo apt-get install postgresql
pg_isready
- run:
name: Create test database
command: |
sudo -u postgres createdb test-blurts | cat
# Set password to allow Docker connection
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'test-pass';" | cat
- run:
name: Build app container
command: docker build -t blurts-server .
- run:
name: Test Code
command: |
docker run --network="host" \
-e NODE_ENV=tests \
-e DATABASE_URL=$DATABASE_URL \
-e HIBP_KANON_API_TOKEN=$HIBP_KANON_API_TOKEN \
-e COVERALLS_SERVICE_NAME=circleci \
-e COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN \
-e COVERALLS_GIT_BRANCH=$CIRCLE_BRANCH \
blurts-server npm test
unit-tests-psql:
parameters:
postgres_version:
description: "Which cimg/postgres tag to use"
type: string
executor:
name: node_with_postgres
postgres_version: << parameters.postgres_version >>
steps:
- checkout
- node/install-packages
- run: sudo apt-get update
- run: sudo apt-get install postgresql-client
- run:
name: install dockerize
command: wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
environment:
DOCKERIZE_VERSION: v0.6.1
- run:
name: Wait for db
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run:
name: Use default .env
command: cp .env-dist .env
- run:
name: Test Code
command: |
NODE_ENV=tests \
DATABASE_URL=postgresql://postgres:93e389316eaf4ea2be4010d526cc1468@localhost/circle \
HIBP_KANON_API_TOKEN=$HIBP_KANON_API_TOKEN \
COVERALLS_SERVICE_NAME=circleci \
COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN \
COVERALLS_GIT_BRANCH=$CIRCLE_BRANCH \
npm test
deploy:
docker:
- image: docker:stable-git
@ -212,7 +141,7 @@ jobs:
git push -f $heroku_url $CIRCLE_BRANCH:main
workflows:
lint-and-test:
lint-and-deploy:
jobs:
- lint-js
- lint-css
@ -224,14 +153,8 @@ workflows:
tags:
only: /.*/
branches:
only:
- main
# - deploy_static:
# disabled because we no longer use the old logo path or CDN
# filters:
# branches:
# only:
# - main
only: main
- deploy_heroku:
name: Deploy main to Heroku
app-name: $HEROKU_MAIN_APP_NAME