如何在 GitHub Actions/Workflows 配置中安装 imagemagick 和其他自制软件依赖项?

How to install imagemagick and other homebrew dependencies in GitHub Actions/Workflows config?

我基本上必须在 Mac 上执行此操作才能在本地为我的包连接所需的依赖项:

brew cask install java
brew install graphicsmagick
brew install imagemagick
brew install fontforge
brew install ffmpeg
brew install xetex
brew install nasm
brew install qemu

我正在使用 Node.js,它是一个节点包。我如何告诉 GitHub Actions/Workflows 在 Mac 环境中设置所有这些东西?我也想尝试让 Ubuntu 环境正常运行,所以很高兴知道如何为每个环境 运行 不同的安装设置脚本。

我的配置似乎还没有工作,本质上是这样的: 名称:建造

on:
  pull_request:
    paths-ignore:
      - '**.md'
  push:
    branches:
      - build
    paths-ignore:
      - '**.md'

jobs:
  # linux:
  #   runs-on: ubuntu-latest
  #   steps:
  #     - uses: actions/checkout@v2
  #     - uses: actions/setup-node@v1
  #     - run: sudo apt-get install ninja-build
  #     - run: ninja --version

  # windows:
  #   runs-on: windows-latest
  #   steps:
  #     - uses: actions/checkout@v2
  #     - uses: actions/setup-node@v1
  #     - run: choco install ninja
  #     - run: ninja --version

  macos:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: 14.x
      - run: brew cask install java
      - run: brew install graphicsmagick
      - run: brew install imagemagick
      - run: brew install fontforge
      - run: brew install ffmpeg
      - run: brew install xetex
      - run: brew install nasm
      - run: brew install qemu
      - run: npm ci
      - run: npm test

我没有任何 docker(我也不应该使用 docker,因为我想在 Mac 环境中使用 运行?)。想知道我接下来需要做什么。

看起来你至少有三个选项(而且你不需要docker):

选项 1:运行 在 Ubuntu 上并使用 brew

安装

Ubuntu GitHub Runner 已经安装了 linuxbrew(链接文档中的最后一个项目符号)。

您可能会在这里遇到问题,因为此环境与您的 mac 不完全兼容。

选项 2:运行 on Ubuntu 并使用 apt

安装

为您当前使用 brew 安装的那些找到相应的 apt 包,并使用 run 指令正常安装它们。

选项 3:运行 在 MacOS 运行ner

这可能是最适合你的。如果您希望 CI 环境更接近您的个人环境,运行 在 mac 运行ner 而不是 ubuntu 运行ner . These are the supported environments - you will probably want runs-on: macos-latest. The software installed on the GitHub mac runner is listed here.