为什么 Github Actions 总在下载包的时候失败?

这个现象自 2 月以来一直没有改善:

也不是每次都全部失败,偶又会有几个任务成功。我看了一下,失败集中在下载 php-mode/nix-mode/markdown-mode 这几个包的时候:

这么小的项目应该没有触及免费使用限额

以下是我的 .github/workflows/test.yml 文件:

test.yml
name: CI

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

jobs:
  test:
    runs-on: ubuntu-latest
    continue-on-error: ${{matrix.allow_failures}}

    strategy:
      fail-fast: false
      matrix:
        emacs_version:
          - 25.2
          - 25.3
          - 26.1
          - 26.2
          - 26.3
          - 27.1

        allow_failures: [false]

        include:
          - emacs_version: 25.1
            allow_failures: true
          - emacs_version: snapshot
            allow_failures: true

    steps:
    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: 3.6
        architecture: x64

    - name: Set up Emacs
      uses: purcell/setup-emacs@master
      with:
        version: ${{matrix.emacs_version}}

    - name: Set up Cask
      uses: conao3/setup-cask@master
      with:
        version: 'snapshot'

    - name: Check out the source code
      uses: actions/checkout@v2

    - name: Install dependencies
      run: cask install

    - name: Byte compile
      run: make compile

    - name: Run tests
      run: make test

彻底废了:

终于找到原因,是拷贝文件的时候出错了:

2022-11-02T06:53:26.2990668Z Debugger entered--Lisp error: (file-already-exists "File already exists" "/tmp/php-modelfnw4U/php-mode-20210306.1242/php-ali...")
2022-11-02T06:53:26.2992405Z   copy-file("/tmp/cask/checkout/php-mode/lisp/php-align.el" "/tmp/php-modelfnw4U/php-mode-20210306.1242/php-ali...")
2022-11-02T06:53:26.2993993Z   (cond ((file-regular-p src*) (package-build--message "  %s %s -> %s" (if (equal src dst) " " "!") src dst) (copy-file src* dst*)) ((file-directory-p src*) (package-build--message "  %s %s => %s" (if (equal src dst) " " "!") src dst) (copy-directory src* dst*)))
2022-11-02T06:53:26.2996489Z   (let ((src* (expand-file-name src source-dir)) (dst* (expand-file-name dst target-dir))) (make-directory (file-name-directory dst*) t) (cond ((file-regular-p src*) (package-build--message "  %s %s -> %s" (if (equal src dst) " " "!") src dst) (copy-file src* dst*)) ((file-directory-p src*) (package-build--message "  %s %s => %s" (if (equal src dst) " " "!") src dst) (copy-directory src* dst*))))
2022-11-02T06:53:26.2999177Z   (let ((dst x33) (src x32)) (let ((src* (expand-file-name src source-dir)) (dst* (expand-file-name dst target-dir))) (make-directory (file-name-directory dst*) t) (cond ((file-regular-p src*) (package-build--message "  %s %s -> %s" (if (equal src dst) " " "!") src dst) (copy-file src* dst*)) ((file-directory-p src*) (package-build--message "  %s %s => %s" (if (equal src dst) " " "!") src dst) (copy-directory src* dst*)))))
2022-11-02T06:53:26.3001626Z   (let* ((x32 (car x31)) (x33 (cdr x31))) (let ((dst x33) (src x32)) (let ((src* (expand-file-name src source-dir)) (dst* (expand-file-name dst target-dir))) (make-directory (file-name-directory dst*) t) (cond ((file-regular-p src*) (package-build--message "  %s %s -> %s" (if (equal src dst) " " "!") src dst) (copy-file src* dst*)) ((file-directory-p src*) (package-build--message "  %s %s => %s" (if (equal src dst) " " "!") src dst) (copy-directory src* dst*))))))
2022-11-02T06:53:26.3004002Z   (let ((x31 (car --dolist-tail--))) (let* ((x32 (car x31)) (x33 (cdr x31))) (let ((dst x33) (src x32)) (let ((src* (expand-file-name src source-dir)) (dst* (expand-file-name dst target-dir))) (make-directory (file-name-directory dst*) t) (cond ((file-regular-p src*) (package-build--message "  %s %s -> %s" (if ... " " "!") src dst) (copy-file src* dst*)) ((file-directory-p src*) (package-build--message "  %s %s => %s" (if ... " " "!") src dst) (copy-directory src* dst*)))))) (setq --dolist-tail-- (cdr --dolist-tail--)))
2022-11-02T06:53:26.3006717Z   (while --dolist-tail-- (let ((x31 (car --dolist-tail--))) (let* ((x32 (car x31)) (x33 (cdr x31))) (let ((dst x33) (src x32)) (let ((src* (expand-file-name src source-dir)) (dst* (expand-file-name dst target-dir))) (make-directory (file-name-directory dst*) t) (cond ((file-regular-p src*) (package-build--message "  %s %s -> %s" ... src dst) (copy-file src* dst*)) ((file-directory-p src*) (package-build--message "  %s %s => %s" ... src dst) (copy-directory src* dst*)))))) (setq --dolist-tail-- (cdr --dolist-tail--))))
2022-11-02T06:53:26.3008606Z   (let ((--dolist-tail-- files)) (while --dolist-tail-- (let ((x31 (car --dolist-tail--))) (let* ((x32 (car x31)) (x33 (cdr x31))) (let ((dst x33) (src x32)) (let ((src* ...) (dst* ...)) (make-directory (file-name-directory dst*) t) (cond (... ... ...) (... ... ...))))) (setq --dolist-tail-- (cdr --dolist-tail--)))))
2022-11-02T06:53:26.3012603Z   package-build--copy-package-files((("lisp/php-align.el" . "php-align.el") ("lisp/php-face.el" . "php-face.el") ("lisp/php-local-manual.el" . "php-local-manual.el") ("lisp/php-mode-debug.el" . "php-mode-debug.el") ("lisp/php-mode.el" . "php-mode.el") ("lisp/php-project.el" . "php-project.el") ("lisp/php.el" . "php.el") ("lisp/php-align.el" . "php-align.el") ("lisp/php-face.el" . "php-face.el") ("lisp/php-local-manual.el" . "php-local-manual.el") ("lisp/php-mode-debug.el" . "php-mode-debug.el") ("lisp/php-mode.el" . "php-mode.el") ("lisp/php-project.el" . "php-project.el") ("lisp/php.el" . "php.el")) "/tmp/cask/checkout/php-mode/" "/tmp/php-modelfnw4U/php-mode-20210306.1242")

搞不懂为何本地不会出错,在 Github Actions 上也会随机有部分成功。但不管怎样现在应该算是修复了。

diff --git a/Cask b/Cask
index 205740d..47979d8 100644
--- a/Cask
+++ b/Cask
@@ -24 +24 @@
-             :files (:defaults "lisp/*.el"))
+             :files ("lisp/*.el"))
1 个赞