diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0d69040 --- /dev/null +++ b/Makefile @@ -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 + + diff --git a/Tests/BcryptTests/BcryptTests.swift b/Tests/BcryptTests/BcryptTests.swift index 8daf096..50d4225 100644 --- a/Tests/BcryptTests/BcryptTests.swift +++ b/Tests/BcryptTests/BcryptTests.swift @@ -1,5 +1,5 @@ -import XCTest import Bcrypt +import XCTest final class BcryptTests: XCTestCase { func testVerify() throws { @@ -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) @@ -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" + ) ]