How to detect commited file at test phase


#1

Hello.
How to take the committed file information on the testing?
I have tried to execute shell command “find -mmin -1” at ‘override’ in test section ‘circle.yml’.
So I realized All files in the repository had been updated.

My test have to run only the occasion(s) to build the repository.

Is there way to enumerate the committed files by shell command?

Best regards.


#2

find -mmin -1 will show all files because the entire repository is checked out at the beginning of the build. Git is what contains the information on what is changing for your project. The following command would give you a newline separated list of each file involved in the last commit (HEAD) in the build:

git diff-tree --no-commit-id --name-only -r HEAD


Detecting changed files (since last build) in CI builds
#3

but a more common situation is when a developer pushed more then 1 commit and you need specify a range. so the main question how to define this range.

I found that CircleCI provides a range in environment variable CIRCLE_COMPARE_URL during start container step.
done nothing yet…


#4

I found that CircleCI provides a range in environment variable CIRCLE_COMPARE_URL during start container step.

How is $CIRCLE_COMPARE_URL to be used within CircleCI build?

A colleague gave me a snippet like this prior to me finding this thread online:

git diff-tree --no-commit-id --name-only -r `echo ${CIRCLE_COMPARE_URL} | cut -d/ -f 7`

However, that seems to work locally in one’s own local repo version of target repo, when you substitute in the actual URL or save to similar env variable.

In CircleCI (version 1.0), it didn’t appear to work in that it returns an empty list, whereas the diff command given by FelicianoTech does return output, but only for last commit I believe. The URL does have a value itself.

Where is the doc describing CIRCLE_COMPARE_URL by the way?


#5