Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CircleCI template #28

Merged
merged 5 commits into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .travis.yml.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ language: shell
echo \"Build triggered by ${TRAVIS_EVENT_TYPE}\"
export PS4='+ \e[33;1m(\$0 @ line \$LINENO) \$\e[0m '
set -ex # -e = exit on failure; -x = trace for debug
opam repo -a --set-default add coq-extra-dev https://coq.inria.fr/opam/extra-dev
opam update -y
opam pin add ${PACKAGE} . -y -n -k path
opam install ${PACKAGE} -y -j ${NJOBS} --deps-only
Expand All @@ -29,6 +30,13 @@ language: shell
set -ex
sudo chown -R coq:coq /home/coq/${PACKAGE}
opam install ${PACKAGE} -v -y -j ${NJOBS}
{{# ci_test_dependants }}
PINS=($(opam list -s --pinned --columns=package)); PINS=$(IFS=, ; echo "${PINS[*]}")
PACKAGES=`opam list -s --depends-on {{ opam_name }}{{^ opam_name }}coq-{{ shortname }}{{/ opam_name }} --coinstallable-with $PINS`
if [ -n "$PACKAGES" ]
then opam install -t $PACKAGES
fi
{{/ ci_test_dependants }}
"
- docker stop COQ # optional
- echo -en 'travis_fold:end:script\\r'
Expand Down
58 changes: 58 additions & 0 deletions config.yml.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
version: 2.1

jobs:
build:
parameters:
coq:
type: string
docker:
- image: coqorg/coq:<<parameters.coq>>
resource_class: medium
environment:
OPAMJOBS: 2
OPAMVERBOSE: 1
OPAMYES: true
TERM: xterm
steps:
- checkout
- run:
name: Pull submodules
command: git submodule update --init --remote
Copy link
Member

Choose a reason for hiding this comment

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

Is this yet another subtle difference between this template and the other CI templates?

Copy link
Member

Choose a reason for hiding this comment

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

I think so… Maybe adding this git submodule part is unneeded for the default coq-community templates? at least for the time being (IMHO the three CI templates should be as close as possible semantically one from the other, and later on other PRs could just as well add features that enhance them, in a row?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Travis CI clones Git submodules by default. I've added submodule for GitHub Actions.

Copy link
Member

Choose a reason for hiding this comment

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

OK! have you checked that this is exactly that command triggered by Travis for git submodule cloning?

(I'm not very submodule-savvy, but e.g. this blog https://mgalgs.github.io/2014/07/03/git-submodule-update-init-remote-recursive-considered-harmful.html mentions the following commands: git submodule update --init --recursive; git submodule update --remote)

Copy link
Member Author

Choose a reason for hiding this comment

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

Travis uses git submodule update --init --recursive. Should I just drop --remote?

Copy link
Member

@erikmd erikmd May 27, 2020

Choose a reason for hiding this comment

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

Maybe yes − this option is documented here:
https://git-scm.com/docs/git-submodule#Documentation/git-submodule.txt---remote ;
it appears to be related to remote-tracking branches (which would be a bit off-topic in the context of CI builds?)

Copy link
Member

Choose a reason for hiding this comment

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

and this complies with the doc of GitLab CI as well:
https://docs.gitlab.com/ee/ci/git_submodules.html#using-git-submodules-in-your-ci-jobs
so git submodule update --init --recursive seems the way to go

Copy link
Member

Choose a reason for hiding this comment

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

(actually the GItLab CI page I mentioned suggests two lines)

git submodule sync --recursive
git submodule update --init --recursive

- run:
name: Configure environment
command: echo . ~/.profile >> $BASH_ENV
- run:
name: Install dependencies
command: |
opam repo -a --set-default add coq-extra-dev https://coq.inria.fr/opam/extra-dev
opam update
opam install --deps-only .
- run:
name: List installed packages
command: opam list
- run:
name: Build, test, and install package
command: opam install -t .
{{# ci_test_dependants }}
liyishuai marked this conversation as resolved.
Show resolved Hide resolved
- run:
name: Test dependants
command: |
PINS=($(opam list -s --pinned --columns=package)); PINS=$(IFS=, ; echo "${PINS[*]}")
PACKAGES=`opam list -s --depends-on {{ opam_name }}{{^ opam_name }}coq-{{ shortname }}{{/ opam_name }} --coinstallable-with $PINS`
if [ -n "$PACKAGES" ]
then opam install -t $PACKAGES
fi
{{/ ci_test_dependants }}
- run:
name: Uninstall package
command: opam uninstall .

workflows:
version: 2
test:
jobs:
{{# tested_coq_opam_versions }}
- build:
name: "Coq {{ version }}"
coq: "{{ version }}"
{{/ tested_coq_opam_versions }}
2 changes: 2 additions & 0 deletions coq-action.yml.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Checkout submodules
uses: textbook/[email protected]
- uses: coq-community/docker-coq-action@v1
with:
opam_file: '{{ opam_name }}{{^ opam_name }}coq-{{ shortname }}{{/ opam_name }}.opam'
Expand Down
9 changes: 9 additions & 0 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ for f in "$srcdir"/{,.}*.mustache; do
continue
fi
;;
config.yml)
mustache='{{ circleci }}'
bool=$(get_yaml meta.yml <<<"$mustache")
if [ -n "$bool" ] && [ "$bool" != false ]; then
mkdir -p -v .circleci && target=".circleci/$target"
else
continue
fi
;;
default.nix)
mustache='{{ tested_coq_nix_versions }}'
bool=$(get_yaml meta.yml <<<"$mustache")
Expand Down
5 changes: 5 additions & 0 deletions ref.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ keys:
type: bool
used:
- README.md
- ci_test_dependants:
type: bool
used:
- config.yml
- .travis.yml
- community:
type: bool
used:
Expand Down