Skip to content

Started new colors #187

Started new colors

Started new colors #187

Workflow file for this run

name: Main
on: push
# branches: [ master, deploy, github-actions ]
env:
PYTHON_VERSION: 3.10.5
jobs:
requirements_txt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: ${{ env.PYTHON_VERSION }}
- run: pip install poetry
- name: Export requirements
run: poetry export -o requirements.txt
- name: Export dev requirements (for tests)
run: poetry export --dev -o requirements.dev.txt
- name: Store requirements.txt file
uses: actions/upload-artifact@v3
with:
name: requirements.txt
path: requirements.txt
- name: Store requirements.dev.txt file
uses: actions/upload-artifact@v3
with:
name: requirements.dev.txt
path: requirements.dev.txt
tests:
runs-on: ubuntu-latest
needs: [requirements_txt]
env:
POSTGRES_USER: trip_planner
POSTGRES_PASSWORD: trip_planner
POSTGRES_DB: trip_planner
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: requirements.dev.txt
- uses: actions/setup-python@v3
with:
python-version: ${{ env.PYTHON_VERSION }}
- run: pip install -r requirements.dev.txt
- name: Tests
run: python -m pytest
env:
TESTDB: ${{ format('postgresql://{0}:{1}@localhost/{2}', env.POSTGRES_USER, env.POSTGRES_PASSWORD, env.POSTGRES_DB) }}
services:
postgres:
image: postgres:10
env:
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ env.POSTGRES_DB }}
ports:
- 5432:5432
assets:
runs-on: ubuntu-latest
env:
NODE_ENV: production
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16.19.0
uses: actions/setup-node@v3
with:
node-version: 16.19.0
cache: yarn
- run: yarn install --immutable --check-cache
- run: yarn rollup
- name: Store compiled assets
uses: actions/upload-artifact@v3
with:
name: assets
path: trip_planner/static/assets
docker:
runs-on: ubuntu-latest
needs: [requirements_txt, assets, tests]
if: github.ref_type == 'tag' || github.ref_name == 'main' || github.ref_name == 'master' || github.ref_name == 'deploy' || github.ref_name == 'github-actions'
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: actions/download-artifact@v3
with:
name: assets
path: trip_planner/static/assets
- uses: actions/download-artifact@v3
with:
name: requirements.txt
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_LOGIN }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ format('{0}/trip_planner:{1}', secrets.DOCKERHUB_LOGIN, github.ref_name) }}