Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ jobs:
args: --config .swiftlint.yml --strict

test:
name: Build and Test
name: Build and Test (${{ matrix.config }})
runs-on: [self-hosted, linux]
timeout-minutes: 30
timeout-minutes: 45
strategy:
matrix:
config: [debug, release]
steps:
- name: Checkout Code
uses: actions/checkout@v4
Expand All @@ -42,8 +45,9 @@ jobs:
uses: runs-on/cache@v4
with:
path: '**/.build'
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
key: ${{ runner.os }}-spm-${{ matrix.config }}-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-${{ matrix.config }}-
${{ runner.os }}-spm-
env:
RUNS_ON_S3_BUCKET_CACHE: laminar-gh-action-cache
Expand Down Expand Up @@ -87,6 +91,22 @@ jobs:
- name: Check rust format
run: cargo +nightly fmt --all -- --check
- name: Build
run: make build
run: |
if [ "${{ matrix.config }}" = "release" ]; then
./scripts/run.sh build -c release
else
make build
fi
- name: Test
run: make test-all
run: |
if [ "${{ matrix.config }}" = "release" ]; then
# Run release tests for all packages except Boka (test discovery issues)
for file in **/Tests; do
package_dir="$(dirname "$file")"
if [[ "$package_dir" != "Boka" ]]; then
swift test -c release -Xswiftc -enable-testing --package-path "$package_dir"
fi
done
else
make test-all
fi
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
cd ../../Boka

# Build Swift release binary with our static libraries
swift build -c release -Xswiftc -Onone -Xswiftc -whole-module-optimization -Xswiftc -package-cmo -Xswiftc -unavailable-decl-optimization=complete \
swift build -c release \
-Xlinker "$STATIC_LIB_DIR/lib/librocksdb.a" \
-Xlinker "$STATIC_LIB_DIR/lib/liblz4.a" \
-Xlinker "$STATIC_LIB_DIR/lib/libzstd.a" \
Expand Down
6 changes: 2 additions & 4 deletions Blockchain/Sources/Blockchain/RuntimeProtocols/Safrole.swift
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,8 @@ extension Safrole {
let validatorQueueWithoutOffenders = withoutOffenders(offenders: offenders, validators: validatorQueue)

let newCommitment = {
try Bandersnatch.RingCommitment(
ring: validatorQueueWithoutOffenders.map { try? Bandersnatch.PublicKey(data: $0.bandersnatch) },
ctx: ctx
).data
let ring = validatorQueueWithoutOffenders.map { try? Bandersnatch.PublicKey(data: $0.bandersnatch) }
return try withExtendedLifetime(ring) { try Bandersnatch.RingCommitment(ring: ring, ctx: ctx).data }
}
let verifier = Bandersnatch.Verifier(ctx: ctx, commitment: commitment)

Expand Down
31 changes: 19 additions & 12 deletions Utils/Tests/UtilsTests/DebugCheckTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,25 @@ struct DebugCheckTests {

@Test
func testDebugCheck() async throws {
try #expect(doesThrow {
try debugCheck(1 + 1 == 2)
} == true)
#expect(throws: DebugCheckError.self) {
try debugCheck(1 + 1 == 3)
}
try await #expect(awaitThrow {
try await debugCheck(1 + 1 == 2)
} == true)
#if DEBUG_ASSERT
try #expect(doesThrow {
try debugCheck(1 + 1 == 2)
} == true)
#expect(throws: DebugCheckError.self) {
try debugCheck(1 + 1 == 3)
}
try await #expect(awaitThrow {
try await debugCheck(1 + 1 == 2)
} == true)

await #expect(throws: DebugCheckError.self) {
try await debugCheck(1 + 1 == 3)
}
await #expect(throws: DebugCheckError.self) {
try await debugCheck(1 + 1 == 3)
}
#else
try await debugCheck(1 + 1 == 2) // Should not throw
try await debugCheck(1 + 1 == 3) // Should not throw
try await debugCheck(1 + 1 == 2) // Should not throw
try await debugCheck(1 + 1 == 3) // Should not throw
#endif
}
}
2 changes: 1 addition & 1 deletion scripts/release.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN make deps

WORKDIR /boka/Boka

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

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

Expand Down
Loading