Home > Blockchain >  How do I enable GitHub-hosted runners for a GitHub Action?
How do I enable GitHub-hosted runners for a GitHub Action?

Time:08-16

I created a workflow for my Python repo as follows:

name: Python package

on: [push, pull_request]
jobs:
  build:
    runs-on: [ubuntu-latest, macos-latest]
    strategy:
      fail-fast: false
      matrix:
        python-version: ["3.7", "3.8", "3.9", "3.10"]
    steps:
    - uses: actions/checkout@v3
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v3
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install flake8 pytest semver
        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
    - name: Lint with flake8
      run: |
        # stop the build if there are Python syntax errors or undefined names
        flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
        # exit-zero treats all errors as warnings.
        flake8 . --count --exit-zero --max-complexity=10 --ignore=E501 --statistics
    - name: Test with pytest
      run: |
        pytest

Unfortunately, the action never runs and times out with the error:

This request was automatically failed because there were no enabled runners online to process the request for more than 1 days.

Did I do something silly in the configuration file?

I'm currently on a free GitHub account. Are GitHub-hosted runners available on free accounts? If so how do I enable one of those?

CodePudding user response:

Turns out

runs-on: [ubuntu-latest, macos-latest]

doesn't run the action on each platforms. Instead it tries to find a runner that satisfies both conditions, i.e. running on ubuntu-latest and macos-latest which is, of course, never found.

The way to so what I originally intended is to, instead, do a two-dimensional matrix for os and python-version.

  • Related