steps: build: image: nixos/nix commands: - echo 'experimental-features = flakes nix-command' >> /etc/nix/nix.conf - "nix develop --command dotnet publish AdventOfCode2023.FSharp/AdventOfCode2023.FSharp/AdventOfCode2023.FSharp.fsproj --configuration Release -p:PublishAot=true || echo 'First publish failed'" - "nix develop --command sh -c 'patchelf --set-interpreter $LINKER_PATH /tmp/dotnet-home/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.0/tools/ilc'" - "ls -al /tmp/dotnet-home/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.0/tools/ilc" - "chmod a+x /tmp/dotnet-home/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.0/tools/ilc" - "ls -al /tmp/dotnet-home/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.0/tools/ilc" - "whoami" - "cp -r AdventOfCode2023.FSharp/AdventOfCode2023.FSharp/obj /tmp/obj" - "nix develop --command sh -c 'ls -la $LINKER_PATH'" - "nix develop --command sh -c 'strace /tmp/dotnet-home/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.0/tools/ilc /tmp/obj/Release/net8.0/linux-x64/native/AdventOfCode2023.FSharp.ilc.rsp'" - "nix develop --command dotnet publish AdventOfCode2023.FSharp/AdventOfCode2023.FSharp/AdventOfCode2023.FSharp.fsproj --configuration Release -p:PublishAot=true" # Lint - "nix flake check" # Test - nix develop --command dotnet test AdventOfCode2023.FSharp - nix develop --command dotnet test AdventOfCode2023.FSharp --configuration Release - nix develop --command alejandra --check . - nix develop --command dotnet tool restore - nix develop --command dotnet fantomas --check . # TODO: if https://github.com/dotnet/sdk/issues/37295 ever gets fixed, remove the PublishAot=false - "nix develop --command dotnet publish AdventOfCode2023.FSharp/AdventOfCode2023.FSharp/AdventOfCode2023.FSharp.fsproj --configuration Release -p:PublishAot=false -p:SelfContained=true" - '$(find . -type f -name AdventOfCode2023.FSharp | grep Release | grep publish) "$(pwd)/AdventOfCode2023.FSharp/Test/samples"' when: - event: "push" evaluate: 'CI_COMMIT_BRANCH == CI_REPO_DEFAULT_BRANCH' - event: "pull_request"