Skip to content

Commit

Permalink
format fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mzpx committed Feb 7, 2024
1 parent 9411032 commit 6b34ba4
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 3 deletions.
90 changes: 90 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@


# ----------------------------------------
# Swift
# ----------------------------------------

start:
swift run AVAllianceHummingbirdServer


# docker build -t av-alliance-test-image -f Docker/BlogTests.Dockerfile .
# docker run --name av-alliance-test-instance --rm av-alliance-test-image

run:
swift run App

build:
swift build

release:
swift build -c release

test:
swift test --parallel

test-with-coverage:
swift test --parallel --enable-code-coverage

clean:
rm -rf .build

# ----------------------------------------
# System
# ----------------------------------------

install: release
install ./.build/release/App /usr/local/bin/App

uninstall:
rm /usr/local/bin/App

# ----------------------------------------
# Docker
# ----------------------------------------

docker-build:
docker build \
-t av-alliance-image \
-f ./docker/AVAlliance.Dockerfile \
.

docker-run: docker-build
docker run \
--name av-alliance \
-v $(PWD)/:/app \
-w /app \
-e "PS1=\u@\w: " \
-p 8080:8080 \
--rm \
-it av-alliance-image

docker-clean:
docker rmi av-alliance-image

# swift-format commands

format:
swift-format -i -r ./Sources && swift-format -i -r ./Tests

lint:
swift-format lint -r ./Sources && swift-format lint -r ./Tests

openapi-server:
#docker run -p 8888:8080 -e SWAGGER_JSON=/mnt/openapi.yaml -v ./OpenAPI:/mnt swaggerapi/swagger-ui
docker run --rm --name "openapi-server" \
-v "$(PWD)/OpenAPI:/usr/share/nginx/html" \
-p 8888:80 nginx

openapi-validate:
docker run --rm --name "openapi-validate" \
-v "$(PWD)/OpenAPI/openapi.yaml:/openapi.yaml" \
pythonopenapi/openapi-spec-validator /openapi.yaml

openapi-security-check:
docker run --rm --name "openapi-security-check" \
-v "$(PWD)/OpenAPI:/app" \
-t owasp/zap2docker-weekly zap-api-scan.py \
-t /app/openapi.yaml -f openapi


9 changes: 6 additions & 3 deletions Tests/BcryptTests/BcryptTests.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import XCTest
import Bcrypt
import XCTest

final class BcryptTests: XCTestCase {
func testVerify() throws {
Expand All @@ -8,7 +8,7 @@ final class BcryptTests: XCTestCase {
XCTAssert(result, "\(message): did not match \(desired)")
}
}

func testFail() throws {
let digest = try Bcrypt.hash("foo", cost: 6)
let res = try Bcrypt.verify("bar", created: digest)
Expand All @@ -31,5 +31,8 @@ final class BcryptTests: XCTestCase {
}

let tests: [(String, String)] = [
("$2b$06$xETUbh.9MrhmYsSTXqg5tOJ/Az0WZuVfpYqvcDhYsuqBt3N1qQ7Bm", "binary-birds")
(
"$2b$06$xETUbh.9MrhmYsSTXqg5tOJ/Az0WZuVfpYqvcDhYsuqBt3N1qQ7Bm",
"binary-birds"
)
]

0 comments on commit 6b34ba4

Please sign in to comment.