1

I'm new to both travis and this website, so please bear with me ;).

I've been trying to set it up to work with my GH project. The repo is visible on travis side, but I get the following error while building:

./fake.sh: line 25: dotnet: command not found

Not sure why - most likely I've done something wrong with my .travis file. Here it is:

{
  "os": "linux",
  "dist": "trusty",
  "mono": "5.10.1",
  "sudo": "required",
  "group": "stable",
  "dotnet": "2.1.403",
  "script": [
  -  "./fake.sh build -t Nuget"
  ],
  "install": [
  -  "export FrameworkPathOverride=$(dirname $(which mono))/../lib/mono/4.5/"
  ],
  "language": "fsharp",
  "before_install": [
  - "chmod +x fake.sh"
  ]
}

The file "fake.sh" is my build script. It uses the F# FAKE library, but the target I invoke contains nothing, but invocation of "dotnet pack". It works on my local machine.

EDIT: The fake.sh is the standard, unchanged F# FAKE file that is included in "dotnet new fake" template. Here's its content:

#!/usr/bin/env bash

set -eu
set -o pipefail

# liberated from https://stackoverflow.com/a/18443300/433393
realpath() {
  OURPWD=$PWD
  cd "$(dirname "$1")"
  LINK=$(readlink "$(basename "$1")")
  while [ "$LINK" ]; do
    cd "$(dirname "$LINK")"
    LINK=$(readlink "$(basename "$1")")
  done
  REALPATH="$PWD/$(basename "$1")"
  cd "$OURPWD"
  echo "$REALPATH"
}

TOOL_PATH=$(realpath .fake)
FAKE="$TOOL_PATH"/fake

if ! [ -e "$FAKE" ]
then
  dotnet tool install fake-cli --tool-path "$TOOL_PATH"
fi
"$FAKE" "$@"

All it does is it makes sure all the build requirements are there in place. Then it runs the "build.fsx" script:

open Fake.Core
open Fake.DotNet
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.IO.Globbing.Operators
open Fake.Core.TargetOperators

let nugetDir = "../nuget"

Target.create "Clean" (fun _ ->
    !! "src/**/bin"
    ++ "src/**/obj"
    ++ nugetDir
    |> Shell.cleanDirs 
)

Target.create "Build" (fun _ ->
    !! "src/**/*.*proj"
    |> Seq.iter (DotNet.build id)
)

Target.create "Nuget" (fun _ ->
    !! "src/**/*.*proj"
    |> Seq.iter (DotNet.pack (fun o -> { o with OutputPath = Some nugetDir }))
)

"Clean"
  ==> "Build"

"Clean"
  ==> "Nuget"

Target.runOrDefault "Build"
2
  • 2
    post here entry of fake.sh Commented Oct 8, 2018 at 3:52
  • Sure - updated the question.
    – LA.27
    Commented Oct 8, 2018 at 7:02

1 Answer 1

2

OK - found the solution myself. It's a kind of tricky one. Even though my project is written in F#, I still have to set

"language": "csharp"

in my .travis.yml file. That's a bit counter-intuitive, but I must admit that it's written in the doc, so can't really blame anyone.

1
  • 1
    I'd give you multiple upvotes if I could. I would have never discovered that on my own. Commented Jan 25, 2019 at 16:35

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.