1

I'm unable to successfully install and run Swift on GitHub Actions on Ubuntu.

Here's my Actions code:

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  

But it's unable to find swift. Any idea why this is happening?

1 Answer 1

1

Setting environment variables with export does not work in GitHub Actions. There is a special function you can use to add a path instead.

See the documentation for add-path here.

    - 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"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.