Skip to content

Commit

Permalink
Update package chaching on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Mpdreamz committed Oct 10, 2024
1 parent 1954595 commit cbad0de
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 18 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/integration-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
- '[0-9]+.[0-9]+'
- '[0-9]+.x'

env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages

jobs:
integration-tests:
name: Tests
Expand All @@ -34,7 +37,7 @@ jobs:
'8.9.0-SNAPSHOT',
'latest-8'
]

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -43,8 +46,8 @@ jobs:
dotnet-version: '8.0.100'
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.[cf]sproj*') }}
restore-keys: |
${{ runner.os }}-nuget-
- uses: actions/cache@v3
Expand All @@ -53,7 +56,7 @@ jobs:
key: ${{ runner.os }}-elastic-managed-${{ matrix.stack_version }}
restore-keys: |
${{ runner.os }}-elastic-managed-
- run: "./build.sh integrate ${{ matrix.stack_version }} random:test_only_one --report"
name: ${{ matrix.stack_version }}
- name: Results ${{ matrix.stack_version }}
Expand All @@ -66,4 +69,4 @@ jobs:
fail_on_failure: true
require_tests: true
check_name: ${{ matrix.stack_version }}

9 changes: 6 additions & 3 deletions .github/workflows/stale-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ on:
- '[0-9]+.[0-9]+'
- '[0-9]+.x'

env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages

jobs:
unit-tests:
name: Documentation
Expand All @@ -27,14 +30,14 @@ jobs:
dotnet-version: '8.0.100'
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.[cf]sproj*') }}
restore-keys: |
${{ runner.os }}-nuget-
- run: ./build.sh documentation
name: Build docs

- run: |
if [ -n "$(git status --porcelain)" ]; then echo Error: changes found after running documentation; git diff; git status; exit 1; fi
name: 'Ensure no stale docs'
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/test-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
- '[0-9]+.[0-9]+'
- '[0-9]+.x'

env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages

jobs:
unit-tests:
name: Unit
Expand All @@ -26,8 +29,8 @@ jobs:
dotnet-version: '8.0.100'
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.[cf]sproj*') }}
restore-keys: |
${{ runner.os }}-nuget-
Expand All @@ -42,7 +45,7 @@ jobs:
fail_on_failure: true
require_tests: true
check_name: Unit Test Results

# Packages nuget packages first and then uses the nuget packages to test
# Also builds versioned nuget packages
canary-tests:
Expand All @@ -56,8 +59,8 @@ jobs:
dotnet-version: '8.0.100'
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.[cf]sproj*') }}
restore-keys: |
${{ runner.os }}-nuget-
Expand All @@ -72,7 +75,7 @@ jobs:
fail_on_failure: true
require_tests: true
check_name: Canary Test Results

# Github packages requires authentication, this is likely going away in the future so for now we publish to feedz.io
# Only runs on builds on heads
- run: dotnet nuget push 'build/output/*.nupkg' -k ${{secrets.FEEDZ_IO_API_KEY}} -s https://f.feedz.io/elastic/all/nuget/index.json --skip-duplicate --no-symbols
Expand Down
4 changes: 1 addition & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
<FileVersion>$(CurrentAssemblyFileVersion)</FileVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<MajorVersion>$(Version.Split('.')[0])</MajorVersion>
<SolutionRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.sh))</SolutionRoot>
<ArtifactsPath>$(MSBuildThisFileDirectory).artifacts</ArtifactsPath>
</PropertyGroup>

<!-- Common Nuget metadata-->
Expand All @@ -35,8 +33,8 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<IsPackable>false</IsPackable>
<EnablePackageValidation>true</EnablePackageValidation>
<OutputPath Condition="'$(OutputPathBaseDir)' != ''">$(OutputPathBaseDir)\$(MSBuildProjectName)\</OutputPath>
<SolutionRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.bat))</SolutionRoot>
<ArtifactsPath>$(MSBuildThisFileDirectory).artifacts</ArtifactsPath>

<DefineConstants Condition="'$(TargetFramework)'=='net461' or '$(TargetFramework)'=='net472'">$(DefineConstants);FULLFRAMEWORK</DefineConstants>
<DefineConstants Condition="$(DefineConstants.Contains(FULLFRAMEWORK)) == False">$(DefineConstants);DOTNETCORE</DefineConstants>
Expand Down
1 change: 0 additions & 1 deletion build/scripts/Building.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ module Build =
"CurrentVersion", (version.Full.ToString());
"CurrentAssemblyVersion", (version.Assembly.ToString());
"CurrentAssemblyFileVersion", (version.AssemblyFile.ToString());
"ContinuousIntegrationBuild", "true";
]
|> List.map (fun (p,v) -> sprintf "%s=%s" p v)
|> String.concat ";"
Expand Down

0 comments on commit cbad0de

Please sign in to comment.