Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在GitHub操作Ubuntu中安装Swift时出现问题_Swift_Ubuntu_Github_Github Actions - Fatal编程技术网

在GitHub操作Ubuntu中安装Swift时出现问题

在GitHub操作Ubuntu中安装Swift时出现问题,swift,ubuntu,github,github-actions,Swift,Ubuntu,Github,Github Actions,我无法在Ubuntu上成功安装并运行GitHub上的Swift操作 以下是我的操作代码: name: SwiftPlot Ubuntu on: push: branches: master pull_request: jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Install Freetype run: sudo

我无法在Ubuntu上成功安装并运行GitHub上的Swift操作

以下是我的操作代码:

name: SwiftPlot Ubuntu

on:
  push:
    branches: master
  pull_request:

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - name: Install Freetype
      run: sudo apt-get install libfreetype6-dev
    - name: Install Swift Dependencies
      run: sudo apt-get install clang libicu-dev
    - name: Download Swift
      run: wget "https://swift.org/builds/swift-5.1.3-release/ubuntu1804/swift-5.1.3-RELEASE/swift-5.1.3-RELEASE-ubuntu18.04.tar.gz"
    - name: Install Swift
      run: |
        tar xzf swift-5.1.3-RELEASE-ubuntu18.04.tar.gz
        export PATH=$(pwd)/swift-5.1.3-RELEASE-ubuntu18.04/usr/bin:"${PATH}"
    - name: Build
      run: swift build -v
    - name: Run tests
      run: swift test -v  

但它无法找到
swift
。知道为什么会发生这种情况吗?

使用
导出设置环境变量在GitHub操作中不起作用。您可以使用一个特殊函数来添加路径

请参阅
添加路径的文档

    - name: Install Swift
      run: |
        tar xzf swift-5.1.3-RELEASE-ubuntu18.04.tar.gz
        echo "::add-path::$(pwd)/swift-5.1.3-RELEASE-ubuntu18.04/usr/bin"