Skip to content

Deleted the loose motion file from cpac_outputs.tsv #795

Deleted the loose motion file from cpac_outputs.tsv

Deleted the loose motion file from cpac_outputs.tsv #795

name: Check updated preconfigs
on:
push:
jobs:
check-updated-preconfigs:
name: Check if preconfigs need updated
runs-on: ubuntu-latest
steps:
- name: Check out C-PAC
uses: actions/checkout@v2
with:
fetch-depth: 2
- uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- name: Check if version updated
run: |
git config --global user.email "[email protected]"
git config --global user.name "Theodore (Machine User)"
GITHUB_BRANCH=$(echo ${GITHUB_REF} | cut -d '/' -f 3-)
export PYTHONPATH=$PWD
pip install -q wheel
pip install -q nipype numpy matplotlib pandas pathvalidate pytz pyyaml voluptuous yamlordereddictloader
python ./CPAC/utils/configuration/yaml_template.py
if [[ ! -z $(git diff origin/${GITHUB_BRANCH}) ]]
then
git add CPAC/resources/configs
git commit -m ":bulb: Update comments based on default preconfig"
fi
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
if [[ ! "$COMMIT_MESSAGE" == *"Update version to"* ]]
then
cd CPAC
VERSION=$(python -c "from info import __version__; print(('.'.join(('.'.join(__version__[::-1].split('-')[1].split('.')[1:])[::-1], __version__.split('-')[1])) if '-' in __version__ else __version__).split('+', 1)[0])")
cd ..
echo "v${VERSION}" > version
find ./CPAC/resources/configs -name "*.yml" -exec sed -i -r "s/^(# [Vv]ersion ).*$/# Version ${VERSION}/g" {} \;
git add version
VERSIONS=($(git diff origin/${GITHUB_BRANCH} -- version | tail -n 2))
export PATTERN="(declare|typeset) -a"
if [[ "$(declare -p VERSIONS)" =~ $PATTERN ]]
then
for DOCKERFILE in $(find ./.github/Dockerfiles -name "*.Dockerfile")
do
export IFS=""
for LINE in $(grep "FROM ghcr\.io/fcp\-indi/c\-pac/.*\-${VERSIONS[0]:1}" ${DOCKERFILE})
do
echo "Updating stage tags in ${DOCKERFILE}"
sed -i "s/\-${VERSIONS[0]:1}/\-${VERSIONS[1]:1}/g" ${DOCKERFILE}
done
done
unset IFS
fi
if [[ ! -z $(git diff origin/${GITHUB_BRANCH}) ]]
then
git add CPAC/resources/configs .github/Dockerfiles
git commit -m ":bookmark: Update version to ${VERSION} ($COMMIT_MESSAGE)" || true
git push origin HEAD:${GITHUB_BRANCH} || true
fi
cd ..
fi
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]
then
cd $HOME/work/C-PAC/C-PAC
for DOCKERFILE in $(ls .github/Dockerfiles/C-PAC.develop-*.Dockerfile)
do
if [[ "$DOCKERFILE" =~ .*C-PAC.develop-(.*)-(bionic|xenial).Dockerfile ]]
then
cp $DOCKERFILE variant-${BASH_REMATCH[1]}.Dockerfile
else
cp $DOCKERFILE Dockerfile
fi
done
git add *ockerfile
git commit -m ":truck: Copy develop Dockerfiles to root directory \
\
[skip ci]"
git push origin HEAD:${GITHUB_BRANCH} || true
fi
trigger-next-workflow:
needs: check-updated-preconfigs
runs-on: ubuntu-latest
steps:
- name: Set up check
uses: Sibz/[email protected]
with:
authToken: ${{ secrets.ACTIONS_WORKFLOW_TOKEN }}
context: "Build C-PAC images"
state: pending
- name: Check out C-PAC
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Build stages
if: github.ref_type == 'branch'
run: |
pip install PyGithub
BASE_REFS=$(python .github/scripts/get_pr_base_shas.py)
if [ -n "$BASE_REFS" ]
then
for REF in $BASE_REFS
do
echo "Running against base $REF"
gh workflow run build_stages.yml --ref ${GITHUB_REF_NAME} -f base_ref="$REF"
done
else
echo "Running against last PR"
gh workflow run build_stages.yml --ref ${GITHUB_REF_NAME}
fi
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_WORKFLOW_TOKEN }}
- name: Build, test, and push C-PAC
if: github.ref_type == 'tag'
run: |
pip install PyGithub
gh workflow run build_and_test.yml --ref ${GITHUB_REF_NAME}
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_WORKFLOW_TOKEN }}