Skip to content

Conversation

@xperiandri
Copy link
Collaborator

@xperiandri xperiandri commented Jul 7, 2025

  • Build project on .NET 9
  • launchSettings.json with multiple profiles to run the build project
  • Target to execute locally and issue a release: update changelog, commit, set tag
  • Publish successful merges to master as prerelease GitHub packages
  • Embed all sources into GitHub packages for easy local debugging
  • GitHub actions for CI, merge to master and release tag creation

Copilot AI review requested due to automatic review settings July 7, 2025 23:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new FAKE-based build project, replaces the old build.fsx script, adds AltCover support in tests, and configures multiple GitHub Actions workflows.

  • Add AltCover package to test projects for code coverage
  • Create build/build.fsproj and build/build.fs as the new FAKE build setup, with accompanying wrappers (build.sh/build.cmd)
  • Remove legacy build.fsx, update solution files, central package versions, and add CI/CD GitHub workflows

Reviewed Changes

Copilot reviewed 24 out of 25 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests//.fsproj Added <PackageReference Include="altcover" /> to enable coverage instrumentation
build/build.fsproj New FAKE build project with dependencies
build/build.fs New F# script implementing build targets
build.sh / build.cmd Shell and Windows wrappers for invoking FAKE build
build.fsx Removed legacy build script
Directory.Packages.props Reorganized package version groups
.github/workflows/*.yml Added multiple workflows for build, publish, and docs deployment
Comments suppressed due to low confidence (1)

build/build.fs:92

  • The changelogBackupFilename mutable value is declared but never used within this script. Consider removing it to reduce dead code.
let mutable changelogBackupFilename = ""

|> Seq.map (fun t -> t.Name)
|> Seq.exists ((=) "PublishToNuGet")

let invokeAsync f = async { f () }
Copy link

Copilot AI Jul 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer using the task computation expression over async here (e.g., let invokeAsync f = task { f () }) to align with the project’s guidelines.

Copilot generated this review using guidance from repository custom instructions.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disagree, Copilot. async is idiomatic F#, task is not (it was created for better interoperability with C#)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is according to the Copilot instructions file.
https://github.com/fsprojects/FSharpLint/pull/726/files
If you want to suggest any changes in that PR I will review

@xperiandri xperiandri changed the title Fake build project and mutiple GitHub actions Fake build project and GitHub actions per scenario Jul 7, 2025
@xperiandri
Copy link
Collaborator Author

@knocte @Numpsy @webwarrior-ws I've updated CI to cover more scenarios. Give your feedback, please.
Taken from https://www.jimmybyrd.me/MiniScaffold

@@ -0,0 +1,73 @@
name: Build `master`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xperiandri no need to rename the workflow file because this still builds & run tests. Also no need to rename workflow name because PRs should run CI too (and PRs are not 'master')

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the name was build+test+deploy.yml and now it does not deploy anything. Only builds and tests. Do you still want to have the same name?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having it same name would, to begin with, allow to have a proper diff to comment on; and I'm not convinced about moving the deploy parts of the CI to another file because you're basically moving logic from F# to GithubActions syntax, so basically undoing some work we have done in the past

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main purpose of having multiple pipelines is the separation of responsibility. You always know which file responsible for what.
Also, I reconsolidated Fornax build logic into the Fake build project. So that the docs build is encapsulated into a build target.
@webwarrior-ws, what do you think?

@xperiandri xperiandri force-pushed the release-automation branch 2 times, most recently from fa526b5 to c33ab51 Compare July 8, 2025 19:49
Comment on lines 105 to 118
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Restore tools
run: dotnet tool restore
- name: Restore dependencies
run: dotnet restore
- name: Run Fornax
run: dotnet fsi build.fsx -t Docs
- name: Deploy (if tag)
if: startsWith(github.ref, 'refs/tags/')
uses: peaceiris/actions-gh-pages@v3
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now all of this is done in Fake via a designated target

- master
pull_request:
branches:
- master
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xperiandri doing the above will make PRs not have CI feedback; please revert all these changes in the workflow above

- windows-latest
- macOS-latest
configuration: [Debug, Release]
os: [ubuntu-latest, windows-latest, macOS-latest]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xperiandri there's no need to change the os attribute for no reason, you're just causing git-blame line-damage here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

- name: Build via Bash
if: runner.os != 'Windows'
run: |
chmod +x ./build.sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xperiandri let's just add the +x attrib to the file in github to not need to use chmod here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

publish_branch: gh-pages
force_orphan: true
runCmd: |
chmod +x ./build.sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xperiandri same here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xperiandri we want PRs to the docs to also be tested before being merged, so please stop using the branches attribute, it is a bad practice


- name: Build Docs
run: |
chmod +x ./build.sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xperiandri same here about chmod

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

on:
push:
branches:
- master
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xperiandri even if we only want to publish for master branch, the way to filter it is to prevent the last step from happening (the nuget push) if branch is not master. This way the job is still being tested everytime, even for PRs.

- name: Add the GitHub source
run: dotnet nuget add source --name "github.com" "https://nuget.pkg.github.com/fsprojects/index.json"

- name: Ensure NuGet package source mapping
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xperiandri what is this exactly? I would prefer a script instead of so much githubActions logic

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to build.fs

on:
push:
tags:
- 'v*'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xperiandri same point I mentioned about filtering to master branch applies here

build.cmd Outdated
@@ -0,0 +1 @@
dotnet run --project ./build/build.fsproj -- -t %*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xperiandri I guess -t means --target? let's prefer to use longer flag names, shorter ones can be used when using the terminal to type faster, but for scripts we should favour readability

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

build.sh Outdated
set -eu
set -o pipefail

FAKE_DETAILED_ERRORS=true dotnet run --project ./build/build.fsproj -- -t "$@"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xperiandri same here about -t

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@xperiandri xperiandri force-pushed the release-automation branch from cd55eca to 15505f9 Compare July 9, 2025 22:51
@xperiandri
Copy link
Collaborator Author

@knocte, let's define the build strategy.
With the current setup build happens twice (when a branch is in this repo), and every time it passes the same stages.
The approach proposed in the PR is:

  1. CI when PR to master
  2. CD publish NuGet with embedded PDBs to GitHub when any commit appears in master
  3. CD publish to NuGet when tag appears

You suggest:

  1. Do CI not only for PRs to master but for any branch. I agree.
  2. Perform the Docs CI, not only CD.

I propose:

  1. I agree and change
  2. We use a stage in the CI pipeline for docs, and a stage in the NuGet CD pipeline. Removing the separate docs pipeline.

@xperiandri
Copy link
Collaborator Author

Looks like a bug. It treats named parameter assignment as a condition

========== Linting /home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest/TestApi.fs ==========
`x = true` might be able to be refactored into `x`.
Error on line 22 starting at column 47
            let checker = FSharpChecker.Create(keepAssemblyContents=true)
                                               ^                         
See https://fsprojects.github.io/FSharpLint/how-tos/rules/FL0065.html

@knocte
Copy link
Collaborator

knocte commented Jul 10, 2025

Looks like a bug

It is.

tags:
- 'v*'
branches:
- master
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xperiandri I know that you have put '**' for pull_request, but still putting this filter here will mean that a contributor that is about to post a PR won't get CI feedback until she proposes the PR, which is unnecessary. Contributors should be able to see the CI statuses before creating PRs.


# to execute once a day (more info see https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule )
schedule:
- cron: '0 0 * * *'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xperiandri why remove the schedule? this way we make sure that CI is still working, and when it breaks for reasons unrelated to FSharpLint commits we notice right away. Before I added this schedule job it used to happen that suddenly some new commit landed in master and broke CI and we were scratching our heads for days wondering how that commit could break the build, until we realised the CI broke by itself, unrelated to the commit.

@knocte
Copy link
Collaborator

knocte commented Jul 10, 2025

let's define the build strategy.

Not sure I understand what you're getting at in that big comment, Take in account there's already a build strategy in master branch so what you're trying to do in a PR is to change it. If you phrase the changes this way, I'll understand much better what you mean. For example, wrt the docs, you mean we shouldn't run fornax in master but only in tags? If that's the case, say it explicitly: stop doing X, start doing Y, etc.

@Numpsy
Copy link
Contributor

Numpsy commented Jul 10, 2025

Looks like a bug. It treats named parameter assignment as a condition

========== Linting /home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest/TestApi.fs ==========
`x = true` might be able to be refactored into `x`.
Error on line 22 starting at column 47
            let checker = FSharpChecker.Create(keepAssemblyContents=true)
                                               ^                         
See https://fsprojects.github.io/FSharpLint/how-tos/rules/FL0065.html

#492

@xperiandri
Copy link
Collaborator Author

Migrated to #742

@xperiandri xperiandri closed this Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants