Skip to content
Open

Cron #83

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI

on:
push:
branches: [ "main" ]

jobs:
build:
name: CI
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up .Net Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0

- name: dotnet test
run: dotnet test --configuration Release

- name: dotnet publish
run: dotnet publish src/GitHubActionsDotNet.Api/GitHubActionsDotNet.Api.csproj --configuration Release -o artifcats

- name: upload artifactes
uses: actions/upload-artifact@v4
with:
name: lab-artifact
path: artifcats/
17 changes: 17 additions & 0 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Run every minute
# set this to the .NET Core version to use
on:
schedule:
- cron: "*/5 * * * *"


jobs:
cron:
name: Run every 5 minutes
runs-on: ubuntu-latest

steps:
- name: Greetings
run: echo "Hello World"


32 changes: 32 additions & 0 deletions .github/workflows/pr-verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: PR Verify

env:
AZURE_WEBAPP_NAME: your-app-name # set this to the name of your Azure Web App
AZURE_WEBAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: '5' # set this to the .NET Core version to use

on:
pull_request:
branches: [ "main" ]

jobs:
build:
name: PR Verify
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0

- name: Build with dotnet
run: dotnet build --configuration Release

- name: DotNet Test
run: dotnet test --configuration Release --no-build

- name: DotNet Fromatting
run: dotnet format -v detailed --verify-no-changes
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.0",
"version": "9.0.0",
"rollForward": "latestMinor",
"allowPrerelease": false
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ public class WeatherForecastController : ControllerBase
];

[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> Get() => Enumerable.Range(1, 5).Select(index => new WeatherForecast
public IEnumerable<WeatherForecast> Get() => [.. Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
})];
}
2 changes: 1 addition & 1 deletion src/GitHubActionsDotNet.Api/GitHubActionsDotNet.Api.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down