如何不允许一起使用某些矩阵 [英] How to not Allow Some Matrices Together

查看:33
本文介绍了如何不允许一起使用某些矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在工作流程文件中配置了矩阵,如下所示:

I've configured my matrices in my workflow file as below:

matrix:
  python-version: [3.5, 3.6, 3.7]
  django-version: [1.11, 2.0, 2.1, 2.2]

其中一些自然会在测试中失败,特别是Python 3.7和Django 1.11,并在下面显示输出(如果相关):

Some of these naturally fail on testing, specifically Python 3.7 and Django 1.11, giving the output below (if relevant):

  File "/opt/hostedtoolcache/Python/3.7.5/x64/lib/python3.7/site-packages/django/contrib/admin/__init__.py", line 4, in <module>
    from django.contrib.admin.filters import (
  File "/opt/hostedtoolcache/Python/3.7.5/x64/lib/python3.7/site-packages/django/contrib/admin/filters.py", line 10, in <module>
    from django.contrib.admin.options import IncorrectLookupParameters
  File "/opt/hostedtoolcache/Python/3.7.5/x64/lib/python3.7/site-packages/django/contrib/admin/options.py", line 12, in <module>
    from django.contrib.admin import helpers, widgets
  File "/opt/hostedtoolcache/Python/3.7.5/x64/lib/python3.7/site-packages/django/contrib/admin/widgets.py", line 151
    '%s=%s' % (k, v) for k, v in params.items(),

因此,我需要以某种方式告诉Github Actions:如果Python是3.7 Django是1.11,则取消.".我已经研究过文档和资料,但无法弄清楚.我在步骤中尝试了以下操作:

So, I somehow need to tell Github Actions that "Cancel if Python is 3.7 and Django is 1.11.". I've looked into documentations and stuff but could not figure it out. I've tried something like below in my steps:

if: (matrix.python-version != 3.7 && matrix.django-version != 1.11)
# or
if: (matrix.python-version != 3.7) && (matrix.django-version != 1.11)

但是,这会取消 all Django 1.11和 all Python 3.7.

However, this cancels all Django 1.11 and all Python 3.7.

在Github Actions中是否可以禁止某些矩阵组合?

Is there a way to ban some matrix combinations in Github Actions?

推荐答案

if: !(matrix.python-version == 3.7 && matrix.django-version == 1.11)

if: (matrix.python-version != 3.7 || matrix.django-version != 1.11)

一种替代方法是使用

An alternative is to use the exclude option for matrix builds

所以像这样:

matrix:
  exclude:
    - python-version: 3.7
      django-version: 1.11

这篇关于如何不允许一起使用某些矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