Skip to content

support ccache#526

Closed
isuruf wants to merge 12 commits intoconda-forge:masterfrom
isuruf:cache
Closed

support ccache#526
isuruf wants to merge 12 commits intoconda-forge:masterfrom
isuruf:cache

Conversation

@isuruf
Copy link
Copy Markdown
Member

@isuruf isuruf commented Jun 16, 2017

I've kept the template unchanged when ccache-toolchain is not a build dependency. I can simplify the code a bit more, but that means the template will change.

cc @gqmelo


{%- block build %}
{%- if 'ccache-toolchain' in ' '.join(package['meta']['requirements']['build']) %}
conda build --no-build-id /recipe_root --quiet || exit 1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave a comment explaining why --no-build-id is being used. Something like:

ccache uses the compiler command line to generate the cache keys, so we can't have a different path for every build.
ccache provides CCACHE_BASEDIR variable to solve this but it's better to avoid setting it as it has some side effects.

Comment thread conda_smithy/templates/travis.yml.tmpl Outdated

{%- if 'ccache-toolchain' in ' '.join(package['meta']['requirements']['build']) %}
cache:
branch: no-md5deep
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This branch should not be needed anymore: travis-ci/travis-ci#7456 (comment)
However I didn't test it after they fixed it. After you make the changes I can help with testing before merging this.

Comment thread conda_smithy/templates/circle.yml.tmpl Outdated
{%- if matrix %}

{%- if 'ccache-toolchain' in ' '.join(package['meta']['requirements']['build']) %}
- if test -f ./build_failed; then exit 1; fi
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to echo a message before exiting:

if test -f ./build_failed; echo "Build step failed. Please look at the exact error message above"; then exit 1; fi

Comment thread conda_smithy/templates/travis.yml.tmpl Outdated

script:
{%- if 'ccache-toolchain' in ' '.join(package['meta']['requirements']['build']) %}
- conda build --no-build-id ./{{ recipe_dir }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, please add a comment explaining --no-build-id

Comment thread conda_smithy/templates/circle.yml.tmpl Outdated
- docker pull condaforge/linux-anvil

{%- if matrix %}
{%- if 'ccache-toolchain' in ' '.join(package['meta']['requirements']['build']) %}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking about what would be done if we decide to use ccache by default.
We would move ccache-toolchain code to toolchain. Then this if would check for toolchain package instead, do you agree?

Also we could use conda-forge.yml for that. It would be more explicit and make it possible to disable ccache stuff altogether.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if we moved the code to toolchain then this if check would check for toolchain.

I had it this way, so that we can disable caching in different platforms simply by using a selector on ccache-toolchain.

Comment thread conda_smithy/templates/circle.yml.tmpl Outdated
{%- if matrix %}
{%- if 'ccache-toolchain' in ' '.join(package['meta']['requirements']['build']) %}
# Run, test and (if we have a BINSTAR_TOKEN) upload the distributions.
- ./ci_support/run_docker_build.sh || touch ./build_failed
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment here justifying this would be helpful too: "If any command present on dependencies section fails, CircleCI doesn't cache anything. That's why we need to check for failure later"

@gqmelo
Copy link
Copy Markdown
Contributor

gqmelo commented Jun 16, 2017

I'm testing with llvmdev feedstock and it seems --no-build-id is broken: https://circleci.com/gh/gqmelo/llvmdev-feedstock/79

The build phase respects the option, but the test phase does not:

TEST START: /feedstock_root/build_artefacts/linux-64/llvmdev-4.0.0-cling_0.tar.bz2
Deleting work directory, /feedstock_root/build_artefacts/llvmdev_1497638058570/work

It tries to delete the work dir with id. As a consequence, the test phase keeps the real work dir and then the next package build breaks because it tries to apply a patch it was already applied.

On Travis it is working fine because each package is built on separate jobs

@jakirkham
Copy link
Copy Markdown
Member

Could you please raise that as an issue on the conda-build repo? Also adding an xref to that issue here would be nice too. Thanks.

@isuruf
Copy link
Copy Markdown
Member Author

isuruf commented Jun 16, 2017

@jakirkham
Copy link
Copy Markdown
Member

...or PR.

This should be less of an issue when we have a proper CircleCI matrix, which will be sooner rather than later given recent changes.

xref: #203 (comment)

@jakirkham
Copy link
Copy Markdown
Member

So I was in the process of trying to upgrade to CircleCI 2.0. It looks like this ends up being a pretty serious overhaul. Maybe we should pause this until that and matrix support is in. Thoughts?

xref: #530

@gqmelo
Copy link
Copy Markdown
Contributor

gqmelo commented Jun 17, 2017

So we need to check how the cache behaves with CircleCI 2.0.
Before that the cache was done only after the dependencies step.
@jakirkham do you think you will be able to upgrade soon?

@jakirkham
Copy link
Copy Markdown
Member

Yeah, the linked PR already passes and is ready to merge. Would like to play with setting up matrix builds as a follow up PR.

@jakirkham
Copy link
Copy Markdown
Member

Also I would like to resurrect the package caching work that @gqmelo did. My initial thinking is that caching of packages should always happen (so not be a setting people can change). I think by having a caching step that always happens will simplify the logic here.

@isuruf isuruf changed the base branch from release/2.3.x to master July 25, 2017 04:02
@isuruf
Copy link
Copy Markdown
Member Author

isuruf commented Jul 25, 2017

Ready for review now

@gqmelo
Copy link
Copy Markdown
Contributor

gqmelo commented Aug 25, 2017

LGTM

Have you tested with an existing feedstock?

@isuruf
Copy link
Copy Markdown
Member Author

isuruf commented Aug 27, 2017

@gqmelo, I haven't with the latest changes. I'll check and get back to you

@isuruf isuruf added this to the 3.0.0 milestone Feb 10, 2018
@isuruf isuruf removed this from the 3.0.0 milestone Feb 28, 2018
@isuruf
Copy link
Copy Markdown
Member Author

isuruf commented Feb 28, 2018

Removing from 3.0.0 milestone as this is not yet ready

@isuruf isuruf closed this Apr 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants