Skip to content

Commit

Permalink
F2calv/2024 08 updates (#179)
Browse files Browse the repository at this point in the history
* tidy

* nuget update

* fix ci

* add pre-commit

* remove old ado pipeline

* update devcontainer

* lint fixes
  • Loading branch information
f2calv authored Aug 27, 2024
1 parent 5c19639 commit f247d62
Show file tree
Hide file tree
Showing 41 changed files with 128 additions and 188 deletions.
45 changes: 0 additions & 45 deletions .azure-pipelines/azure-pipelines.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .devcontainer/Dockerfile

This file was deleted.

82 changes: 24 additions & 58 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,59 +1,25 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.231.3/containers/dotnet
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
{
"name": "C# (.NET)",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update 'VARIANT' to pick a .NET Core version: 3.1, 5.0, 6.0
// Append -bookworm or -focal to pin to an OS version.
"VARIANT": "8.0",
// Options
"NODE_VERSION": "lts/*"
}
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-dotnettools.csharp"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [5000, 5001],
// [Optional] To reuse of your local HTTPS dev cert:
//
// 1. Export it locally using this command:
// * Windows PowerShell:
// dotnet dev-certs https --trust; dotnet dev-certs https -ep "$env:USERPROFILE/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
// * macOS/Linux terminal:
// dotnet dev-certs https --trust; dotnet dev-certs https -ep "${HOME}/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
//
// 2. Uncomment these 'remoteEnv' lines:
// "remoteEnv": {
// "ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere",
// "ASPNETCORE_Kestrel__Certificates__Default__Path": "/home/vscode/.aspnet/https/aspnetapp.pfx",
// },
//
// 3. Do one of the following depending on your scenario:
// * When using GitHub Codespaces and/or Remote - Containers:
// 1. Start the container
// 2. Drag ~/.aspnet/https/aspnetapp.pfx into the root of the file explorer
// 3. Open a terminal in VS Code and run "mkdir -p /home/vscode/.aspnet/https && mv aspnetapp.pfx /home/vscode/.aspnet/https"
//
// * If only using Remote - Containers with a local container, uncomment this line instead:
// "mounts": [ "source=${env:HOME}${env:USERPROFILE}/.aspnet/https,target=/home/vscode/.aspnet/https,type=bind" ],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "dotnet restore",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"features": {
"git": "latest",
"powershell": "latest"
}
}
"name": "C# (.NET)",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/dotnet:1-8.0-bookworm",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [5000, 5001],
// "portsAttributes": {
// "5001": {
// "protocol": "https"
// }
// }
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "sh . ./.devcontainer/postCreateCommand.sh",
"postStartCommand": "sh . ./.devcontainer/postStartCommand.sh",
// Configure tool-specific properties.
// "customizations": {},
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
15 changes: 15 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

echo "postCreateCommand.sh"
echo "--------------------"

sudo apt-get update
# sudo apt-get install -y python3 pip pre-commit

# echo "Setup pre-commit"
#pre-commit
#pre-commit install --install-hooks
#pre-commit run --all-files --verbose
#pre-commit autoupdate

sudo chmod +x .devcontainer/postStartCommand.sh
12 changes: 12 additions & 0 deletions .devcontainer/postStartCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

echo "postStartCommand.sh"
echo "-------------------"

sudo apt-get update
sudo apt-get upgrade -y

dotnet --version
pre-commit autoupdate

echo "Done"
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ version: 2
updates:

- package-ecosystem: github-actions
directory: "/"
directory: /
schedule:
interval: weekly
time: "04:00"

- package-ecosystem: nuget
directory: "/"
directory: /
schedule:
interval: weekly
time: "04:00"
Expand All @@ -18,4 +18,4 @@ updates:
- dependency-name: coverlet.*
- dependency-name: Microsoft.NET.Test.Sdk
- dependency-name: Newtonsoft.Json
- dependency-name: xunit.*
- dependency-name: xunit.*
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,37 @@ name: ci
on:
workflow_dispatch:
inputs:
BuildConfiguration:
configuration:
type: choice
description: Build Configuration
required: true
default: Release
options:
- Release
- Debug
PublishPreview:
push-preview:
type: string
description: Publish preview branch?
description: Push preview branch?
required: true
default: "false"
push:
branches-ignore:
- "preview/**"
paths-ignore:
- ".azure-pipelines/**"
- LICENSE
- README.md
pull_request:
branches: [main]
types: [opened, synchronize, reopened]

