Is it possible to integrate Appium and Part of Premerge test in CI build

I can run appium tests as part of a CI build but i just point it to the apk that i manually copy to the local folder. Now, is it possible to run appium test as part of pre merge tests? How will that be possible if we don’t have the apk generated at that point? I want to run unit tests and then next instrumentation tests. This way, i could ensure that any new check ins, i run appium tests and if they break the UI tests, then the code is not merged into the master. This can be done easily with espresso as its generates both debug apk and the test apk and then run against it. I am just not sure how this can be done with appium.

Thanks.

same as CI of your Android client. Build android client (normally one line of code after clone code). If it different job attach artifact APK file into your Appium test code. In test code use new build (you know the place where it will copy)