我已經發布了MooseX::Extended到 CPAN(這里是 github 存盤庫)。
我正在嘗試設定 github 操作,并且 linux 測驗運行良好。但是,(Windows 因此錯誤而失敗:
Configuring true-v1.0.2 ... OK
==> Found dependencies: Function::Parameters
--> Working on Function::Parameters
Fetching http://www.cpan.org/authors/id/M/MA/MAUKE/Function-Parameters-2.001003.tar.gz ... OK
Configuring Function-Parameters-2.001003 ... OK
Building Function-Parameters-2.001003 ... OK
Successfully installed Function-Parameters-2.001003
! Installing true failed. See C:\Users\RUNNER~1\.cpanm\work\1653412748.5640\build.log for details. Retry with --force to force install it.
Building true-v1.0.2 ... FAIL
當然,我看不到這一點,C:\Users\RUNNER~1\.cpanm\work\1653412748.5640\build.log無法理解發生了什么。
該true模塊在 Windows 上通過了它的 CPAN 測驗人員測驗,所以我不知道為什么它在 Github Actions 中失敗了。
我的作業流程如下所示:
# Hacked from https://github.com/skaji/perl-github-actions-sample/blob/master/.github/workflows/windows.yml
# See also: https://perlmaven.com/github-actions-running-on-3-operating-systems
name: windows
on:
push:
branches:
- '*'
tags-ignore:
- '*'
pull_request:
jobs:
perl:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
perl-version:
- '5.20'
- '5.22'
- '5.24'
- '5.26'
- '5.28'
- '5.30'
- '5.32'
- '5.34'
- 'latest'
steps:
- uses: actions/checkout@v2
- name: Set up Perl
run: |
choco install strawberryperl
echo "C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin" >> $GITHUB_PATH
- name: perl -V
run: perl -V
- name: Install Dependencies
run: curl -sL https://git.io/cpm | perl - install -g --show-build-log-on-failure Dist::Zilla
- name: Run Tests
run: |
dzil authordeps --missing | cpanm --notest
dzil listdeps --author --missing | cpanm --notest
dzil test --author --release
這是附加操作的 PR。
我無權訪問 Windows 框。有誰知道我錯過了什么?
uj5u.com熱心網友回復:
由于 GitHub Actions/Workflows 使用已經預裝了Strawberry Perl版本的 Windows 容器,因此它不允許您安裝任何其他版本。您無法洗掉預安裝的 Perl 版本,并且通過 Chocolatey 洗掉/安裝新版本也幾乎是不可能的。如果您重新安裝容器上已經存在的 Chocolatey 版本,它似乎允許這樣做,但它基本上NOOP適合您作為測驗設定。
該容器還安裝了 MinGW;這也可能對我們不利。單獨安裝 MinGW 會阻止構建 XS 模塊(無論它們是依賴項還是您自己的模塊是 XS 模塊)。當然,只有在安裝 Perl 之前出現 MinGW 時才會發生這種情況PATH,但是當您洗掉一個 Perl 并添加另一個 Perl 時,您將遇到這個問題。
為了解決這個問題,最好的做法是從PATH環境變數中洗掉當前安裝的 Perl 版本,以及他們當前安裝的 MinGW 版本。一旦兩者都安全地退出 PATH,您可以安裝 Portable[1] Strawberry Perl,將 Perl 的路徑放入您的路徑中,PATH然后開始使用全新安裝的 Strawberry Perl 進行測驗。GitHub 最近打破了我們直接在 Action YAML 檔案中執行此操作的能力。
這一切聽起來讓人頭疼,但事實并非如此。為此目的,我們可以使用一個 Action:actions-setup-perl。通過此操作,您可以輕松地使用您喜歡的任何版本的 Perl 進行測驗。因此,如果您聽到有人報告 Windows 上 Perl v5.26 的錯誤,您現在可以將其添加到您的矩陣中并輕松測驗,而無需用戶來回進行任何來回操作:
name: windows
on:
push:
branches:
- '*'
tags-ignore:
- '*'
pull_request:
jobs:
perl:
runs-on: windows-latest
strategy:
fail-fast: true
matrix:
perl-version:
- '5.30'
# - '5.28'
# - '5.26'
# - '5.24'
# - '5.22'
# - '5.20'
# - '5.18'
# - '5.16'
- '5.14'
steps:
- name: Setup perl
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: ${{ matrix.perl-version }}
distribution: strawberry
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v2
- name: perl -V
run: perl -V
- name: Ensure we have a working toolchain
run: cpanm ExtUtils::Manifest App::cpanminus
- name: Install Dependencies
run: cpanm -n --installdeps .
- name: Run Tests
run: cpanm --test-only -v .
[1]Strawberry Perl 的便攜版本是壓縮的,已經編譯的 Perl 版本不需要您在 Windows 上運行安裝程式。這意味著不需要更高的權限等。您只需將存檔解壓縮到要從中運行 Perl 的目錄中,然后在$env:PATH變數中添加到 Perl 的相關路徑。它消除了構建不規則等的任何煩惱。我發現它是在 Windows 上測驗的最明智的方法。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/482004.html
