首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安装诗歌与吉突行动,诗歌命令找不到。不能在道路上增添诗意

安装诗歌与吉突行动,诗歌命令找不到。不能在道路上增添诗意
EN

Stack Overflow用户
提问于 2022-02-11 07:04:58
回答 2查看 2.8K关注 0票数 1

我正在为CICD学习Github行动的基础知识。我用诗歌来做属地管理。但我一直在扔poetry: command not found。如果我在每一步都运行source $HOME/.poetry/env (用我有限的知识打开新的shell ),它就能工作。我试图用.bashrc修改cat $HOME/.poetry/env >> ~/.bashrc,但它不起作用。

这是我的Yaml文件,谢谢^^

代码语言:javascript
复制
name: Django CI
on:
  push:
    branches:
      - master
      - develop
  pull_request:
    branches:
      # - develop
      - master

jobs:
  Unit tests:
    runs-on: ubuntu-latest
    strategy: # Strategy
      max-parallel: 4
      matrix:
        python-version: [3.8]
    services:
      postgres:
        image: postgres:latest
        env:
          POSTGRES_DB: postgres
          POSTGRES_PASSWORD: postgres
          POSTGRES_USER: postgres
        ports:
          - 5432:5432
    steps:
      - name: Checkout Github repo
        uses: actions/checkout@v2
      - name: Set up Python 3.8
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install Dependencies
        run: |
          curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
          source $HOME/.poetry/env
          cat $HOME/.poetry/env >> ~/.bashrc
          poetry install
          echo "OK"
      - name: Run unit tests
        run: |
          # If I run "source $HOME/.poetry/env", It works
          poetry run python manage.py test
EN

回答 2

Stack Overflow用户

发布于 2022-04-05 15:51:08

您最好使用这一行动安装诗歌并安装venv。

这是我在我的项目中使用的东西。它包括整个venv的缓存。缓存由于不同的Python版本和/或poetry.lock中的修改而失效。

代码语言:javascript
复制
    - name: Install and configure Poetry
      uses: snok/install-poetry@v1
      with:
        version: 1.1.13
        virtualenvs-create: true
        virtualenvs-in-project: true
    - name: Set up cache
      uses: actions/cache@v2
      id: cached-poetry-dependencies
      with:
        path: .venv
        key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
    - name: Install dependencies
      run: poetry install
      if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
票数 1
EN

Stack Overflow用户

发布于 2022-02-11 08:03:34

请注意,来自这条线

Github操作在非交互模式下调用bash脚本,默认情况下它不会加载.bashrc

只有将来源于 (您有一些其他替代办法)。

或者您需要显式地获取它:

代码语言:javascript
复制
source $HOME/.poetry/env
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71076272

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档