Implementation for discrete multisession #285
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
name: PR Status | |
# Adapted from https://github.com/shift-happens-benchmark/icml-2022/blob/main/.github/workflows/pr-status.yml | |
# Apache 2.0 licensed | |
# NOTE(stes): Use pull_request_target instead of pull_request to allow | |
# to post comments on the current PR, even when an external contributor | |
# opens a PR. | |
# IMPORTANT: DO NOT EXPOSE REPOSITORY SECRETS WITHIN THIS PR! | |
on: | |
pull_request: | |
branches: | |
- main | |
- public | |
- dev | |
permissions: | |
pull-requests: write | |
jobs: | |
documentation-status: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.8'] | |
steps: | |
# NOTE(stes) currently not used, we check | |
# the entire codebase now by default. | |
#- uses: actions/checkout@v3 | |
# with: | |
# ref: main | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v1 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip | |
restore-keys: | | |
${{ runner.os }}-pip | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install package | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
pip install interrogate==1.5.0 | |
- name: documentation | |
id: documentation | |
run: | | |
RESULT=$(make --silent interrogate) | |
RESULT=$(tail -n +3 <<< $RESULT) | |
STATUS=$(tail -n1 <<< $RESULT) | |
STATUS=$(sed 's/-//g' <<< $STATUS) | |
# trim | |
STATUS=$(echo $STATUS | xargs echo -n) | |
RESULT=$(head -n -1 <<< $RESULT) | |
# remove second to last line | |
RESULTA=$(head -n -2 <<< $RESULT) | |
RESULTB=$(tail -n1 <<< $RESULT) | |
NL=$'\n' | |
RESULT="$RESULTA${NL}||||||${NL}$RESULTB" | |
RESULT="$RESULT${NL}${NL}$STATUS" | |
RESULT="${RESULT//'%'/'%25'}" | |
RESULT="${RESULT//$'\n'/'%0A'}" | |
RESULT="${RESULT//$'\r'/'%0D'}" | |
echo "::set-output name=result::$RESULT" | |
continue-on-error: true | |
#- name: comment documentation result on PR | |
# uses: thollander/actions-comment-pull-request@v1 | |
# with: | |
# message: | | |
# ## Docstring Coverage Report | |
# ${{ steps.documentation.outputs.result }} | |
# comment_includes: '## Docstring Coverage Report' | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# following snippet borrowed from | |
# https://stackoverflow.com/a/58003436 | |
# CC BY-SA 4.0, Peter Evans | |
- name: Fail on insufficient coverage | |
if: steps.documentation.outcome != 'success' | |
run: exit 1 |