Skip to content

Commit

Permalink
fix poetry install
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaYurasov committed Dec 21, 2024
1 parent 67c78ba commit 626c837
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
17 changes: 5 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.10", "3.11" ]
airflow-version: [ "2.6.3", "2.7.3", "2.8.4", "2.9.3", "2.10.0", "2.10.1", "2.10.2", "2.10.3", "2.10.4" ]
python-version: [ "3.10", "3.11" ]
steps:
- uses: actions/checkout@v4

Expand All @@ -26,16 +26,9 @@ jobs:
--target airflow-dbt-af-ci \
-t dbt-af-${{ matrix.airflow-version }}-py${{ matrix.python-version }}-ci \
.
- name: Run Docker container
- name: Run tests in container
run: |
docker run \
-d \
--name dbt-af-container-${{ matrix.airflow-version }}-py${{ matrix.python-version }}-ci \
dbt-af-${{ matrix.airflow-version }}-py${{ matrix.python-version }}-ci
- name: Run tests
run: |
docker exec \
dbt-af-container-${{ matrix.airflow-version }}-py${{ matrix.python-version }}-ci \
airflow db migrate && \
pytest -q -s -vv --log-cli-level=INFO --cov=dbt_af --cov-report=term --run-airflow-tasks tests
--entrypoint="" \
dbt-af-${{ matrix.airflow-version }}-py${{ matrix.python-version }}-ci \
airflow db migrate && pytest -q -s -vv --log-cli-level=INFO --cov=dbt_af --cov-report=term --run-airflow-tasks tests
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,23 @@ ENV POETRY_VERSION="1.8.5" \
POETRY_HOME="/opt/poetry" \
POETRY_CACHE_DIR="/opt/poetry/.cache" \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_PREFER_ACTIVE_PYTHON=true \
# https://github.com/python-poetry/poetry/issues/6301 \
POETRY_EXPERIMENTAL_NEW_INSTALLER=false \
POETRY_UID=$POETRY_UID \
POETRY_GID=$POETRY_GID
# install poetry - respects $POETRY_VERSION & $POETRY_HOME
RUN curl -sSL https://install.python-poetry.org | python - \
&& mkdir -p "${POETRY_CACHE_DIR}" \
&& chown -R "poetry:poetry" "${POETRY_CACHE_DIR}"

USER airflow
RUN pip install --user pipx \
pipx ensurepath
# install poetry
RUN pipx install "poetry==${POETRY_VERSION}"

ENV PATH="$POETRY_HOME/bin:$PATH"

WORKDIR ${AIRFLOW_HOME}/dbt_af
COPY --chown=airflow:0 ./tests ${AIRFLOW_HOME}/dbt_af/tests
COPY --chown=airflow:0 ./poetry.lock ${AIRFLOW_HOME}/dbt_af/poetry.lock

USER airflow
RUN poetry export --with=dev --without-hashes --format=requirements.txt > requirements.txt \
&& pip install -r requirements.txt

0 comments on commit 626c837

Please sign in to comment.