@@ -23,34 +23,34 @@ bootstrap:
23
23
&& git config --global user.name "Earthly Build"
24
24
# I'm using Invoke-Build tasks from this other repo which rarely changes
25
25
COPY tasks+tasks/* /Tasks
26
- # Dealing with dependencies first allows docker to cache packages for us
27
- # So the dependency cach only re-builds when you add a new dependency
26
+ # Dealing with dependencies first allows earthly ( docker) to cache layers for us
27
+ # So the dependency cache only re-builds when you change the list in these files
28
28
COPY build.requires.psd1 .
29
29
# COPY *.csproj .
30
30
RUN ["pwsh" , "-File" , "/Tasks/_Bootstrap.ps1" , "-RequiresPath" , "build.requires.psd1" ]
31
31
32
32
build :
33
33
FROM +bootstrap
34
34
RUN mkdir $OUTPUT_ROOT $TEST_ROOT $TEMP_ROOT
35
+ # make sure you have output folders (like bin, obj, Modules) in .earthlyignore
36
+ # NOTE: we copy .git because we use GitVersion in the build to calculate the version
37
+ # To avoid that, we could pass the version as an ARG
35
38
COPY . .
36
- # make sure you have bin and obj in .earthlyignore, as their content from context might cause problems
37
39
RUN ["pwsh" , "-Command" , "Invoke-Build" , "-Task" , "Build" , "-File" , "Build.build.ps1" ]
38
40
39
41
# SAVE ARTIFACT [--keep-ts] [--keep-own] [--if-exists] [--force] <src> [<artifact-dest-path>] [AS LOCAL <local-path>]
40
42
SAVE ARTIFACT $OUTPUT_ROOT/$MODULE_NAME AS LOCAL ./Modules/$MODULE_NAME
41
43
42
44
test :
43
- # If we run a target as a reference in FROM or COPY, it's outputs will not be produced
44
45
FROM +build
45
- # make sure you have bin and obj in .earthlyignore, as their content from context might cause problems
46
46
RUN ["pwsh" , "-Command" , "Invoke-Build" , "-Task" , "Test" , "-File" , "Build.build.ps1" ]
47
47
48
48
# re-output the build output so we can rely on running just +test locally
49
49
SAVE ARTIFACT $OUTPUT_ROOT/$MODULE_NAME AS LOCAL ./Modules/$MODULE_NAME
50
50
SAVE ARTIFACT $TEST_ROOT AS LOCAL ./Modules/$MODULE_NAME -TestResults
51
51
52
52
all :
53
- BUILD +build
53
+ # If we only reference with FROM (or COPY) the outputs will not be produced
54
54
BUILD +test
55
55
FROM +build
56
56
RUN --push --secret NUGET_API_KEY --secret PSGALLERY_API_KEY -- \
0 commit comments