jobs:
lint:
uses: f2calv/gha-workflows/.github/workflows/lint.yml@v1

ci:
uses: f2calv/gha-workflows/.github/workflows/dotnet-publish-nuget.yml@v1
with:
BuildConfiguration: ${{ github.event.inputs.BuildConfiguration }}
PublishPreview: ${{ github.event.inputs.PublishPreview }}
configuration: ${{ github.event.inputs.configuration }}
push-preview: ${{ github.event.inputs.push-preview }}
secrets:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v3
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-xml
- id: check-yaml
args: [--allow-multiple-documents]
#- id: check-json #Note: now we are using check-json5
- id: check-added-large-files
args: [--maxkb=50]
- id: end-of-file-fixer
- id: trailing-whitespace
- id: double-quote-string-fixer
- repo: https://gitlab.com/bmares/check-json5
rev: v1.0.0
hooks:
- id: check-json5
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.41.0
hooks:
- id: markdownlint
args: ["--disable", "MD013", "--disable", "MD034", "--"]
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
"processId": "${command:pickProcess}"
}
]
}
}
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@
"problemMatcher": "$msCompile"
}
]
}
}
8 changes: 2 additions & 6 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>

Expand All @@ -45,10 +45,6 @@
<NoWarn>CS0162</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>

<PropertyGroup>
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>
Expand All @@ -57,4 +53,4 @@
<None Include="..\..\icon.png" Pack="true" PackagePath="\"/>
</ItemGroup>

</Project>
</Project>
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

## _Unofficial_ Google Photos Library API wrapper library for .NET applications

[azdo-badge]: https://dev.azure.com/f2calv/github/_apis/build/status/f2calv.CasCap.Apis.GooglePhotos?branchName=master
[azdo-url]: https://dev.azure.com/f2calv/github/_build/latest?definitionId=7&branchName=master
[azdo-coverage-url]: https://img.shields.io/azure-devops/coverage/f2calv/github/7
[cascap.apis.googlephotos-badge]: https://img.shields.io/nuget/v/CasCap.Apis.GooglePhotos?color=blue
[cascap.apis.googlephotos-url]: https://nuget.org/packages/CasCap.Apis.GooglePhotos

Expand Down
2 changes: 1 addition & 1 deletion clean.ps1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Get-ChildItem .\ -Include bin, obj -Recurse | ForEach-Object { Remove-Item $_.fullname -Force -Recurse }
Get-ChildItem .\ -Include bin, obj -Recurse | ForEach-Object { Remove-Item $_.fullname -Force -Recurse }
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"sdk": {
"allowPrerelease": false
}
}
}
9 changes: 0 additions & 9 deletions nuget.config

This file was deleted.

2 changes: 1 addition & 1 deletion samples/ConsoleApp/ConsoleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
<ProjectReference Include="..\..\src\CasCap.Apis.GooglePhotos\CasCap.Apis.GooglePhotos.csproj" />
</ItemGroup>

</Project>
</Project>
2 changes: 1 addition & 1 deletion samples/ConsoleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@
i++;
Console.WriteLine($"{i}\t{item.filename}\t{item.mediaMetadata.width}x{item.mediaMetadata.height}");
}
if (i == 0) throw new Exception("retrieve media items by album id failed!");
if (i == 0) throw new Exception("retrieve media items by album id failed!");
2 changes: 1 addition & 1 deletion samples/GenericHost/GenericHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
<Content Include="appsettings.json" CopyToOutputDirectory="Always" />
</ItemGroup>

</Project>
</Project>
2 changes: 1 addition & 1 deletion samples/GenericHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ public static void Main(string[] args) =>
services.AddHostedService<MyBackgroundService>();
})
.Build().Run();
}
}
2 changes: 1 addition & 1 deletion samples/GenericHost/Services/MyBackgroundService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ protected async override Task ExecuteAsync(CancellationToken cancellationToken)
_logger.LogDebug($"exiting {nameof(ExecuteAsync)}...");
_appLifetime.StopApplication();
}
}
}
2 changes: 1 addition & 1 deletion samples/GenericHost/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
//"FileDataStoreFullPathOverride": "c:/mnt/pi/"
}
}
}
}
Loading

0 comments on commit f247d62

Please sign in to comment.