标签: github-actions

codecov 在 github 操作中失败

背景

  • 到目前为止,我对 codecov 的设置运行良好

    • 您可以在此处定期更新每个 pr 提交的内容
    • 我没有更改我的存储库设置
  • 因为我无意中推送了一个不应该推送的文件夹,
    然后我合并了一个pr来删除该文件夹

  • 这是我的codecov.yml

问题

  • 在前面提到的最后一个公关中,上面链接的 github 操作 ci 抱怨了下面的日志
  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                              Bash-1.0.3


==> git version 2.31.1 found
==> curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 …
Run Code Online (Sandbox Code Playgroud)

code-coverage codecov github-actions

10
推荐指数
1
解决办法
8127
查看次数

如何在Github操作中指定节点的路径?

我正在尝试使用 Github 的 node.js 工作流程在我的存储库上进行自动化测试。但是,我遇到了困难,因为节点是在子目录中设置的,而不是在存储库的根目录中。我一直在寻找一种方法来指定运行 npm 命令的目录,但没有找到任何答案。

这是工作流程代码:

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [12.x, 14.x, 16.x]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

    steps:
    - uses: actions/checkout@v2
      with: 
        path: backend_app
    - name: Use Node.js …
Run Code Online (Sandbox Code Playgroud)

npm github-actions

10
推荐指数
2
解决办法
1万
查看次数

是否可以在我的 shell 文件中使用 GitHub 机密?

这是我在 GitHub 存储库上的简单操作:

name: CI

