最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Github actions to test python scripts after creating and activating conda environment not working - Stack Overflow

programmeradmin6浏览0评论

I have a repo where there are a bunch of python scripts, and there's a environment.yml file to create a conda environment with. I run tests by:

conda env create -f environment.yml
conda activate env_name
cd tests
pytest

I want to automate this with github actions. I have pytest.yml in .github/workflows/. It starts to run when I push, but it gets stuck with Waiting for a runner to pick up this job..., which I've understood to mean there's something wrong with my .yml file. pytest.yml contains (using this resource):

name: conda

on:
  workflow_dispatch:
  pull_request:
  push:
    branches:
      - main

jobs:
  tests:
    name: tests
    strategy:
      fail-fast: false
      matrix:
        platform: [windows-latest, macos-latest, ubuntu-latest]
        python-version: ['3.12']

    runs-on: $${{ matrix.platform }}

    steps:
    - uses: conda-incubator/setup-miniconda@v3
      with:
        miniconda-version: "latest"

    - name: tests
      run: |
        conda env create -f environment.yml
        conda activate price_predictor_env
        cd tests
        python -m pytest

What could I be missing?

I have a repo where there are a bunch of python scripts, and there's a environment.yml file to create a conda environment with. I run tests by:

conda env create -f environment.yml
conda activate env_name
cd tests
pytest

I want to automate this with github actions. I have pytest.yml in .github/workflows/. It starts to run when I push, but it gets stuck with Waiting for a runner to pick up this job..., which I've understood to mean there's something wrong with my .yml file. pytest.yml contains (using this resource):

name: conda

on:
  workflow_dispatch:
  pull_request:
  push:
    branches:
      - main

jobs:
  tests:
    name: tests
    strategy:
      fail-fast: false
      matrix:
        platform: [windows-latest, macos-latest, ubuntu-latest]
        python-version: ['3.12']

    runs-on: $${{ matrix.platform }}

    steps:
    - uses: conda-incubator/setup-miniconda@v3
      with:
        miniconda-version: "latest"

    - name: tests
      run: |
        conda env create -f environment.yml
        conda activate price_predictor_env
        cd tests
        python -m pytest

What could I be missing?

Share Improve this question asked 12 hours ago sodiumnitratesodiumnitrate 3,1337 gold badges32 silver badges58 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

You have double $ in the runs-on, so instead of:

...
    runs-on: $${{ matrix.platform }}
...

do

...
    runs-on: ${{ matrix.platform }}
...

According to this answer GitHub will not notify you of the error if one misspells the name of the platform to run on (sic)

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论