我目前正在尝试将 GitHub 操作工作流程添加到存储库中...
要进行 C++/CMake/swig/python 开发(即本机 python 库开发),我需要下载并安装 swigwin 并将其提供在PATH
...
不幸的是,似乎$env:Path...
在下一个后续过程中不考虑命令steps https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idsteps
Example
name: Python Windows CI
on: [push, pull_request]
jobs:
# Building using the GitHub runner environment directly.
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Check cmake
run: cmake --version
- name: Install swig
run: |
(New-Object System.Net.WebClient).DownloadFile("http://prdownloads.sourceforge.net/swig/swigwin-4.0.1.zip","swigwin-4.0.1.zip");
Expand-Archive .\swigwin-4.0.1.zip .;
$env:Path += ";.\swigwin-4.0.1";
swig -version;
- name: Check swig
run: swig -version # swig cmdlet not found...
Observed
> Set up job
> Run actions/checkout@v23s
> Check cmake
v Install swig
...
SWIG Version 4.0.1
...
v Check swig
swig -version
shell: C:\Program Files\PowerShell\6\pwsh.EXE -command ". '{0}'"
swig : The term 'swig' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At D:\a\_temp\0a8dc0e1-ec51-429b-abd0-cb3597e983ac.ps1:2 char:1
+ swig -version
+ ~~~~
+ CategoryInfo : ObjectNotFound: (swig:String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : CommandNotFoundException
##[error]Process completed with exit code 1.
The add-path
and set-env
出于安全原因,命令已于 2020 年 10 月 1 日弃用:https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
添加到 %PATH% 的推荐方法是使用环境文件 https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files如下:
假设你使用Powershell
,默认外壳:
echo "C:\directory\to\add\to\path" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
或替代地bash
:
echo "C:\directory\to\add\to\path" >> $GITHUB_PATH
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)