Skip to content

[Automated] Update develop snapshot #1668

[Automated] Update develop snapshot

[Automated] Update develop snapshot #1668

Workflow file for this run

name: CI
on:
pull_request: {}
push:
branches:
- master
jobs:
build:
name: Build
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-latest'
# - 'macos-latest'
ocaml-version:
# - 4.10.1
# - 4.11.1
- 4.12.0
snapshot:
- develop
- stable-0-0-8
- stable-0-0-7
- stable-0-0-6--1
- stable-0-0-6
- stable-0-0-5
include:
- os: 'ubuntu-latest'
ocaml-version: '4.06.1'
snapshot: stable-0-0-4
runs-on: ${{ matrix.os }}
env:
OPAMSOLVERTIMEOUT: 3600
OPAMVERBOSE: 1
SNAPSHOT: "snapshot-${{ matrix.snapshot }}"
steps:
- name: Checkout code (10 commits)
uses: actions/checkout@v2
with:
fetch-depth: 10
submodules: true
- name: Fetch master branch (50 commits)
run: |
git remote set-branches --add origin master
git fetch --depth 50 origin master
- name: Output Run ID/Number
run: echo ${{ github.run_id }} ${{ github.run_number }}
- name: Determine the default OPAM Repo
id: determine-default-opam-repo
# See https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#runner-context
# and https://github.com/ocaml/setup-ocaml/blob/4ac56b0fd440c3eef30fd1e34c96e0c740a807da/src/constants.ts#L45
run: |
if [ "${{ runner.os }}" = "Windows" ] ; then
DEFAULT_OPAM_REPO="https://github.com/fdopen/opam-repository-mingw.git#opam2"
else
DEFAULT_OPAM_REPO="https://github.com/ocaml/opam-repository.git"
fi
echo "::set-output name=opam-repo-default::$(echo "$DEFAULT_OPAM_REPO")"
- name: Setup OCaml ${{ matrix.ocaml-version }}
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-version }}
dune-cache: true
cache-prefix: "snapshot-${{ matrix.snapshot }}"
opam-depext: false
opam-pin: false
opam-repositories: |
satysfi-external: https://github.com/gfngfn/satysfi-external-repo.git
satyrographos-local: git+file://${{ github.workspace }}
default: ${{ steps.determine-default-opam-repo.outputs.opam-repo-default }}
- name: Create a dir for post-CI actions
run: |
set -exo pipefail
mkdir pr
- name: Check validity of the snapshot OPAM files
run: |
set -exo pipefail
opam lint --strict *.opam
- name: Check validity of the package OPAM files
run: |
set -exo pipefail
echo "### OPAM Lint" | tee -a "pr/comment.txt"
git diff --name-status origin/master... -- packages/ | sed -e '/^D/d' -e 's/^\w*\s//' -e '/\/opam/!d' | xargs opam lint --color=never --strict | tee -a "pr/comment.txt"
- name: Install the snapshot
run: |
opam pin add "${SNAPSHOT}.dev" . --no-action
opam depext "$SNAPSHOT" --yes
opam install "$SNAPSHOT" --yes
- name: Check if snapshot is consistent
run: |
set -exo pipefail
export OPAMCOLOR=never
comm --nocheck-order -13 <(opam list 'satysfi-*' --short --required-by "$SNAPSHOT") <(opam list 'satysfi-*' --short --recursive --required-by "$SNAPSHOT") > snapshot-diffs.txt
echo "### Missing libraries in the snapshot" | tee -a "pr/comment.txt"
cat snapshot-diffs.txt | tee -a "pr/comment.txt"
# echo "Requiring libraries:"
# cat snapshot-diffs.txt | xargs -r -L1 opam list 'satysfi-*' --recursive --required-by "$SNAPSHOT" --depends-on
- name: Detect file collisions in installed SATySFI libraries
run: |
opam exec -- satyrographos install test-satysfi-root
- name: Removing the snapshot
run: |
opam uninstall "$SNAPSHOT"
- name: Build against snapshots and oldest deps
run: |
export COMMENT_FILE=pr/comment.txt
export SKIP_REVERSE_DEPS=1
echo "### Snapshots and oldest deps" >>"$COMMENT_FILE"
./ci.sh
- name: Revdep tests
run: |
export COMMENT_FILE=pr/comment.txt
export SKIP_OLDEST_DEPS=1
echo "### Reverse deps" >>"$COMMENT_FILE"
./ci.sh
- name: Test if the packages can be added to the snapshot
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
# continue-on-error: true
id: test-update-snapshot
run: |
set -exo pipefail
echo "$SNAPSHOT" > pr/id.txt
echo "${{ matrix.snapshot }}; OCaml ${{ matrix.ocaml-version }}; ${{ matrix.os }}" > pr/matrix.txt
echo "${{ github.event.pull_request.number }}" > pr/pull-number.txt
echo "${{ github.run_id }}" > pr/run-id.txt
git checkout "$SNAPSHOT.opam"
scripts/update-snapshot --opam "$SNAPSHOT.opam"
git diff HEAD -- "$SNAPSHOT.opam" | sed -ne '/^+ /{ s!^+ *"\([^"]*\)".*"\([^"]*\)".*$!\1.\2! ; p}' | tr '\n' ' ' > pr/packages.txt
if git diff --quiet HEAD -- "$SNAPSHOT.opam" ; then
echo 'no-updates' > pr/result.txt
exit 0
fi
FAILED=
git add "$SNAPSHOT.opam"
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m 'Update snapshot'
opam update
if ! opam install "$SNAPSHOT" --yes --with-doc --with-test --verbose --dry-run ; then
echo 'failed' > pr/result.txt
elif ! opam install "$SNAPSHOT" --yes --with-doc --with-test --verbose ; then
echo 'failed' > pr/result.txt
FAILED=1
else
opam list --color=never 'satysfi-*' --short --required-by "$SNAPSHOT" > snapshot-deps.txt
opam list --color=never 'satysfi-*' --short --recursive --required-by "$SNAPSHOT" > snapshot-recursive-deps.txt
if ! diff -u snapshot-deps.txt snapshot-recursive-deps.txt | sed -e '1,/^@@/d' | awk 'BEGIN{ORS=" "; print "inconsistent-snapshot"}; /^[-+]/ {print}' > pr/result.txt ; then
:
else
echo 'updated' > pr/result.txt
fi
fi
opam uninstall "$SNAPSHOT" --yes
if [ -n "$FAILED" ] ; then
exit 1
fi
- uses: actions/upload-artifact@v2
if: success() || failure()
with:
name: "pr-snapshot-${{ matrix.snapshot }}-${{ matrix.ocaml-version }}-${{ matrix.os }}"
path: pr/