# Unit tests pass locally but fail through GitHub Actions

**URL:** <https://discourse.julialang.org/t/unit-tests-pass-locally-but-fail-through-github-actions/72641>\
**Category:** Tooling\
**Tags:** github-actions\
**Created:** [December 6, 2021, 10:51am UTC](https://discourse.julialang.org/t/unit-tests-pass-locally-but-fail-through-github-actions/72641 "2021-12-06T10:51:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdneuzerling](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@mdneuzerling](https://discourse.julialang.org/u/mdneuzerling)\
**Post date:** [December 6, 2021, 10:51am UTC](https://discourse.julialang.org/t/unit-tests-pass-locally-but-fail-through-github-actions/72641/1 "2021-12-06T10:51:38Z")

</div>

Hi folks. I’ve put together a package for my Advent of Code. The unit tests pass locally but [fail when run through my simple GitHub Actions workflow](https://github.com/mdneuzerling/advent_of_code/runs/4428917724?check_suite_focus=true):

```yaml
name: Run tests for AOC2021

on:
  push:
    branches: [main, master]
  pull_request:
    branches: [main, master]

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - uses: julia-actions/setup-julia@latest
        with:
          version: 1.7
      - uses: julia-actions/julia-buildpkg@latest
        with: 
          project: "AOC2021"
      - uses: julia-actions/julia-runtest@latest
        with: 
          project: "AOC2021"

```

You’ll notice that the project is a subdirectory of the git repository.

The tests fail because Julia can’t find the submodules I use for each day, like `Day01`, which makes me think I’m misunderstanding how scoping works (something I often struggle with). [The unit tests use imports like `import AOC2021.Day06.part1`](https://github.com/mdneuzerling/advent_of_code/blob/main/AOC2021/test/day01.jl), where `part1` is a function of the submodule `Day06`.

When I run the unit tests locally, I do so by navigating to the parent directory and running `julia --project=AOC2021 -e 'import Pkg;Pkg.test()' `, which is similar to the command run by the GA workflow. There are no issues locally.

Can someone please help me identify what’s going wrong here?

---

<div class="post-metadata">

**Author:** ![rikh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rikh/32/204104_2.png) [@rikh](https://discourse.julialang.org/u/rikh)\
**Post date:** [December 6, 2021, 11:34am UTC](https://discourse.julialang.org/t/unit-tests-pass-locally-but-fail-through-github-actions/72641/2 "2021-12-06T11:34:00Z")

</div>

I’ve fixed it. The `include` in your main module used relative paths. Those paths didn’t work because the GitHub Action current directory was different from the current directory when running locally. I’ve sent in a pull request to your repository.

---

<div class="post-metadata">

**Author:** ![mdneuzerling](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@mdneuzerling](https://discourse.julialang.org/u/mdneuzerling)\
**Post date:** [December 6, 2021, 11:39am UTC](https://discourse.julialang.org/t/unit-tests-pass-locally-but-fail-through-github-actions/72641/3 "2021-12-06T11:39:42Z")

</div>

Thank you so much @rikh! I’ve never seen absolute paths in `include` before. I don’t think I would have picked up on that without help. Thanks again.

---

<div class="post-metadata">

**Author:** ![rikh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rikh/32/204104_2.png) [@rikh](https://discourse.julialang.org/u/rikh)\
**Post date:** [December 6, 2021, 11:44am UTC](https://discourse.julialang.org/t/unit-tests-pass-locally-but-fail-through-github-actions/72641/4 "2021-12-06T11:44:49Z")

</div>

> [@mdneuzerling](#):
>
> I’ve never seen absolute paths in `include` before.

Good that you asked! The problem was probably the part where `isfile` was checked. That part couldn’t figure out the relative path correctly so gave zero files to `include`. Anyway, it’s solved now 👍 Your welcome
