-
Notifications
You must be signed in to change notification settings - Fork 50
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
[wip] script to copy Coq's CI info into the platform #44
Draft
gares
wants to merge
2
commits into
2021.02
Choose a base branch
from
ci
base: 2021.02
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: GitHub CI | ||
|
||
on: | ||
- pull_request | ||
- push | ||
|
||
env: | ||
PLATFORM_ARGS: -extent=f -parallel=p -jobs=2 -vst=y -compcert=f | ||
OPAM_VERSION: 2.0.6 | ||
|
||
jobs: | ||
Windows: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- name: Set git to use LF | ||
run: | | ||
git config --global core.autocrlf false | ||
git config --global core.eol lf | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- name: Run common platform script | ||
shell: cmd | ||
env: | ||
COQREGTESTING: y | ||
run: coq_platform_make_windows.bat -destcyg=C:\cygwin64_coq_platform -arch=64 %PLATFORM_ARGS% | ||
|
||
Ubuntu: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install opam | ||
run: | | ||
sudo apt-get install bubblewrap build-essential | ||
curl -L https://github.com/ocaml/opam/releases/download/${OPAM_VERSION}/opam-${OPAM_VERSION}-x86_64-linux > opam.${OPAM_VERSION} | ||
chmod a+x opam.${OPAM_VERSION} | ||
sudo cp opam.${OPAM_VERSION} /usr/local/bin/opam.${OPAM_VERSION} | ||
sudo ln -s /usr/local/bin/opam.${OPAM_VERSION} /usr/local/bin/opam | ||
|
||
- name: Run common platform script | ||
shell: bash | ||
run: ./coq_platform_make.sh $PLATFORM_ARGS | ||
|
||
Macos: | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install opam | ||
run: | | ||
curl -L https://github.com/ocaml/opam/releases/download/${OPAM_VERSION}/opam-${OPAM_VERSION}-x86_64-macos > opam.${OPAM_VERSION} | ||
chmod a+x opam.${OPAM_VERSION} | ||
sudo cp opam.${OPAM_VERSION} /usr/local/bin/opam.${OPAM_VERSION} | ||
sudo ln -s /usr/local/bin/opam.${OPAM_VERSION} /usr/local/bin/opam | ||
|
||
- name: Run common platform script | ||
shell: bash | ||
run: ./coq_platform_make.sh $PLATFORM_ARGS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
# This script generates opam/packages/*/*.dev/opam files using Coq's CI | ||
# project tracking info and generates $OUTPUT mentioning | ||
# them | ||
OUTPUT=${OUTPUT:=coq_platform_packages_ci.sh} | ||
|
||
TMP=`mktemp -d` | ||
trap "rm -rf $TMP" EXIT | ||
|
||
function log { | ||
echo $1 | ||
} | ||
|
||
function git_clone { | ||
test -d $TMP/git/$1 || (log "DBG: Cloning $1 ..."; git clone $2 -b $3 --depth=1 $TMP/git/$1 >/dev/null 2>&1) | ||
} | ||
|
||
function test_package { | ||
printf "%-52s # %s\n" "PACKAGES=\"\${PACKAGES} $1.dev\"" "$2" >> $OUTPUT | ||
} | ||
|
||
function skip_package { | ||
printf "#%-51s # %s\n" "PACKAGES=\"\${PACKAGES} $1.dev\"" "$2" >> $OUTPUT | ||
} | ||
|
||
function create_opam_pinned_package { | ||
local cip="$1" | ||
local package="$2" | ||
local REPO_VAR="${cip}_CI_GITURL" | ||
local REPO=${!REPO_VAR} | ||
local BRANCH_VAR="${cip}_CI_REF" | ||
local BRANCH=${!BRANCH_VAR} | ||
git_clone $cip ${REPO} ${BRANCH} | ||
mkdir -p opam/packages/$package/$package.dev/ | ||
if [ -e $TMP/git/$cip/$package.opam ]; then | ||
cp $TMP/git/$cip/$package.opam opam/packages/$package/$package.dev/opam | ||
elif [ -e $TMP/git/$cip/*.opam ]; then | ||
cp $TMP/git/$cip/*.opam opam/packages/$package/$package.dev/opam | ||
elif [ -e $TMP/git/$cip/opam ]; then | ||
cp $TMP/git/$cip/opam opam/packages/$package/$package.dev/opam | ||
else | ||
log "WARNING: No opam file for $cip $package" | ||
skip_package $package "since no opam package found" | ||
return | ||
fi | ||
local HASH=$(cd $TMP/git/$cip/ && git log --oneline | cut -f 1 -d ' ') | ||
printf "\nsrc { url : \"%s\" }" "git+${REPO}#${HASH}" >> opam/packages/$package/$package.dev/opam | ||
log "INFO: Testing $package at hash $HASH (on branch $BRANCH from $REPO)" | ||
test_package $package "${REPO}#${HASH} (on branch $BRANCH)" | ||
} | ||
|
||
# fetch ci info for Coq | ||
git_clone coq https://github.com/coq/coq.git master | ||
. git/coq/dev/ci/ci-basic-overlay.sh | ||
# fake ci project for Coq itself | ||
project coq "https://github.com/coq/coq.git" "master" | ||
COQ_CI_PROJECTS="${projects[*]}" | ||
|
||
# fetch package list from the current platform | ||
COQ_PLATFORM_EXTENT=f | ||
COQ_PLATFORM_COMPCERT=f | ||
COQ_PLATFORM_VST=y | ||
. coq_platform_packages.sh | ||
|
||
# create the .dev package and their list | ||
> $OUTPUT | ||
for pv in $PACKAGES; do | ||
package=`echo $pv | sed -e 's/\..*//'` | ||
case $package in | ||
coqide) | ||
create_opam_pinned_package coq $package | ||
;; | ||
coq-mathcomp-ssreflect|coq-mathcomp-fingroup|coq-mathcomp-algebra|coq-mathcomp-solvable|coq-mathcomp-field|coq-mathcomp-character) | ||
create_opam_pinned_package mathcomp $package | ||
;; | ||
coq-hierarchy-builder) # https://github.com/coq/coq/pull/13633 | ||
create_opam_pinned_package elpi_hb $package | ||
;; | ||
coq-gappa) # https://github.com/coq/coq/pull/13633 | ||
create_opam_pinned_package gappa_plugin $package | ||
;; | ||
lablgtk3|gappa|menhir) # why are these in the platform? | ||
continue | ||
;; | ||
*) | ||
found=f | ||
for cip in $COQ_CI_PROJECTS; do | ||
if [ "$found" = "f" -a "${cip/_/-}" = "${package#coq-}" ]; then | ||
found=t | ||
create_opam_pinned_package ${cip} $package | ||
fi | ||
done | ||
if [ "$found" = "f" ]; then | ||
log "WARNING: platform package $package has no corresponding entry in Coq's ci" | ||
skip_package $package "no corresponding entry in Coq's ci" | ||
fi | ||
;; | ||
esac | ||
done | ||
|
||
echo "========================== platform version CI ==================" | ||
cat $OUTPUT |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the use case for this second case?
Could there be a default case where the opam file is taken from the coq-extra-dev repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes people call, in their repo, the opam file
foo.opam
instead ofcoq-foo
, don't ask me why.Yes, I thought about that, and maybe the ones in the usual repo should have precedence, and we should also look in the local repo with higher precedence... I think we should think carefully about these rule (I did not yet).