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"
LA.27
  • 131
  • 5

1 Answers1

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.

LA.27
  • 131
  • 5