Skip to content

Commit deee812

Browse files
committed
Example of breaking out of Aspect Workflows Setup setup on GitHub Actions
1 parent 9d2db38 commit deee812

File tree

4 files changed

+45
-247
lines changed

4 files changed

+45
-247
lines changed

.github/workflows/.aspect-workflows-reusable.yaml

Lines changed: 0 additions & 183 deletions
This file was deleted.

.github/workflows/aspect-workflows-delivery.yaml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/aspect-workflows-warming.yaml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,18 @@ jobs:
1313
warming-archive:
1414
name: Aspect Workflows Warming
1515
runs-on: [self-hosted, aspect-workflows, aspect-warming]
16-
env:
17-
ASPECT_WORKFLOWS_BIN_DIR: /etc/aspect/workflows/bin
1816
steps:
1917
- name: Workflows environment
20-
run: ${ASPECT_WORKFLOWS_BIN_DIR}/configure_workflows_env
21-
- uses: actions/checkout@v4
18+
run: /etc/aspect/workflows/bin/configure_workflows_env
19+
- name: Clone repo
20+
uses: actions/checkout@v4
2221
- name: Agent health check
2322
# Set RUNNER_TRACKER_ID="" to prevent GitHub Actions from killing the Bazel server started
2423
# during health check when "Cleaning up orphan processes" in the "Complete job" step.
2524
# See https://github.com/actions/runner/issues/598.
26-
run: RUNNER_TRACKER_ID="" && ${ASPECT_WORKFLOWS_BIN_DIR}/agent_health_check
25+
run: RUNNER_TRACKER_ID="" && /etc/aspect/workflows/bin/agent_health_check
2726
- name: Create warming archive
28-
uses: aspect-build/[email protected]
29-
with:
30-
task: warming
27+
run: rosetta run --workspace . warming
28+
shell: bash
3129
- name: Archive warming tars
32-
run: ${ASPECT_WORKFLOWS_BIN_DIR}/warming_archive
30+
run: /etc/aspect/workflows/bin/warming_archive

.github/workflows/aspect-workflows.yaml

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,41 @@ concurrency:
1717
cancel-in-progress: ${{ github.ref_name != 'main' }}
1818

1919
jobs:
20-
aspect-workflows:
21-
name: Aspect Workflows
22-
uses: ./.github/workflows/.aspect-workflows-reusable.yaml
23-
with:
24-
queue: aspect-small
20+
test:
21+
name: Test
22+
runs-on: [self-hosted, aspect-workflows, aspect-default]
23+
steps:
24+
- name: Workflows environment
25+
run: /etc/aspect/workflows/bin/configure_workflows_env
26+
- name: Clone repo
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 1
30+
- name: Agent health check
31+
# Set RUNNER_TRACKER_ID="" to prevent GitHub Actions from killing the Bazel server started during health check when "Cleaning up orphan processes" in the "Complete job" step. See https://github.com/actions/runner/issues/598.
32+
run: RUNNER_TRACKER_ID="" && /etc/aspect/workflows/bin/agent_health_check
33+
- name: Test
34+
run: |
35+
# Clear artifact directories
36+
rm -rf /workflows/artifacts /workflows/testlogs
37+
# Set Aspect Workflows common bazel flags in /etc/bazel.bazelrc
38+
rosetta bazelrc > /etc/bazel.bazelrc
39+
# Run a query
40+
bazel query 'kind("go_test rule", //...)' > targets.out
41+
cat targets.out
42+
# Generate a dynamic Aspect Workflows config file from the query results
43+
/etc/aspect/workflows/bin/jq -R -s 'split("\n") | map(select(. != "")) | {tasks: [{test: {targets: .}}]}' targets.out > .aspect/workflows/dynamic_config.yaml
44+
cat .aspect/workflows/dynamic_config.yaml
45+
# Run the test task from the dynamically generated config file
46+
rosetta run --config .aspect/workflows/dynamic_config.yaml test
47+
shell: bash
48+
- name: Upload artifacts
49+
# The `always()` condition makes this step run even if a previous step failed. Setting `continue-on-error: true` on previous steps isn't ideal as the UI will flag them as having passed even if they failed.
50+
if: ${{ always() }}
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: test.artifact
54+
path: |
55+
/workflows/artifacts/**
56+
/workflows/testlogs/**
57+
overwrite: true

0 commit comments

Comments
 (0)