Skip to content

fix: fix poetry install in dockerfiles #78

fix: fix poetry install in dockerfiles

fix: fix poetry install in dockerfiles #78

Workflow file for this run

name: CI/CD
on:
pull_request:
branches: [ master ]
push:
branches: [ master ]
jobs:
commit-check:
name: Check Commit Messages
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed to fetch all history for checking commits
- name: "Check commit messages match angular style"
run: |
! git log origin/master..HEAD --oneline --pretty=format:%s | \
grep -Ev '^(build|chore|ci|docs|feat|fix|perf|style|refactor|test):|^Merge '
quality:
name: Quality Checks
needs: commit-check
runs-on: ubuntu-latest
strategy:
matrix:
task: [lint, test, build]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.12
# Skip Python setup for build task
if: matrix.task != 'build'
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Cache Python dependencies
# Skip cache for build task
if: matrix.task != 'build'
uses: actions/cache@v4
with:
path: ~/.cache/poetry
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install dependencies
# Skip dependencies for build task
if: matrix.task != 'build'
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry config virtualenvs.create false
poetry install
- name: Set up Docker
if: matrix.task == 'build'
uses: docker/setup-buildx-action@v3
- name: Set up Docker Compose
if: matrix.task == 'build'
run: |
docker compose version
- name: Run ${{ matrix.task }}
run: make ${{ matrix.task }}
- name: Generate Pylint Badge
if: matrix.task == 'lint' && github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
SCORE=$(pylint portfolio_analytics --output-format=text **/*.py | sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p')
echo "PYLINT_SCORE=$SCORE" >> $GITHUB_ENV
- name: Create Pylint Badge
if: matrix.task == 'lint' && github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: b149841cbef1088a8bf7671efee16734
filename: pylint.txt
label: Pylint
message: ${{ env.PYLINT_SCORE }}
color: ${{ env.PYLINT_SCORE >= 9 && 'brightgreen' || env.PYLINT_SCORE >= 7 && 'yellow' || 'red' }}
- name: Upload coverage reports
# Only run for test task
if: matrix.task == 'test'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: false # TODO: set to true
integration:
name: Integration Tests
needs: quality
runs-on: ubuntu-latest
strategy:
matrix:
component: [api, dashboard]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry config virtualenvs.create false
poetry install
- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Set up Docker Compose
run: |
docker compose version
- name: Start ${{ matrix.component }} service and run integration tests
run: make test-${{ matrix.component }}
release:
name: Release
needs: [commit-check, quality, integration]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry config virtualenvs.create false
poetry install
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: Semantic Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git pull --rebase
python -m semantic_release publish --patch