Skip to content

Commit

Permalink
🖆 Apply kzu/oss template via dotnet-file
Browse files Browse the repository at this point in the history
  • Loading branch information
kzu committed Dec 21, 2020
1 parent e0ac0ff commit 4b77870
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 61 deletions.
5 changes: 1 addition & 4 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
custom: https://paypal.me/kzu
patreon: danielkzu
open_collective: kzu
liberapay: kzu
github: devloooped
26 changes: 18 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,23 @@ defaults:
shell: bash

jobs:
dotnet-format:
runs-on: ubuntu-latest
steps:
- name: 🤘 checkout
uses: actions/checkout@v2
- name: ⚙ dotnet 3.1.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
- name: ✓ ensure format
run: |
dotnet tool update -g --version 4.1.* dotnet-format
dotnet format -f src --check -v:diag
build:
name: build-${{ matrix.os }}
needs: dotnet-format
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -42,27 +57,22 @@ jobs:
with:
dotnet-version: 2.1.x

- name: ✓ check formatting
run: |
dotnet tool update -g --version 4.1.* dotnet-format >nul || dotnet tool list -g
dotnet format -f src --check -v:diag
- name: 🙏 build
run: dotnet build -m:1 -bl:build.binlog -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER"
run: dotnet build -m:1 -bl:build.binlog -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER" -p:RepositoryBranch=${GITHUB_REF#refs/*/}

- name: 🧪 test
run: dotnet test --no-build -m:1 --blame-hang --blame-hang-timeout 5m -d $GITHUB_WORKSPACE/logs/${{ matrix.os }}.txt -r $GITHUB_WORKSPACE/logs

- name: 📦 pack
run: dotnet pack -m:1 -bl:pack.binlog -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER"
run: dotnet pack -m:1 -bl:pack.binlog -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER" -p:RepositoryBranch=${GITHUB_REF#refs/*/}

- name: 🔼 logs
if: always()
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}
path: |
*.binlog
**/*.binlog
logs/**/*.*
# Only push CI package to sleet feed if building on ubuntu (fastest)
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ jobs:
dotnet-version: 2.1.x

