Skip to content

Commit 288970f

Browse files
committed
feat(workflows): add BuildAtom workflow with caching support
Introduced a new `BuildAtom` job in the GitHub Actions workflow (`Build.yml`) to handle the `.atom` build process. Implemented custom caching logic using `actions/cache` for build artifacts to improve efficiency. Added `CleanAtomDirectory` and updated `Build.cs` to support cleanup and caching configurations.
1 parent 9d2e76c commit 288970f

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

.github/workflows/Build.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,44 @@ jobs:
5050
env:
5151
pull-request-number: ${{ github.event.number }}
5252

53+
BuildAtom:
54+
runs-on: ubuntu-latest
55+
steps:
56+
57+
- name: Checkout
58+
uses: actions/checkout@v4
59+
with:
60+
fetch-depth: 0
61+
62+
- uses: actions/setup-dotnet@v4
63+
with:
64+
dotnet-version: '10.0.x'
65+
66+
- name: cache-restore-atom-build
67+
id: cache-restore-atom-build
68+
uses: actions/cache/restore@v4
69+
with:
70+
path: |
71+
'.atom'
72+
key: ${{ format('{0}-atom-build-{1}', runner.os, hashFiles('_atom/**')) }}
73+
74+
- name: BuildAtom
75+
id: BuildAtom
76+
run: ${{ steps.cache-restore-atom-build.outputs.cache-hit && format('.atom/{0} -- BuildAtom --skip --headless', runner.os == 'windows' && '_atom.exe' || '_atom') || 'dotnet run --project _atom/_atom.csproj -- BuildAtom --skip --headless' }}
77+
78+
- run: rm -rf '_atom/bin'
79+
80+
- run: rm -rf '_atom/obj'
81+
82+
- name: cache-save-atom-build
83+
id: cache-save-atom-build
84+
uses: actions/cache/save@v4
85+
if: steps.cache-restore-atom-build.outputs.cache-hit != true
86+
with:
87+
path: |
88+
'.atom'
89+
key: ${{ format('{0}-atom-build-{1}', runner.os, hashFiles('_atom/**')) }}
90+
5391
PackProjects:
5492
runs-on: ubuntu-latest
5593
steps:

_atom/Build.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ internal partial class Build : BuildDefinition,
128128
})
129129
.WithOptions(WorkflowOptions.Inject.Param(WorkflowParams.PullRequestNumber,
130130
"github.event.number")),
131+
WorkflowTargets.BuildAtom.WithOptions(new CleanAtomDirectory("_atom/bin"),
132+
new CleanAtomDirectory("_atom/obj"),
133+
WorkflowOptions.Cache.Save("atom-build",
134+
"${{ format('{0}-atom-build-{1}', runner.os, hashFiles('_atom/**')) }}",
135+
[WorkflowExpressions.From(".atom")])),
131136
WorkflowTargets.PackProjects,
132137
WorkflowTargets.PackTool.WithGithubRunsOnMatrix(PlatformNames),
133138
WorkflowTargets

0 commit comments

Comments
 (0)