Skip to content

Commit f50cd34

Browse files
authored
try fix release build (#357)
* fix release build * add release build test in ci * ci release * fix space * format * fix * fix * fix build * fix tests
1 parent 668d64a commit f50cd34

File tree

4 files changed

+37
-22
lines changed

4 files changed

+37
-22
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ jobs:
2323
args: --config .swiftlint.yml --strict
2424

2525
test:
26-
name: Build and Test
26+
name: Build and Test (${{ matrix.config }})
2727
runs-on: [self-hosted, linux]
28-
timeout-minutes: 30
28+
timeout-minutes: 40
29+
strategy:
30+
matrix:
31+
config: [debug, release]
2932
steps:
3033
- name: Checkout Code
3134
uses: actions/checkout@v4
@@ -42,8 +45,9 @@ jobs:
4245
uses: runs-on/cache@v4
4346
with:
4447
path: '**/.build'
45-
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
48+
key: ${{ runner.os }}-spm-${{ matrix.config }}-${{ hashFiles('**/Package.resolved') }}
4649
restore-keys: |
50+
${{ runner.os }}-spm-${{ matrix.config }}-
4751
${{ runner.os }}-spm-
4852
env:
4953
RUNS_ON_S3_BUCKET_CACHE: laminar-gh-action-cache
@@ -87,6 +91,17 @@ jobs:
8791
- name: Check rust format
8892
run: cargo +nightly fmt --all -- --check
8993
- name: Build
90-
run: make build
94+
run: |
95+
if [ "${{ matrix.config }}" = "release" ]; then
96+
make deps
97+
./scripts/run.sh build -c release -Xswiftc -enable-testing -Xswiftc -Onone -Xswiftc -whole-module-optimization -Xswiftc -package-cmo -Xswiftc -unavailable-decl-optimization=complete
98+
else
99+
make build
100+
fi
91101
- name: Test
92-
run: make test-all
102+
run: |
103+
if [ "${{ matrix.config }}" = "release" ]; then
104+
./scripts/runTests.sh test -c release -Xswiftc -enable-testing -Xswiftc -Onone -Xswiftc -whole-module-optimization -Xswiftc -package-cmo -Xswiftc -unavailable-decl-optimization=complete
105+
else
106+
make test-all
107+
fi

Blockchain/Sources/Blockchain/RuntimeProtocols/Safrole.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,8 @@ extension Safrole {
257257
let validatorQueueWithoutOffenders = withoutOffenders(offenders: offenders, validators: validatorQueue)
258258

259259
let newCommitment = {
260-
try Bandersnatch.RingCommitment(
261-
ring: validatorQueueWithoutOffenders.map { try? Bandersnatch.PublicKey(data: $0.bandersnatch) },
262-
ctx: ctx
263-
).data
260+
let ring = validatorQueueWithoutOffenders.map { try? Bandersnatch.PublicKey(data: $0.bandersnatch) }
261+
return try withExtendedLifetime(ring) { try Bandersnatch.RingCommitment(ring: ring, ctx: ctx).data }
264262
}
265263
let verifier = Bandersnatch.Verifier(ctx: ctx, commitment: commitment)
266264

Utils/Tests/UtilsTests/DebugCheckTests.swift

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,20 @@ struct DebugCheckTests {
1616

1717
@Test
1818
func testDebugCheck() async throws {
19-
try #expect(doesThrow {
20-
try debugCheck(1 + 1 == 2)
21-
} == true)
22-
#expect(throws: DebugCheckError.self) {
23-
try debugCheck(1 + 1 == 3)
24-
}
25-
try await #expect(awaitThrow {
26-
try await debugCheck(1 + 1 == 2)
27-
} == true)
19+
#if DEBUG_ASSERT
20+
try #expect(doesThrow {
21+
try debugCheck(1 + 1 == 2)
22+
} == true)
23+
#expect(throws: DebugCheckError.self) {
24+
try debugCheck(1 + 1 == 3)
25+
}
26+
try await #expect(awaitThrow {
27+
try await debugCheck(1 + 1 == 2)
28+
} == true)
2829

29-
await #expect(throws: DebugCheckError.self) {
30-
try await debugCheck(1 + 1 == 3)
31-
}
30+
await #expect(throws: DebugCheckError.self) {
31+
try await debugCheck(1 + 1 == 3)
32+
}
33+
#endif
3234
}
3335
}

scripts/release.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RUN make deps
1717

1818
WORKDIR /boka/Boka
1919

20-
RUN swift build -c release -Xswiftc -Onone -Xswiftc -whole-module-optimization -Xswiftc -package-cmo -Xswiftc -unavailable-decl-optimization=complete
20+
RUN swift build -c release -Xswiftc -Onone -Xswiftc -whole-module-optimization -Xswiftc -package-cmo -Xswiftc -unavailable-decl-optimization=complete
2121

2222
RUN cp $(swift build --show-bin-path -c release)/Boka /boka/boka-bin
2323

0 commit comments

Comments
 (0)