Skip to content

Commit

Permalink
Merge pull request #2074 from PrincetonUniversity/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
kmantel authored Jun 22, 2021
2 parents b7816cb + 60abce4 commit 5eb2ead
Show file tree
Hide file tree
Showing 166 changed files with 4,697 additions and 7,488 deletions.
18 changes: 0 additions & 18 deletions .github/actions/cleanup-pip-cache/action.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/actions/install-pnl/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: 'Install local pnl package'
description: 'Install PsyNeulink dependencies and editable PNL package'
inputs:
features: # id of input
description: 'PsyNeuLink features to install'
required: true
default: ''

runs:
using: "composite"
steps:
- name: OS dependencies
shell: bash
env:
RUNNER_OS: ${{ runner.os }}
HOMEBREW_NO_AUTO_UPDATE: 1
# Composited actions can't use step conditionals.
run: |
case "$RUNNER_OS" in
macOS*) brew install graphviz ;;
Linux*) sudo apt-get install -y graphviz ;;
Windows*) choco install --no-progress -y graphviz --version=2.38.0.20190211 ;;
*) echo "Unsupported OS"; exit 1 ;;
esac
- name: Drop pytorch on x86
shell: bash
run: |
if [ $(python -c 'import struct; print(struct.calcsize("P") * 8)') == 32 ]; then
sed -i /torch/d requirements.txt
# pywinpty is a transitive dependency and v1.0+ removed support for x86 wheels
# terminado >= 0.10.0 pulls in pywinpty >= 1.1.0
[[ ${{ runner.os }} = Windows* ]] && pip install "pywinpty<1" "terminado<0.10"
fi
- name: Python dependencies
shell: bash
run: |
python -m pip install --upgrade pip wheel
pip install -e .[${{ inputs.features }}]
- name: "Cleanup old wheels"
shell: bash
run: |
pip cache info
INSTALLED=`pip list | sed 's/-/_/g' | sed 's/ */-/' | tail -n+3`
CACHED=`pip cache list | cut -f 2,3 -d- | tail -n+3`
for P in $CACHED; do
# Remove cached and not installed
if [ `echo $INSTALLED | grep -o $P | wc -l` == "0" ] ; then
pip cache remove -v $P || true
fi
done
28 changes: 28 additions & 0 deletions .github/actions/on-branch/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Check commit in branch'
description: 'Check if the current commit is included in the last n commits of the given branch'
inputs:
branch:
description: 'Branch name to check against. Default: "master".'
required: true
default: 'master'
depth:
description: 'Check the last $depth commits. Default: 5.'
required: true
default: 5
outputs:
on-branch:
description: 'Returns the branch name if the current commit is included in the branch, "" otherwise'
value: ${{ steps.on_branch.outputs.on_branch }}

runs:
using: 'composite'
steps:
- name: Check if on ${{ inputs.branch }}
id: on_branch
shell: bash
run: |
git fetch origin ${{ inputs.branch }} --depth=${{ inputs.depth }}
git describe --always --tags
export ON_BRANCH=$(git branch -a --contains ${{ github.ref }} | grep -q '^ remotes/origin/${{ inputs.branch }}$' && echo "${{ inputs.branch }}" || echo "")
echo "Found out: ${ON_BRANCH}"
echo "::set-output name=on_branch::$ON_BRANCH"
102 changes: 59 additions & 43 deletions .github/workflows/compare-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,79 @@ name: "Add doc diff to PR comment"

on:
workflow_run:
workflows: ["PsyNeuLink Docs Compare"]
workflows: ["PsyNeuLink Docs CI"]
types:
- completed

jobs:
post-comment:
docs-compare:
runs-on: ubuntu-latest
if: >
${{ github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success' }}
if: github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'

steps:

- name: 'Download artifact'
uses: actions/[email protected]
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name.startsWith("compare")
}).slice(-1)[0];
- name: 'Download docs artifacts'
id: docs-artifacts
uses: actions/[email protected]
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
const docsPrefix = 'Documentation-base-'
const docsSuffix = artifacts.data.artifacts.filter((artifact) => {
return artifact.name.startsWith(docsPrefix)
}).slice(-1)[0].name.slice(docsPrefix.length);
core.setOutput('DOCS_GEN_ENV', docsSuffix);
var docsArtifacts = artifacts.data.artifacts.filter((artifact) => {
return artifact.name.endsWith(docsSuffix) && artifact.name.startsWith('Documentation-')
});
// check that we got exactly 2 artifacts
console.assert(docsArtifacts.length == 2, docsSuffix, docsArtifacts, artifacts.data.artifacts);
var fs = require('fs');
for (artifact of docsArtifacts) {
console.log('Downloading: ' + artifact.name);
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
artifact_id: artifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
- name: Unzip artifact
run: unzip pr.zip
fs.writeFileSync('${{ github.workspace }}/' + artifact.name + '.zip', Buffer.from(download.data));
}
- name: Post comment with docs diff
uses: actions/[email protected]
with:
script: |
var fs = require("fs");
var issue_number = Number(fs.readFileSync('./PR_NR'));
var os = fs.readFileSync('./PR_OS', 'utf8').trim();
var python = fs.readFileSync('./PR_PYTHON_VERSION', 'utf8').trim();
var text = fs.readFileSync("./result.diff").slice(0,16384);
- name: Unzip artifacts
shell: bash
run: |
unzip Documentation-base-*.zip -d docs-base/
unzip Documentation-head-*.zip -d docs-head/
// basic input checks
console.assert(['ubuntu-latest', 'windows-latest', 'macos-latest'].includes(os), 'Unexpected os: %s', os);
console.assert(['3.6', '3.7', '3.8'].includes(python), 'Unexpected python: %s', python);
console.assert(!text.includes('```'), 'Invalid diff!');
- name: Compare
shell: bash
run: |
# Store the resulting diff, or 'No differences!' to and output file
# The 'or true' part is needed to workaround 'pipefail' flag used by github-actions
(diff -r docs-base docs-head && echo 'No differences!' || true) | tee ./result.diff
console.log('Posting diff to PR:' + issue_number)
- name: Post comment with docs diff
uses: actions/[email protected]
with:
script: |
var fs = require('fs');
var text = fs.readFileSync("./result.diff").slice(0,16384);
github.issues.createComment({
issue_number: issue_number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'This PR causes the following changes to the html docs (' + os + ', python-' + python + '):\n```\n' + text + '\n...\n```\nSee CI logs for the full diff.'
})
console.log('Posting diff to PR: ${{ github.event.workflow_run.pull_requests[0].number }}')
github.issues.createComment({
issue_number: ${{ github.event.workflow_run.pull_requests[0].number }},
owner: context.repo.owner,
repo: context.repo.repo,
body: 'This PR causes the following changes to the html docs (${{ steps.docs-artifacts.outputs.DOCS_GEN_ENV }}):\n```\n' + text + '\n...\n```\nSee CI logs for the full diff.'
})
Loading

0 comments on commit 5eb2ead

Please sign in to comment.