on:
  push:
    branches: [ main ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Get /my_account/my_infra
        run: |
          sudo mkdir /my_account
          sudo chmod -R 777 /my_account
          cd /my_account
          git clone https://github.com/my_account/my_infra

      - name: Get /my_account/my_repo
        run: |
          cd /my_account
          git clone https://github.com/my_account/my_repo

      - name: Run my build script
        run: |
          cd /my_account/my_infra
          ./build.sh /my_account/my_repo
Run Code Online (Sandbox Code Playgroud)

由于 GitHub 不提供跨多个类似存储库重用操作的方法,因此我提出了创建一个基本存储库的想法,然后将该基本存储库与当前存储库一起下载,然后从该基本存储库运行自定义 shell 脚本,传递我当前的repo 作为参数。

这很完美。这样我就可以在许多类似的存储库中重复使用我的基础存储库。我可以重用近 500 行构建脚本,而不是为 50 个存储库重复自己(这意味着 25000 行 CI/CD 代码)。

但是,现在我需要访问一些资源(例如登录我的 docker hub 帐户)来拉取和推送内容。

是否可以在我的 中使用 GitHub …

shell github github-actions

10
推荐指数
2
解决办法
8839
查看次数

无需 GitHub 操作的单次推送

我有一个 github 存储库,我使用 Github Actions 设置了一个 CI 脚本。在 95% 的 main 推送中,我们需要运行脚本,因此脚本是由pushon触发的main。有没有一种方法可以在执行异常操作的情况下进行推送。我正在想象这样的事情:

git push main --no-action
Run Code Online (Sandbox Code Playgroud)

git github github-actions

10
推荐指数
1
解决办法
2222
查看次数

如何在 GitHub Actions 表达式语法中引用上下文值?

我想在env:GitHub Action的部分设置一个环境变量,并使用GitHub Actions上下文和表达式语法。我试过这个:

jobs:
  build:
    runs-on: ubuntu-latest

    env:
      MYVAR: ${{ format('{0}:{1}', ${{ env.PATH }}, ${{ env.HOME }} ) }}

    steps:
    - name: Check environment
      run: echo $MYVAR
Run Code Online (Sandbox Code Playgroud)

这会导致错误消息:

### ERRORED 10:45:52Z

- Your workflow file was invalid: The pipeline is not valid. .github/workflows/main.yml (Line: 10, Col: 14): Unexpected symbol: '${{'. Located at position 19 within expression: format('{0}:{1}', ${{ env.PATH
Run Code Online (Sandbox Code Playgroud)

此语法:

    env:
      MYVAR: ${{ format('{0}:{1}', {{ env.PATH }}, {{ env.HOME }} ) }}
Run Code Online (Sandbox Code Playgroud)

导致错误:

### …
Run Code Online (Sandbox Code Playgroud)

github-actions

9
推荐指数
2
解决办法
4088
查看次数

在 OSX 上运行 Github Actions 导致“找不到端口 (Aqua) 的域”

我已按照此处的说明进行操作,但是当我运行时./svc.sh run,收到以下错误:

Could not find domain for port (Aqua)
Run Code Online (Sandbox Code Playgroud)

我正在通过 SSH 进入一个盒子来运行这个命令,当我不在无头会话中时它似乎工作正常,但我需要它是无头的并作为后台服务。还有人遇到这个吗?

github-actions

9
推荐指数
1
解决办法
1844
查看次数

如何在 Github Actions 工作流程中缓存 Android NDK?

我想在我的 Github Actions 工作流中缓存 Android NDK。原因是我需要特定版本的 NDK 和 CMake,它们没有预装在 MacOS 运行器上。

我尝试使用以下工作流作业来实现此目的:

jobs:
  build:
    runs-on: macos-latest
    steps:

    - name: Cache NDK
      id: cache-primes
      uses: actions/cache@v1
      with:
        path: ${{ env.ANDROID_NDK_HOME }}
        key: ${{ runner.os }}-ndk-${{ hashFiles(env.ANDROID_NDK_HOME) }}

    - name: Install NDK
      run: echo "y" | $ANDROID_HOME/tools/bin/sdkmanager "ndk;21.0.6113669" "cmake;3.10.2.4988404"
Run Code Online (Sandbox Code Playgroud)

问题在于env上下文不包含ANDROID_NDK_HOME变量。所以这意味着build.steps.with.path评估为空。

如果我使用以下步骤进行调试,则存在常规环境变量并打印正确的路径:

jobs:
  build:
    steps:
    - name: Debug print ANDROID_NDK_HOME
      run: echo $ANDROID_NDK_HOME
Run Code Online (Sandbox Code Playgroud)

但是常规环境变量只能在shell脚本中使用,而build.steps.with据我所知不能使用。

github github-actions

9
推荐指数
2
解决办法
998
查看次数

Github 操作 actions/checkout@v2 lfs:true 标志不将指针转换为实际文件

这是我的 github 操作 yml 文件:

name: CI

on: [pull_request]

jobs:
  build_ios:
    name: Set up
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        os: [self-hosted]
        node-version: [10.x]

    steps:
      - name: Checkout github repo (+ download lfs dependencies)
        uses: actions/checkout@v2
        with:
          lfs: true
Run Code Online (Sandbox Code Playgroud)

在它运行之后,我希望所有的 git lfs 文件都被下载、签出并准备好使用,但文件的内容是这样的:

version https://git-lfs.github.com/spec/v1
oid sha256:f23e4c2b1244bc93085dbccf17c447e54sca44650294648df128d58303e4eff
size 58951008
Run Code Online (Sandbox Code Playgroud)

下面我附上实际的 github 操作日志,以防万一:

Run actions/checkout@v2
  with:
    lfs: true
    repository: SudoPlz/test-project-mobile
    token: ***
    ssh-strict: true
    persist-credentials: true
    clean: true
    fetch-depth: 1
    submodules: false
Syncing repository: SudoPlz/test-project-mobile
Getting Git version info
  Working directory …
Run Code Online (Sandbox Code Playgroud)

git github git-lfs github-actions

9
推荐指数
1
解决办法
4026
查看次数

Github 操作 - /bin/sh: 1: jest: not found

使用 Github 操作发布 npm 包,它可以正常工作并运行 jest 测试用例而不会出错。所以我决定添加 yarn 缓存来优化构建时间并且缓存过程有效,但是 jest 失败并出现以下错误。

$ jest --config=jest.config.js
/bin/sh: 1: jest: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
##[error]Process completed with exit code 127.
Run Code Online (Sandbox Code Playgroud)

这是我的 yml

name: NPM Publish
on:
  push:
    branches: 
      - master

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: 12.x

      - name: Get yarn cache directory
        id: yarn-cache-dir-path
        run: echo "::set-output name=dir::$(yarn cache dir)" …
Run Code Online (Sandbox Code Playgroud)

github yarnpkg github-actions

9
推荐指数
1
解决办法
1729
查看次数

如何安排 GitHub Actions 每晚构建,但仅在最近代码更改的地方运行它?

我想使用 GitHub Actions 进行自动夜间构建(来自开发分支的每日快照)。

为了降低计费成本,我希望 GitHub Actions 工作流仅在自上次 GitHub Actions 夜间构建工作流运行以来有新提交时触发(或执行操作)。

如何安排 GitHub Actions 每晚构建,但仅在自上次每晚运行以来代码发生更改的地方运行它?

请注意,还有其他 GitHub 操作工作流程,不会干扰此夜间构建。

github-actions

9
推荐指数
2
解决办法
1996
查看次数

标签 统计

github-actions ×10

github ×5

git ×2

code-coverage ×1

codecov ×1

git-lfs ×1

npm ×1

shell ×1

yarnpkg ×1