- name: 🙏 build
run: dotnet build -m:1 -bl:build.binlog -p:version=${GITHUB_REF#refs/*/v}
run: dotnet build -m:1 -bl:build.binlog -p:version=${GITHUB_REF#refs/*/v} -p:RepositoryBranch=${GITHUB_REF#refs/*/}

- name: 🧪 test
run: dotnet test --no-build -m:1

- name: 📦 pack
run: dotnet pack -m:1 -bl:pack.binlog -p:version=${GITHUB_REF#refs/*/v}
run: dotnet pack -m:1 -bl:pack.binlog -p:version=${GITHUB_REF#refs/*/v} -p:RepositoryBranch=${GITHUB_REF#refs/*/}

- name: 🔼 logs
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
path: '*.binlog'
path: '**/*.binlog'

- name: 🚀 nuget
run: dotnet nuget push ./bin/**/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} --skip-duplicate
16 changes: 10 additions & 6 deletions .netconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
weak
[file ".github/FUNDING.yml"]
url = https://github.com/kzu/oss/blob/main/.github/FUNDING.yml
etag = dbc0e0c56e48bf06a70f50ba2fdaf6f048bb81ac8558b743c8e919487da3bfcf
etag = 175f855cce8867cc01b44fd7b0d9985f7280d7b545db9ec8e1b07eca8ef85f82
weak
[file ".github/ISSUE_TEMPLATE/bug.md"]
url = https://github.com/kzu/oss/blob/main/.github/ISSUE_TEMPLATE/bug.md
Expand All @@ -31,11 +31,11 @@
weak
[file ".github/workflows/build.yml"]
url = https://github.com/kzu/oss/blob/main/.github/workflows/build.yml
etag = c56db40b37f8dbcff13aea20eefc263caf825d17d86b0dc055ce504d8cb8ae9d
etag = 868172e62b2cac855039731fd1ea929f0a569f675586903450d24bc232c43ea9
weak
[file ".github/workflows/release.yml"]
url = https://github.com/kzu/oss/blob/main/.github/workflows/release.yml
etag = 0142be91e1ec4607aa398975c4e066ea07f9a610b412eaf53f9f2f9d86aa70fc
etag = 9035cfc96bc6340476e196699695b49a19066039e8774497659413f8a8cb8e2a
weak
[file ".github/workflows/tag.yml"]
url = https://github.com/kzu/oss/blob/main/.github/workflows/tag.yml
Expand Down Expand Up @@ -67,15 +67,15 @@
weak
[file "security.md"]
url = https://github.com/kzu/oss/blob/main/security.md
etag = 80070e3a380796b13d180b82f43694eac9e7a29d8d2f8549ccb2920fd5c88828
etag = fc8101fd914820db3e6b42d608dc46aefbc60c830ac721ed3917daead3727dbd
weak
[file "src/Directory.Build.props"]
url = https://github.com/kzu/oss/blob/main/src/Directory.Build.props
etag = d0b93d7533832a4d62cff69c71540bad3284bf92a7d2096b1a91607d72099d2b
etag = 1ea71942b9ff7830612ceb3a2927c0d011c54891a7653b07ef01b914347e306f
weak
[file "src/Directory.Build.targets"]
url = https://github.com/kzu/oss/blob/main/src/Directory.Build.targets
etag = a8ae94f091decde21c9f9b2d851647c1cb573746956c29448346d0ccb1478652
etag = 236390b1c5b2576d6d013656e24f6d74a0042a0e4071a19e8c626cf6b7005b54
weak
[file "src/kzu.snk"]
url = https://github.com/kzu/oss/blob/main/src/kzu.snk
Expand All @@ -85,3 +85,7 @@
url = https://github.com/kzu/oss/blob/main/.github/ISSUE_TEMPLATE/config.yml
etag = b5ce64e6967276086eb89f86f57364da9c4deac988c7e0e04810a4f8caaa1400
weak
[file "support.md"]
url = https://github.com/devlooped/oss/blob/main/support.md
etag = 2d47e2fc4fdfa3515203d452674566e3df507461f9938f451a06d79deb687d24
weak
4 changes: 2 additions & 2 deletions security.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

## Reporting a Vulnerability

Security issues and bugs should be reported privately by emailing [email protected].
Security issues and bugs should be reported privately by emailing [email protected].
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your
original message and ping [@kzu](https://twitter.com/kzu) on Twitter.
original message and ping [@devlooped](https://twitter.com/devlooped) on Twitter.

Please do not open issues for anything you think might have a security implication.
49 changes: 26 additions & 23 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
<Project>
<!-- To extend/change the defaults, create a Directory.props alongside this file -->

<PropertyGroup Label="CI" Condition="'$(CI)' == ''">
<CI>false</CI>
<!-- GH, CircleCI, GitLab and BitBucket already use CI -->
<CI Condition="'$(TF_BUILD)' == 'true' or
'$(TEAMCITY_VERSION)' != '' or
'$(APPVEYOR)' != '' or
'$(BuildRunner)' == 'MyGet' or
'$(JENKINS_URL)' != '' or
'$(TRAVIS)' == 'true' or
'$(BUDDY)' == 'true'">true</CI>
</PropertyGroup>

<PropertyGroup>
<!-- The Microsoft.Managed.Core.targets use this property to use deterministic source paths in CI builds -->
<ContinuousIntegrationBuild>$(CI)</ContinuousIntegrationBuild>
</PropertyGroup>

<PropertyGroup Label="NuGet">
<Authors>kzu</Authors>
<Copyright>Copyright (C) Daniel Cazzulino and Contributors. All rights reserved.</Copyright>
Expand All @@ -21,11 +38,10 @@

<ItemGroup Label="NuGet">
<!-- This is compatible with nugetizer and SDK pack -->
<Content Include="$(MSBuildThisFileDirectory)icon.png" Link="icon.png"
CopyToOutputDirectory="PreserveNewest"
Pack="true"
Visible="false"
PackagePath="%(Filename)%(Extension)" />
<None Include="$(MSBuildThisFileDirectory)icon.png" Link="icon.png"
Pack="true"
Visible="false"
PackagePath="%(Filename)%(Extension)" />
</ItemGroup>

<PropertyGroup Label="Build">
Expand Down Expand Up @@ -68,6 +84,11 @@

<!-- See: https://www.cazzulino.com/project-dependencies-as-project-references.html -->
<AddSyntheticProjectReferencesForSolutionDependencies>false</AddSyntheticProjectReferencesForSolutionDependencies>

<!-- Don't warn for packages using semver 2.0 -->
<NoWarn>NU5105;$(NoWarn)</NoWarn>
<!-- Turn warnings into errors in CI or Release builds -->
<WarningsAsErrors Condition="$(CI) or '$(Configuration)' == 'Release'">true</WarningsAsErrors>
</PropertyGroup>

<PropertyGroup Label="Version">
Expand Down Expand Up @@ -106,23 +127,5 @@
<ProjectProperty Include="PublicKeyToken" />
</ItemGroup>


<PropertyGroup Label="CI" Condition="'$(CI)' == ''">
<CI>false</CI>
<!-- GH, CircleCI, GitLab and BitBucket already use CI -->
<CI Condition="'$(TF_BUILD)' == 'true' or
'$(TEAMCITY_VERSION)' != '' or
'$(APPVEYOR)' != '' or
'$(BuildRunner)' == 'MyGet' or
'$(JENKINS_URL)' != '' or
'$(TRAVIS)' == 'true' or
'$(BUDDY)' == 'true'">true</CI>
</PropertyGroup>

<PropertyGroup>
<!-- The Microsoft.Managed.Core.targets use this property to use deterministic source paths in CI builds -->
<ContinuousIntegrationBuild>$(CI)</ContinuousIntegrationBuild>
</PropertyGroup>

<Import Project="Directory.props" Condition="Exists('Directory.props')"/>
</Project>
34 changes: 19 additions & 15 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -59,32 +59,36 @@
</ItemGroup>

<!-- Make sure the source control info is available before calling source generators -->
<Target Name="EnsureProjectInformation" BeforeTargets="GenerateMSBuildEditorConfigFileShouldRun" DependsOnTargets="InitializeSourceControlInformation" />
<Target Name="EnsureProjectInformation"
BeforeTargets="GenerateMSBuildEditorConfigFileShouldRun"
AfterTargets="InitializeSourceControlInformation"
DependsOnTargets="InitializeSourceControlInformation">

<PropertyGroup Condition="'$(SourceControlInformationFeatureSupported)' == 'true'">
<!-- The project must specify PublishRepositoryUrl=true in order to publish the URL, in order to prevent inadvertent leak of internal URL. -->
<RepositoryUrl Condition="'$(RepositoryUrl)' == '' and '$(PublishRepositoryUrl)' == 'true'">$(PrivateRepositoryUrl)</RepositoryUrl>
</PropertyGroup>

<PropertyGroup Condition="'$(SourceRevisionId)' != ''">
<RepositoryCommit Condition="'$(RepositoryCommit)' == ''">$(SourceRevisionId)</RepositoryCommit>
<RepositorySha Condition="'$(RepositorySha)' == ''">$(SourceRevisionId.Substring(0, 9))</RepositorySha>
<!-- This allows the commit label added to the InformationalVersion to be the short sha instead :) -->
<SourceRevisionId>$(RepositorySha)</SourceRevisionId>
</PropertyGroup>

<Target Name="_InitializeRepositoryProperties"
DependsOnTargets="InitializeSourceControlInformation"
Condition="'$(SourceControlInformationFeatureSupported)' == 'true'">
<PropertyGroup>
</PropertyGroup>
</Target>

<!-- Always append the link to the direct source tree for the current build -->
<Target Name="UpdatePackageMetadata"
BeforeTargets="PrepareForBuild;GenerateMSBuildEditorConfigFileShouldRun;GetAssemblyVersion;GetPackageMetadata;GenerateNuspec;Pack"
DependsOnTargets="InitializeSourceControlInformation"
DependsOnTargets="EnsureProjectInformation"
Condition="'$(SourceControlInformationFeatureSupported)' == 'true' And
'$(IsPackable)' == 'true'">
<PropertyGroup>
<!-- The project must specify PublishRepositoryUrl=true in order to publish the URL, in order to prevent inadvertent leak of internal URL. -->
<RepositoryUrl Condition="'$(RepositoryUrl)' == '' and '$(PublishRepositoryUrl)' == 'true'">$(PrivateRepositoryUrl)</RepositoryUrl>
<PackageProjectUrl Condition="'$(PackageProjectUrl)' == '' and '$(PublishRepositoryUrl)' == 'true'">$(RepositoryUrl)</PackageProjectUrl>
<Description Condition="'$(RepositorySha)' != '' and '$(RepositoryUrl)' != ''">$(Description)

<RepositoryCommit Condition="'$(RepositoryCommit)' == ''">$(SourceRevisionId)</RepositoryCommit>
<RepositorySha Condition="'$(SourceRevisionId)' != ''">$(SourceRevisionId.Substring(0, 9))</RepositorySha>

<Description Condition="'$(SourceRevisionId)' != '' and '$(RepositoryUrl)' != ''">$(Description)

Built from $(RepositoryUrl)/tree/$(SourceRevisionId.Substring(0, 9))
Built from $(RepositoryUrl)/tree/$(RepositorySha)
</Description>
<PackageDescription>$(Description)</PackageDescription>
</PropertyGroup>
Expand Down
9 changes: 9 additions & 0 deletions support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Support

Support is typically available thorugh GitHub Discussions and Issues.

**Found a bug? File an issue.** If you found something that isn't working as expected and you can reproduce it, go to the repo Issues tab and file an issue.

**Want a new feature? Start a discussion.** It's always good to start a discussion (Discussion tab in the project, Ideas category) to explain the problem you're trying to solve before jumping in with the pull request. We may already have a solution in place or have an idea on ways to solve that issue. After the details are nailed down, we will migrate the discussion to a proper Issue (with the `enhancement`) label. At that point, we'd love to see your PRs :).

Consider [sponsoring](https://github.com/sponsors/devlooped) the project to get priority support and many other perks!

0 comments on commit 4b77870

Please sign in to comment.