I'm running some unit tests in CI (using github actions + depot) with a block like:
@func()
async elixirTest(): Promise<number> {
const postgres = dag
.container()
.from("postgres:15")
.withEnvVariable("DEDUPE", "mandark_test")
.withEnvVariable("POSTGRES_PASSWORD", "postgres")
.withExposedPort(5432)
.asService({
useEntrypoint: true,
});
return this.elixirBuildEnv()
.withServiceBinding("localhost", postgres)
.withExec(["mix", "reset"])
.withExec(["mix", "test", "--warnings-as-errors"])
.exitCode();
}
mix reset handles setting up the database for mix test, but it's been cached and hasn't been running, causing mix test to fail because there's no database.
I'm not quite sure how mix reset could be cached but not mix test, though.
Any ideas on the best way to handle commands with side effects like this that need to run together, since they're acting on a service outside the cache? Could probably combine into a single mix command, I guess?