Skip to content

Remove index and vite dev task #13

Remove index and vite dev task

Remove index and vite dev task #13

Workflow file for this run

name: pipeline
on: push
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14.5
env:
POSTGRES_USER: postgresql
POSTGRES_PASSWORD: postgresql
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: install python dependencies
run: |
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
curl -sSL https://install.python-poetry.org | python3 -
poetry install
npm install --prefix web-components
- name: install postgres client
run: |
sudo apt-get update
sudo apt-get install --yes postgresql-client
- name: create test database
run: |
psql --host localhost --username postgresql < databases/drop_and_create_databases.sql
make migrate migrate-test
env:
PGPASSWORD: postgresql
DATABASE_URL: 'postgresql://localhost:5432/negotiator_test?user=negotiator&password=negotiator'
- name: run tests
env:
PORT: 8081
USE_FLASK_DEBUG_MODE: true
NEGOTIATOR_LOG_LEVEL: DEBUG
SECRET_KEY: 2vaR+Kp/SbVUQwZ73Uu7ul3OCCI=
DATABASE_URL: 'postgresql://localhost:5432/negotiator_test?user=negotiator&password=negotiator'
run: |
npm run build --prefix web-components
npm run test --prefix web-components
poetry run mypy negotiator tests
poetry run python -m unittest
google-cloud-build:
runs-on: ubuntu-latest
needs: [test]
permissions:
contents: "read"
id-token: "write"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: "install python dependencies"
run: |
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
curl -sSL https://install.python-poetry.org | python3 -
poetry install
npm install --prefix web-components
- uses: google-github-actions/setup-gcloud@v1
- uses: google-github-actions/auth@v1
with:
workload_identity_provider: "${{ secrets.GOOGLE_FEDERATION_WORKLOAD_IDENTITY_PROVIDER }}"
service_account: "${{ secrets.GOOGLE_FEDERATION_SERVICE_ACCOUNT }}"
- name: "build"
run: |-
sudo add-apt-repository ppa:cncf-buildpacks/pack-cli
sudo apt-get update
sudo apt-get install -y pack-cli
npm run build --prefix web-components
poetry export --without-hashes --format=requirements.txt > requirements.txt
pack build us-central1-docker.pkg.dev/${{ secrets.GOOGLE_PROJECT_ID }}/negotiator-review/negotiator:${{ github.sha }} --builder=gcr.io/buildpacks/builder:v1
gcloud auth configure-docker us-central1-docker.pkg.dev
docker push us-central1-docker.pkg.dev/${{ secrets.GOOGLE_PROJECT_ID }}/negotiator-review/negotiator:${{ github.sha }}
google-cloud-sql:
runs-on: ubuntu-latest
needs: [google-cloud-build]
permissions:
contents: "read"
id-token: "write"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: install python dependencies
run: |
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
curl -sSL https://install.python-poetry.org | python3 -
poetry install
npm install --prefix web-components
- name: install postgres client
run: |
sudo apt-get update
sudo apt-get install --yes postgresql-client
- uses: google-github-actions/setup-gcloud@v1
- uses: google-github-actions/auth@v1
with:
workload_identity_provider: "${{ secrets.GOOGLE_FEDERATION_WORKLOAD_IDENTITY_PROVIDER }}"
service_account: "${{ secrets.GOOGLE_FEDERATION_SERVICE_ACCOUNT }}"
- name: cloud-sql-proxy
run: |
curl https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/v2.0.0-preview.0/cloud-sql-proxy.linux.amd64 --output cloud-sql-proxy
chmod +x cloud-sql-proxy
sudo mv cloud-sql-proxy /usr/bin/cloud-sql-proxy
- name: migrate
env:
DATABASE_URL: ${{ secrets.REVIEW_MIGRATE_URL }}
run: |
cloud-sql-proxy --port 6000 ${{ secrets.GOOGLE_PROJECT_ID }}:us-central1:negotiator-review &
sleep 6
make migrate
google-cloud-run:
runs-on: ubuntu-latest
needs: [google-cloud-sql]
permissions:
contents: "read"
id-token: "write"
steps:
- uses: actions/checkout@v3
- uses: google-github-actions/setup-gcloud@v1
- uses: google-github-actions/auth@v1
with:
workload_identity_provider: "${{ secrets.GOOGLE_FEDERATION_WORKLOAD_IDENTITY_PROVIDER }}"
service_account: "${{ secrets.GOOGLE_FEDERATION_SERVICE_ACCOUNT }}"
- name: deploy
run: |-
gcloud run deploy negotiator-review \
--image us-central1-docker.pkg.dev/${{ secrets.GOOGLE_PROJECT_ID }}/negotiator-review/negotiator:${{ github.sha }} \
--region us-central1 \
--platform managed