├── .github └── workflows │ ├── ci.yml │ └── enforce-license-compliance.yml ├── LICENSE.md ├── Manifest.toml ├── Project.toml ├── README.md ├── src └── calculator.jl └── test ├── runtests.jl └── test_calculator.jl /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Workflow for Codecov example-julia 2 | on: [push, pull_request] 3 | jobs: 4 | run: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: Checkout 8 | uses: actions/checkout@v4 9 | - name: Set up Julia 1.8.0 10 | uses: julia-actions/setup-julia@v1 11 | with: 12 | version: "1.8.0" 13 | - uses: julia-actions/julia-buildpkg@v1 14 | - uses: julia-actions/julia-runtest@v1 15 | - uses: julia-actions/julia-processcoverage@v1 16 | - uses: codecov/codecov-action@v5 17 | env: 18 | CODECOV_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }} 19 | -------------------------------------------------------------------------------- /.github/workflows/enforce-license-compliance.yml: -------------------------------------------------------------------------------- 1 | name: Enforce License Compliance 2 | 3 | on: 4 | pull_request: 5 | branches: [main, master] 6 | 7 | jobs: 8 | enforce-license-compliance: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: 'Enforce License Compliance' 12 | uses: getsentry/action-enforce-license-compliance@57ba820387a1a9315a46115ee276b2968da51f3d # main 13 | with: 14 | fossa_api_key: ${{ secrets.FOSSA_API_KEY }} 15 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Codecov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Manifest.toml: -------------------------------------------------------------------------------- 1 | # This file is machine-generated - editing it directly is not advised 2 | 3 | julia_version = "1.8.0" 4 | manifest_format = "2.0" 5 | project_hash = "c299641377be0f60dfaa657a366dd3c85e21cf2f" 6 | 7 | [[deps.Artifacts]] 8 | uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" 9 | 10 | [[deps.Base64]] 11 | uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" 12 | 13 | [[deps.CodecZlib]] 14 | deps = ["TranscodingStreams", "Zlib_jll"] 15 | git-tree-sha1 = "ded953804d019afa9a3f98981d99b33e3db7b6da" 16 | uuid = "944b1d66-785c-5afd-91f1-9de20f533193" 17 | version = "0.7.0" 18 | 19 | [[deps.Coverage]] 20 | deps = ["CoverageTools", "HTTP", "JSON", "LibGit2", "MbedTLS"] 21 | git-tree-sha1 = "4fb5effc927fddc76a213dc4b1871dc41b666686" 22 | uuid = "a2441757-f6aa-5fb2-8edb-039e3f45d037" 23 | version = "1.6.0" 24 | 25 | [[deps.CoverageTools]] 26 | git-tree-sha1 = "cc5595feb314d3b226ed765a001a40ca451ad687" 27 | uuid = "c36e975a-824b-4404-a568-ef97ca766997" 28 | version = "1.3.0" 29 | 30 | [[deps.Dates]] 31 | deps = ["Printf"] 32 | uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" 33 | 34 | [[deps.HTTP]] 35 | deps = ["Base64", "CodecZlib", "Dates", "IniFile", "Logging", "LoggingExtras", "MbedTLS", "NetworkOptions", "Random", "SimpleBufferStream", "Sockets", "URIs", "UUIDs"] 36 | git-tree-sha1 = "59ba44e0aa49b87a8c7a8920ec76f8afe87ed502" 37 | uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3" 38 | version = "1.3.3" 39 | 40 | [[deps.IniFile]] 41 | git-tree-sha1 = "f550e6e32074c939295eb5ea6de31849ac2c9625" 42 | uuid = "83e8ac13-25f8-5344-8a64-a9f2b223428f" 43 | version = "0.5.1" 44 | 45 | [[deps.InteractiveUtils]] 46 | deps = ["Markdown"] 47 | uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" 48 | 49 | [[deps.JSON]] 50 | deps = ["Dates", "Mmap", "Parsers", "Unicode"] 51 | git-tree-sha1 = "3c837543ddb02250ef42f4738347454f95079d4e" 52 | uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" 53 | version = "0.21.3" 54 | 55 | [[deps.LibGit2]] 56 | deps = ["Base64", "NetworkOptions", "Printf", "SHA"] 57 | uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" 58 | 59 | [[deps.Libdl]] 60 | uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" 61 | 62 | [[deps.Logging]] 63 | uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" 64 | 65 | [[deps.LoggingExtras]] 66 | deps = ["Dates", "Logging"] 67 | git-tree-sha1 = "5d4d2d9904227b8bd66386c1138cf4d5ffa826bf" 68 | uuid = "e6f89c97-d47a-5376-807f-9c37f3926c36" 69 | version = "0.4.9" 70 | 71 | [[deps.Markdown]] 72 | deps = ["Base64"] 73 | uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" 74 | 75 | [[deps.MbedTLS]] 76 | deps = ["Dates", "MbedTLS_jll", "MozillaCACerts_jll", "Random", "Sockets"] 77 | git-tree-sha1 = "ae6676d5f576ccd21b6789c2cbe2ba24fcc8075d" 78 | uuid = "739be429-bea8-5141-9913-cc70e7f3736d" 79 | version = "1.1.5" 80 | 81 | [[deps.MbedTLS_jll]] 82 | deps = ["Artifacts", "Libdl"] 83 | uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" 84 | version = "2.28.0+0" 85 | 86 | [[deps.Mmap]] 87 | uuid = "a63ad114-7e13-5084-954f-fe012c677804" 88 | 89 | [[deps.MozillaCACerts_jll]] 90 | uuid = "14a3606d-f60d-562e-9121-12d972cd8159" 91 | version = "2022.2.1" 92 | 93 | [[deps.NetworkOptions]] 94 | uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" 95 | version = "1.2.0" 96 | 97 | [[deps.Parsers]] 98 | deps = ["Dates"] 99 | git-tree-sha1 = "3d5bf43e3e8b412656404ed9466f1dcbf7c50269" 100 | uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" 101 | version = "2.4.0" 102 | 103 | [[deps.Printf]] 104 | deps = ["Unicode"] 105 | uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" 106 | 107 | [[deps.Random]] 108 | deps = ["SHA", "Serialization"] 109 | uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" 110 | 111 | [[deps.SHA]] 112 | uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" 113 | version = "0.7.0" 114 | 115 | [[deps.Serialization]] 116 | uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" 117 | 118 | [[deps.SimpleBufferStream]] 119 | git-tree-sha1 = "874e8867b33a00e784c8a7e4b60afe9e037b74e1" 120 | uuid = "777ac1f9-54b0-4bf8-805c-2214025038e7" 121 | version = "1.1.0" 122 | 123 | [[deps.Sockets]] 124 | uuid = "6462fe0b-24de-5631-8697-dd941f90decc" 125 | 126 | [[deps.Test]] 127 | deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] 128 | uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" 129 | 130 | [[deps.TranscodingStreams]] 131 | deps = ["Random", "Test"] 132 | git-tree-sha1 = "8a75929dcd3c38611db2f8d08546decb514fcadf" 133 | uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa" 134 | version = "0.9.9" 135 | 136 | [[deps.URIs]] 137 | git-tree-sha1 = "e59ecc5a41b000fa94423a578d29290c7266fc10" 138 | uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" 139 | version = "1.4.0" 140 | 141 | [[deps.UUIDs]] 142 | deps = ["Random", "SHA"] 143 | uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" 144 | 145 | [[deps.Unicode]] 146 | uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" 147 | 148 | [[deps.Zlib_jll]] 149 | deps = ["Libdl"] 150 | uuid = "83775a58-1f1d-513f-b197-d71354ab007a" 151 | version = "1.2.12+3" 152 | -------------------------------------------------------------------------------- /Project.toml: -------------------------------------------------------------------------------- 1 | name = "calculator" 2 | uuid = "669fd357-d32d-4252-9e0a-c6a4c750a700" 3 | authors = ["Tom Hu "] 4 | version = "0.1.0" 5 | 6 | [deps] 7 | Coverage = "a2441757-f6aa-5fb2-8edb-039e3f45d037" 8 | Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [Codecov](https://codecov.io) Julia Example 2 | [![codecov](https://codecov.io/github/codecov/example-julia/branch/main/graph/badge.svg)](https://app.codecov.io/github/codecov/example-julia) 3 | [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fexample-julia.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fexample-julia?ref=badge_shield) 4 | 5 | This example repository shows how Codecov can be integrated with a simple julia project. It uses **GitHub Actions** as the CI/CD provider and **Coverage** as the coverage provider. 6 | 7 | For more information, please see the links below. 8 | 9 | ## Links 10 | - [Quick Start](https://docs.codecov.com/docs/quick-start) 11 | - [GitHub Tutorial](https://docs.codecov.com/docs/github-tutorial) 12 | - [Community Boards](https://community.codecov.io) 13 | - [Support](https://codecov.io/support) 14 | - [Documentation](https://docs.codecov.io) 15 | 16 | 17 | ## License 18 | [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fexample-julia.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fexample-julia?ref=badge_large) 19 | -------------------------------------------------------------------------------- /src/calculator.jl: -------------------------------------------------------------------------------- 1 | module calculator 2 | 3 | export add, subtract, multiply, divide 4 | add(x, y) = x + y 5 | subtract(x, y) = x - y 6 | multiply(x, y) = x * y 7 | 8 | function divide(x, y) 9 | if y == 0 10 | return "Cannot divide by 0" 11 | end 12 | return x * 1.0 /y 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/runtests.jl: -------------------------------------------------------------------------------- 1 | using Test 2 | 3 | @testset "All" begin 4 | include("test_calculator.jl"); 5 | end 6 | -------------------------------------------------------------------------------- /test/test_calculator.jl: -------------------------------------------------------------------------------- 1 | using Test 2 | 3 | using calculator 4 | 5 | @testset "CaluclatorTest" begin 6 | @testset "TestAdd" begin 7 | @test add(1, 2) == 3.0 8 | @test add(1.0, 2.0) == 3.0 9 | @test add(0, 2.0) == 2.0 10 | @test add(2.0, 0) == 2.0 11 | @test add(-4, 2.0) == -2.0 12 | end 13 | 14 | @testset "TestSubtract" begin 15 | @test subtract(1, 2) == -1.0 16 | @test subtract(2, 1) == 1.0 17 | @test subtract(1.0, 2.0) == -1.0 18 | @test subtract(0, 2.0) == -2.0 19 | @test subtract(2.0, 0.0) == 2.0 20 | @test subtract(-4, 2.0) == -6.0 21 | end 22 | 23 | @testset "TestMultiply" begin 24 | @test multiply(1, 2) == 2.0 25 | @test multiply(1.0, 2.0) == 2.0 26 | @test multiply(0, 2.0) == 0.0 27 | @test multiply(2.0, 0.0) == 0.0 28 | @test multiply(-4, 2.0) == -8.0 29 | end 30 | 31 | @testset "TestDivide" begin 32 | @test divide(1, 2) == 0.5 33 | @test divide(1.0, 2.0) == 0.5 34 | @test divide(0, 2.0) == 0 35 | @test divide(-4, 2.0) == -2.0 36 | # @test divide(2.0, 0.0) == "Cannot divide by 0" 37 | end 38 | end 39 | --------------------------------------------------------------------------------