Skip to content

Commit 22745fb

Browse files
committed
Add consistent testing to actions
1 parent 1d6b9fa commit 22745fb

File tree

2 files changed

+61
-7
lines changed

2 files changed

+61
-7
lines changed

.github/workflows/build_linux.yml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,20 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17+
handle-syncwith:
18+
if: github.event_name == 'pull_request'
19+
name: Call Reusable SyncWith Handler
20+
uses: NilFoundation/ci-cd/.github/workflows/reusable-handle-syncwith.yml@v1
21+
with:
22+
ci-cd-ref: 'v1'
23+
secrets: inherit
24+
1725
build-linux:
1826
runs-on: [ self-hosted, Linux, amd64 ]
1927

28+
needs:
29+
- handle-syncwith
30+
2031
env:
2132
CONTAINER_TMP: /opt/
2233
HOST_TMP: /home/runner/work/_temp/
@@ -49,21 +60,37 @@ jobs:
4960
cmake --version
5061
5162
- name: Checkout sources
63+
# We need full history, because during CMake config stage we are finding the nearest tag
5264
uses: actions/checkout@v3
5365
with:
54-
submodules: 'recursive'
5566
fetch-depth: 0
56-
57-
- name: Clean index.lock files if checkout step was cancelled or failed
58-
if: cancelled() || failure()
59-
run: |
60-
find .git -name 'index.lock' -exec rm -v {} \;
67+
submodules: false
6168

6269
# Workaround: https://github.com/actions/checkout/issues/1169
6370
- name: Mark directory as safe
6471
run: |
6572
git config --system --add safe.directory $PWD
6673
74+
- name: Checkout submodules
75+
run: |
76+
git submodule update --init --recursive --depth=1
77+
78+
- name: Checkout modules to specified refs
79+
if: needs.handle-syncwith.outputs.prs-refs != ''
80+
uses: NilFoundation/ci-cd/actions/recursive-checkout@v1
81+
# TODO: figure out the mapping of volumes and use variable here, not hardcoded path
82+
with:
83+
paths: |
84+
/__w/zkLLVM/zkLLVM/**
85+
!/__w/zkLLVM/zkLLVM/
86+
!/__w/zkLLVM/zkLLVM/**/.git/**
87+
refs: ${{ needs.handle-syncwith.outputs.prs-refs }}
88+
89+
- name: Clean index.lock files if checkout step was cancelled or failed
90+
if: cancelled() || failure()
91+
run: |
92+
find .git -name 'index.lock' -exec rm -v {} \;
93+
6794
- name: Install boost
6895
uses: MarkusJx/[email protected]
6996
id: install-boost

.github/workflows/build_macos.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,21 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17+
handle-syncwith:
18+
if: github.event_name == 'pull_request'
19+
name: Call Reusable SyncWith Handler
20+
uses: NilFoundation/ci-cd/.github/workflows/reusable-handle-syncwith.yml@v1
21+
with:
22+
ci-cd-ref: 'v1'
23+
fetch-only: true
24+
secrets: inherit
25+
1726
build-macos:
1827
runs-on: [ macos-11 ]
1928

29+
needs:
30+
- handle-syncwith
31+
2032
steps:
2133
- name: Install homebrew
2234
run: >
@@ -49,10 +61,25 @@ jobs:
4961
echo PATH: $PATH
5062
5163
- name: Checkout sources
64+
# We need full history, because during CMake config stage we are finding the nearest tag
5265
uses: actions/checkout@v3
5366
with:
54-
submodules: 'recursive'
5567
fetch-depth: 0
68+
submodules: false
69+
70+
- name: Checkout submodules
71+
run: |
72+
git submodule update --init --recursive --depth=1
73+
74+
- name: Checkout modules to specified refs
75+
if: needs.handle-syncwith.outputs.prs-refs != ''
76+
uses: NilFoundation/ci-cd/actions/recursive-checkout@v1
77+
with:
78+
paths: |
79+
${{ github.workspace }}/**
80+
!${{ github.workspace }}
81+
!${{ github.workspace }}/**/.git/**
82+
refs: ${{ needs.handle-syncwith.outputs.prs-refs }}
5683

5784
- name: Enable ccache
5885
uses: hendrikmuhs/[email protected]

0 commit comments

Comments
 (0)