Argon2Swift
Argon2Swift copied to clipboard
Broken tests on Linux
Current project layout is not compatible with Swift 5.3, opposed to the supported minimum version of toolchain specified in Package.swift.
I ran a build on Linux using Swift 5.3 and got the following error,
[Swift/build-linux-1] 🐳 docker create image=swift:5.3-focal platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Swift/build-linux-1] 🐳 docker run image=swift:5.3-focal platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Swift/build-linux-1] 🐳 docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir=
[Swift/build-linux-1] 🐳 docker cp src=/Users/segabor/Workspace/Argon2Swift/. dst=/Users/segabor/Workspace/Argon2Swift
[Swift/build-linux-1] 🐳 docker exec cmd=[mkdir -p /Users/segabor/Workspace/Argon2Swift] user= workdir=
[Swift/build-linux-1] ⭐ Run actions/checkout@v2
[Swift/build-linux-1] ✅ Success - actions/checkout@v2
[Swift/build-linux-1] ⭐ Run Build
[Swift/build-linux-1] 🐳 docker exec cmd=[sh -e -c /var/run/act/workflow/1.sh] user= workdir=
| lsb_release -r
| /usr/bin/swiftc -print-target-info
| /usr/bin/swiftc -L /usr/lib/swift/pm/4_2 -lPackageDescription -Xlinker -rpath -Xlinker /usr/lib/swift/pm/4_2 -swift-version 5 -I /usr/lib/swift/pm/4_2 -package-description-version 5.3.0 /Users/segabor/Workspace/Argon2Swift/Package.swift -o /tmp/TemporaryDirectory.KqxwBl/argon2swift-manifest
| /tmp/TemporaryDirectory.KqxwBl/argon2swift-manifest -fileno 9
| Running resolver because the following dependencies were added: 'https://github.com/P-H-C/phc-winner-argon2.git'
| /usr/bin/swiftc -L /usr/lib/swift/pm/4_2 -lPackageDescription -Xlinker -rpath -Xlinker /usr/lib/swift/pm/4_2 -swift-version 5 -I /usr/lib/swift/pm/4_2 -package-description-version 5.3.0 /tmp/TemporaryFile.olQy3h.swift -o /tmp/TemporaryDirectory.NL0Nzj/argon2swift-manifest
| /tmp/TemporaryDirectory.NL0Nzj/argon2swift-manifest -fileno 10
| Fetching https://github.com/P-H-C/phc-winner-argon2.git
| git clone --mirror https://github.com/P-H-C/phc-winner-argon2.git /Users/segabor/Workspace/Argon2Swift/.build/repositories/phc-winner-argon2-49249c9c
| git -C /Users/segabor/Workspace/Argon2Swift/.build/repositories/phc-winner-argon2-49249c9c rev-parse --is-bare-repository
| git -C /Users/segabor/Workspace/Argon2Swift/.build/repositories/phc-winner-argon2-49249c9c tag -l
| git -C /Users/segabor/Workspace/Argon2Swift/.build/repositories/phc-winner-argon2-49249c9c rev-parse --verify '16d3df698db2486dde480b09a732bf9bf48599f9^{commit}'
| git -C /Users/segabor/Workspace/Argon2Swift/.build/repositories/phc-winner-argon2-49249c9c rev-parse --verify '16d3df698db2486dde480b09a732bf9bf48599f9^{tree}'
| git -C /Users/segabor/Workspace/Argon2Swift/.build/repositories/phc-winner-argon2-49249c9c ls-tree e3df7f06a95990497728d5240e6796104ac4f7bb
| git -C /Users/segabor/Workspace/Argon2Swift/.build/repositories/phc-winner-argon2-49249c9c cat-file -p d3d9c83c63a92d579d32b531b19d569180655f48
| /usr/bin/swiftc -L /usr/lib/swift/pm/4_2 -lPackageDescription -Xlinker -rpath -Xlinker /usr/lib/swift/pm/4_2 -swift-version 5 -I /usr/lib/swift/pm/4_2 -package-description-version 5.3.0 /tmp/TemporaryFile.PBwMnj.swift -o /tmp/TemporaryDirectory.wPtQLh/phc-winner-argon2-manifest
| /tmp/TemporaryDirectory.wPtQLh/phc-winner-argon2-manifest -fileno 13
| git -C /Users/segabor/Workspace/Argon2Swift/.build/repositories/phc-winner-argon2-49249c9c rev-parse --verify 'master^{commit}'
| git -C /Users/segabor/Workspace/Argon2Swift/.build/repositories/phc-winner-argon2-49249c9c rev-parse --verify 'f57e61e19229e23c4445b85494dbf7c07de721cb^{tree}'
| git -C /Users/segabor/Workspace/Argon2Swift/.build/repositories/phc-winner-argon2-49249c9c ls-tree ac3dc753ff75ce5a0f243cba1d94582bafe09409
| git -C /Users/segabor/Workspace/Argon2Swift/.build/repositories/phc-winner-argon2-49249c9c rev-parse --is-bare-repository
| git -C /Users/segabor/Workspace/Argon2Swift/.build/repositories/phc-winner-argon2-49249c9c rev-parse --is-bare-repository
| git -C /Users/segabor/Workspace/Argon2Swift/.build/repositories/phc-winner-argon2-49249c9c tag -l
| git -C /Users/segabor/Workspace/Argon2Swift/.build/repositories/phc-winner-argon2-49249c9c rev-parse --verify 'master^{commit}'
| git -C /Users/segabor/Workspace/Argon2Swift/.build/repositories/phc-winner-argon2-49249c9c rev-parse --is-bare-repository
| Cloning https://github.com/P-H-C/phc-winner-argon2.git
| git clone --shared /Users/segabor/Workspace/Argon2Swift/.build/repositories/phc-winner-argon2-49249c9c /Users/segabor/Workspace/Argon2Swift/.build/checkouts/phc-winner-argon2
| git -C /Users/segabor/Workspace/Argon2Swift/.build/checkouts/phc-winner-argon2 rev-parse --is-bare-repository
| Resolving https://github.com/P-H-C/phc-winner-argon2.git at master
| git -C /Users/segabor/Workspace/Argon2Swift/.build/checkouts/phc-winner-argon2 checkout -f 16d3df698db2486dde480b09a732bf9bf48599f9
| git -C /Users/segabor/Workspace/Argon2Swift/.build/checkouts/phc-winner-argon2 submodule update --init --recursive
| git -C /Users/segabor/Workspace/Argon2Swift/.build/checkouts/phc-winner-argon2 clean -ffdx
| /usr/bin/swiftc -L /usr/lib/swift/pm/4_2 -lPackageDescription -Xlinker -rpath -Xlinker /usr/lib/swift/pm/4_2 -swift-version 5 -I /usr/lib/swift/pm/4_2 -package-description-version 5.3.0 /Users/segabor/Workspace/Argon2Swift/.build/checkouts/phc-winner-argon2/Package.swift -o /tmp/TemporaryDirectory.y4xCTk/phc-winner-argon2-manifest
| /tmp/TemporaryDirectory.y4xCTk/phc-winner-argon2-manifest -fileno 12
| error: missing LinuxMain.swift file in the Tests directory
[Swift/build-linux-1] ❌ Failure - Build
[Swift/build-linux-1] exit with `FAILURE`: 1
It indicated the lack of LinuxMain.swift file in Tests folder which is no longer required for newer Swift toolchains.
I suggest to bump the minimum supported version to 5.4.
@segabor can you pass the --enable-test-discovery flag to your build command?
@tmthecoder that was the solution, thanks
Sorry for the late response, I was wrong. First local test indicated that the issue is gone, but I noticed later the job running tests with 5.3 failed all the way. I'll create a PR with extended workflow with Linux images soon. Here's the link to the failed test https://github.com/segabor/Argon2Swift/runs/6034547944?check_suite_focus=true
Seems like only one of the test commands has the flag attached, what happens if it's appended to each swift command? both build and test?
Well, that flag affects only test phase when tests are built then run. However it turned out, test discovery has been automatically appled since Swift 5.4. That's why LinuxMain.swift is no longer required in Tests folder.
But that's not the case with 5.3 where presence of LinuxMain file is mandatory, of course if code is tested on Linux.
@segabor Sorry for the late response, I got caught up with school.
Can you try running swift test --generate-linuxmain before you call the builds?