Submit runs to runBioSimulations and publish runs to BioSimulations #81
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: Submit runs to runBioSimulations and publish runs to BioSimulations | |
on: | |
schedule: | |
- cron: '0 1 * * 0' # weekly at 1:00 am on Sundays | |
workflow_dispatch: | |
inputs: | |
updateProjectSources: | |
description: 'Whether to update the source files for the projects: "0" or "1" (default)' | |
required: false | |
default: '1' | |
updateCombineArchives: | |
description: 'Whether to rebuild existing COMBINE/OMEX archives: "0" (default) or "1"' | |
required: false | |
default: '0' | |
validateCombineArchives: | |
description: 'Whether to simulate the COMBINE/OMEX archives in this GitHub action (in addition to in runBioSimulations): "0" or "1" (default)' | |
required: false | |
default: '1' | |
simulateCombineArchives: | |
description: 'Whether to submit COMBINE/OMEX archives to runBioSimulations: "0" or "1" (default)' | |
required: false | |
default: '1' | |
updateSimulations: | |
description: 'Whether to re-run COMBINE/OMEX archives: "0" (default) or "1"' | |
required: false | |
default: '0' | |
updateSimulationRuns: | |
description: 'Whether to re-run COMBINE/OMEX archives that have already been submitted to runBioSimulations: "0" (default) or "1"' | |
required: false | |
default: '0' | |
publishCombineArchive: | |
description: 'Whether to publish the COMBINE/OMEX archives to BioSimulations: "0" or "1" (default)' | |
required: false | |
default: '1' | |
projectIds: | |
description: 'Space-separate list of ids of projects to import (e.g., "xxx" or "xxx yyy")' | |
required: false | |
default: '' | |
firstProject: | |
description: 'Iteration through projects at which to begin importing: "1" (default) or a positive integer' | |
required: false | |
default: '1' | |
maxProjects: | |
description: 'Maximum number of projects to publish: "" (no limit; default) or a positive integer' | |
required: false | |
default: '' | |
jobs: | |
publish: | |
name: Submit runs to runBioSimulations and publish runs to BioSimulations | |
runs-on: ubuntu-latest | |
env: | |
ENTREZ_EMAIL: ${{ secrets.ENTREZ_EMAIL }} | |
GRB_WLSACCESSID: ${{ secrets.GRB_WLSACCESSID }} | |
GRB_WLSSECRET: ${{ secrets.GRB_WLSSECRET }} | |
GRB_LICENSEID: ${{ secrets.GRB_LICENSEID }} | |
BIOSIMULATIONS_API_CLIENT_ID: ${{ secrets.BIOSIMULATIONS_API_CLIENT_ID }} | |
BIOSIMULATIONS_API_CLIENT_SECRET: ${{ secrets.BIOSIMULATIONS_API_CLIENT_SECRET }} | |
BUCKET_ENDPOINT: ${{ secrets.BUCKET_ENDPOINT }} | |
BUCKET_NAME: ${{ secrets.BUCKET_NAME }} | |
BUCKET_ACCESS_KEY_ID: ${{ secrets.BUCKET_ACCESS_KEY_ID }} | |
BUCKET_SECRET_ACCESS_KEY: ${{ secrets.BUCKET_SECRET_ACCESS_KEY }} | |
steps: | |
# Checkout repository | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 1 | |
ref: dev | |
lfs: true | |
# Install requirements | |
- name: Install Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Setup pip cache | |
uses: actions/cache@v2 | |
with: | |
path: /opt/hostedtoolcache/Python | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements.optional.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install pip and setuptools | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade setuptools | |
# install package | |
- name: Install the package | |
run: python -m pip install -e . | |
# Submit runs to runBioSimulations and publish runs to BioSimulations | |
- name: Submit runs to runBioSimulations and publish runs to BioSimulations | |
run: | | |
args="" | |
if [ "${{ github.event.inputs.updateProjectSources }}" = "1" ]; then | |
args="$args --update-project-sources" | |
fi | |
if [ "${{ github.event.inputs.updateCombineArchives }}" = "1" ]; then | |
args="$args --update-combine-archives" | |
fi | |
if [ "${{ github.event.inputs.updateSimulations }}" = "1" ]; then | |
args="$args --update-simulations" | |
fi | |
if [ "${{ github.event.inputs.updateSimulationRuns }}" = "1" ]; then | |
args="$args --update-simulation-runs" | |
fi | |
if [ "${{ github.event.inputs.validateCombineArchives }}" = "0" ]; then | |
args="$args --skip-simulation" | |
fi | |
if [ "${{ github.event.inputs.simulateCombineArchives }}" = "0" ]; then | |
args="$args --dry-run" | |
fi | |
if [ "${{ github.event.inputs.publishCombineArchive }}" = "0" ]; then | |
args="$args --skip-publication" | |
fi | |
if [ ! -z "${{ github.event.inputs.projectIds }}" ]; then | |
args="$args --project ${{ github.event.inputs.projectIds }}" | |
fi | |
if [ ! -z "${{ github.event.inputs.firstProject }}" ]; then | |
args="$args --first-project ${{ github.event.inputs.firstProject }}" | |
fi | |
if [ ! -z "${{ github.event.inputs.maxProjects }}" ]; then | |
args="$args --max-projects ${{ github.event.inputs.maxProjects }}" | |
fi | |
biosimulations-bigg run-projects-and-publish $args | |
# Push compiled projects | |
- id: commit-projects | |
name: Commit the compiled projects | |
run: | | |
git config --local user.email "biosimulations.daemon@gmail.com" | |
git config --local user.name "biosimulationsdaemon" | |
git config pull.rebase false | |
git stash | |
git pull | |
set +e | |
git stash pop | |
git add biosimulations_bigg/source | |
git lfs track biosimulations_bigg/source/thumbnails/**/*.tar.gz | |
git add -f biosimulations_bigg/source/thumbnails/**/*.tar.gz | |
git add -f biosimulations_bigg/source/thumbnails/**/**/*.jpg | |
git add -f biosimulations_bigg/source/thumbnails/**/**/*.nxml | |
git add biosimulations_bigg/final | |
git commit -m "Updated compiled projects [skip ci]" | |
if [[ $? = 0 ]]; then | |
changed=1 | |
else | |
changed=0 | |
fi | |
echo "::set-output name=changed::$changed" | |
- name: Push the compiled projects | |
if: steps.commit-projects.outputs.changed == '1' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: dev |