How to add "build step" and "tests" in a new julia package?

#1

Hello,
I wanted to create a julia package. For that i followed the following steps:

(v1.1) pkg> generate HelloWorld
shell> cd HelloWorld
(v1.1) pkg> activate .
julia> import HelloWorld
julia> HelloWorld.greet()

The output shows: “Hello World!”. So far is good. The project has been activated and package has been loaded. I also added dependencies successfully:

(HelloWorld) pkg> add Random JSON

Now I am getting error when trying to add build step:

shell> cat deps/build.log
ERROR: IOError: could not spawn `cat deps/build.log`: no such file or directory (ENOENT)

I am also getting error when trying to add tests:

shell> cat test/runtests.jl
ERROR: IOError: could not spawn `cat test/runtests.jl`: no
such file or directory (ENOENT)

Could you let me know whats going wrong here?

0 Likes

#2

generate does not create those files by default, you have to create them yourself.

A barebones runtests.jl will look like:

module HelloWorldTests
import HelloWorld
HelloWorld.greet()
end
3 Likes

#3

Thank you @00vareladavid for letting me know what was wrong with my approach.

0 Likes