Skip to content

Commit

Permalink
[release/6.0] Modernize build system. (#310)
Browse files Browse the repository at this point in the history
* Update Paket.

* Update `MSBuild.StructuredLogger` build-time dependency.

* Update Paket and FAKE.

* Move CI to GitHub Actions.

* Add Release workflow.

* Run only tests in CI.

* Remove unused release code from the build script.

* Add step to restore Paket dependencies.

* Fix Paket dependencies.

* Remove Paket and use a dedicated build project.

* Locate MSBuild in the build script.

* Fix target syntax in command line.

* Remove more unused code in the build script.

* Fix passing command line arguments.

* Remove condition that likely prevents publishing of NuGet packages.

The idea was that it would gracefully skip publishing on forks, but apparently the `if` is not evaluated with the environment's variables.

* Fix loading of MSBuild assemblies.

* Remove remaining references to AppVeyor and let the build script determine the version suffix.

* Use custom release version only when not making a release.

* Do not run release workflow on this branch.
  • Loading branch information
teo-tsirpanis authored Nov 10, 2024
1 parent a39cea9 commit 43454fe
Show file tree
Hide file tree
Showing 13 changed files with 162 additions and 414 deletions.
12 changes: 0 additions & 12 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@
"version": 1,
"isRoot": true,
"tools": {
"paket": {
"version": "6.2.1",
"commands": [
"paket"
]
},
"fake-cli": {
"version": "5.20.4",
"commands": [
"fake"
]
},
"fsharp.formatting.commandtool": {
"version": "11.2.0",
"commands": [
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on:
push:
branches:
- mainstream
pull_request:
paths-ignore:
- '**/*.md'
- '**/*.txt'

permissions: read-all

jobs:
test:
name: Test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
defaults:
run:
shell: pwsh
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Restore .NET local tools
run: dotnet tool restore
- name: Run tests
run: dotnet run --project eng/Farkle.Build.fsproj -- -t Test

full_ci_passed:
needs: [test]
runs-on: ubuntu-latest
steps:
- run: exit 0
18 changes: 18 additions & 0 deletions .github/workflows/ci_dummy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This workflow gives a positive check result to PRs that only
# change non-code files. It is needed for branch protection to work.
name: CI (dummy)

on:
pull_request:
# Paths must be synchronized with ci.yml.
paths:
- '**/*.md'
- '**/*.txt'

permissions: read-all

jobs:
full_ci_passed:
runs-on: ubuntu-latest
steps:
- run: exit 0
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release

on:
push:
branches:
- mainstream
- release/*
release:
types: [published]

jobs:
pack:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Restore .NET local tools
run: dotnet tool restore
- name: Pack
run: dotnet run --project eng/Farkle.Build.fsproj -- -t NuGetPack
- name: Upload package artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: ./bin
release:
needs: pack
environment: ${{ github.event_name == 'release' && 'release' || 'nightly' }}
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Download package artifacts
uses: actions/download-artifact@v4
with:
name: nuget-packages
path: ./bin
- name: Publish
run: dotnet nuget push ./bin/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source ${{ vars.NUGET_FEED }}
10 changes: 7 additions & 3 deletions Farkle.sln
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Farkle.Tools", "src\Farkle.Tools\Farkle.Tools.fsproj", "{E282044A-E72A-4BA7-B875-B9F991B6CEC7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{99555D79-E44E-463E-98AA-BAD6A6569B2C}"
ProjectSection(SolutionItems) = preProject
build.fsx = build.fsx
EndProjectSection
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Farkle.Tools.MSBuild", "src\Farkle.Tools.MSBuild\Farkle.Tools.MSBuild.fsproj", "{BE66563B-D4EA-40FD-98E1-E4669AA0F9A1}"
EndProject
Expand All @@ -38,6 +35,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Farkle.Tools.MSBuild.Tests"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Farkle.Tools.Precompiler", "src\Farkle.Tools.Precompiler\Farkle.Tools.Precompiler.fsproj", "{7F8558C4-6609-444A-A471-BD222E8C7928}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Farkle.Build", "eng\Farkle.Build.fsproj", "{FDBB71CC-DE8C-417D-9919-94E3C4812297}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -92,6 +91,10 @@ Global
{7F8558C4-6609-444A-A471-BD222E8C7928}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7F8558C4-6609-444A-A471-BD222E8C7928}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7F8558C4-6609-444A-A471-BD222E8C7928}.Release|Any CPU.Build.0 = Release|Any CPU
{FDBB71CC-DE8C-417D-9919-94E3C4812297}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FDBB71CC-DE8C-417D-9919-94E3C4812297}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FDBB71CC-DE8C-417D-9919-94E3C4812297}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FDBB71CC-DE8C-417D-9919-94E3C4812297}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -109,6 +112,7 @@ Global
{C6FB5564-2D84-4380-ADCC-3579DB4BF133} = {EC37407F-B092-4C11-B701-462471EF42A8}
{3754FCA2-56E4-4577-A1EE-0ABAF777FEA7} = {67F3BA8F-F616-4039-9DC1-F5D0523BB0FD}
{7F8558C4-6609-444A-A471-BD222E8C7928} = {EC37407F-B092-4C11-B701-462471EF42A8}
{FDBB71CC-DE8C-417D-9919-94E3C4812297} = {99555D79-E44E-463E-98AA-BAD6A6569B2C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {94BF4A95-7FC5-4237-8119-C83972D4E1E9}
Expand Down
8 changes: 0 additions & 8 deletions appveyor.yml

This file was deleted.

4 changes: 1 addition & 3 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ function Test-ExitCode () {if ($LASTEXITCODE -ne 0) {exit $LASTEXITCODE}}

dotnet tool restore
Test-ExitCode
dotnet paket restore
Test-ExitCode
dotnet tool run fake run ./build.fsx @args
dotnet run --project eng/Farkle.Build.fsproj -- @args
28 changes: 28 additions & 0 deletions eng/Farkle.Build.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
<FakeVersion>5.23.1</FakeVersion>
</PropertyGroup>
<ItemGroup>
<Compile Include="build.fs" />
<PackageReference Include="Fake.BuildServer.GitHubActions" Version="$(FakeVersion)" />
<PackageReference Include="Fake.Core.ReleaseNotes" Version="$(FakeVersion)" />
<PackageReference Include="Fake.Core.Target" Version="$(FakeVersion)" />
<PackageReference Include="Fake.Core.UserInput" Version="$(FakeVersion)" />
<PackageReference Include="Fake.IO.FileSystem" Version="$(FakeVersion)" />
<PackageReference Include="Fake.IO.Zip" Version="$(FakeVersion)" />
<PackageReference Include="Fake.DotNet.Cli" Version="$(FakeVersion)" />
<PackageReference Include="Fake.DotNet.FsFormatting" Version="$(FakeVersion)" />
<PackageReference Include="Fake.Tools.Git" Version="$(FakeVersion)" />
<!-- 17.3.2 is the last MSBuild version that targets .NET 6. If it is
updated without updating the target framework, restoring will not fail
because NuGet will pick the .NET Standard 2.0 target, but because NS2.0
only provides reference assemblies, the assemblies will not be copied to
the output directory, and we will get missing assembly errors at runtime. -->
<PackageReference Include="Microsoft.Build.Framework" Version="17.3.2" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.3.2" />
<PackageReference Include="MSBuild.StructuredLogger" Version="2.2.374" />
<PackageReference Include="Scriban" Version="5.11.0" />
</ItemGroup>
</Project>
Loading

0 comments on commit 43454fe

Please sign in to comment.