Skip to content

Multisession modeling functionality for AutoLFADS #179

Multisession modeling functionality for AutoLFADS

Multisession modeling functionality for AutoLFADS #179

Workflow file for this run

name: pr-deployment
on:
issue_comment:
types: [created]
jobs:
printJob:
name: Print event
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
echo "$GITHUB_CONTEXT"
deploy-check:
runs-on: ubuntu-latest
steps:
- name: vet commenter
id: vet
if: github.event.comment.user.login != 'cellistigs'
run: exit 1
- name: acknowledge deployment request to commenter
id: check
uses: khan/pull-request-comment-trigger@master
with:
trigger: "#deploy:"
prefix_only: true
reaction: rocket
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: check outputs
run: echo ${{ steps.check.outputs.triggered }}
outputs:
triggered: ${{ steps.check.outputs.triggered }}
comment_body: ${{ github.event.comment.body }}
deploy:
runs-on: ubuntu-latest
needs: deploy-check
if: needs.deploy-check.outputs.triggered == 'true'
steps:
- name: get pull request ref
id: get_pull_request_ref
uses: octokit/[email protected]
with:
route: GET /repos/{owner}/{repo}/pulls/{issue_id}
owner: cunningham-lab
repo: neurocaas
repository: ${{ github.repository }}
issue_id: ${{ github.event.issue.number }}
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: create deployment
id: create_deployment
uses: octokit/[email protected]
with:
route: POST /repos/{owner}/{repo}/deployments
owner: cunningham-lab
repo: neurocaas
repository: ${{ github.repository }}
ref: master
environment: dev
auto_merge: false
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: set deployment status to in progress
id: start_deployment
uses: octokit/[email protected]
with:
route: POST /repos/{owner}/{repo}/deployments/{deployment}/statuses
owner: cunningham-lab
repo: neurocaas
repository: ${{ github.repository }}
deployment: ${{ fromJson(steps.create_deployment.outputs.data).id }}
environment: dev
environment_url: https://example.com
log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
state: in_progress
mediaType: '{"previews": ["flash", "ant-man"]}'
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: get stack name
uses: jungwinter/split@v1
id: split
with:
msg: ${{ needs.deploy-check.outputs.comment_body }}
seperator: ':'
- name: pull the repo.
uses: actions/checkout@v2
with:
persist-credentials: false
ref: ${{ fromJson(steps.get_pull_request_ref.outputs.data).head.sha }}
- name: setup python.
uses: actions/setup-python@v2
with:
python-version: 3.8
# Log in to docker hub.
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
# Configure AWS credentials.
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.DEPLOY_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.DEPLOY_AWS_SECRET_ACCESS_KEY }}
# aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }} # if you have/need it
aws-region: us-east-1
- name: Install Repo.
run: |
cd $GITHUB_WORKSPACE
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
bash miniconda.sh -b -p $HOME/miniconda
source "$HOME/miniconda/etc/profile.d/conda.sh"
hash -r
conda config --set always_yes yes --set changeps1 no
conda update -q conda
conda config --append envs_dirs $HOME/miniconda/envs
conda create -n neurocaas
conda activate neurocaas
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install aws-sam-cli==0.53.0
pip install localstack==0.12.3
pip install ./
sudo apt-get install jq
- name: Deploy stack
run: |
cd ncap_iac/ncap_blueprints
source "$HOME/miniconda/etc/profile.d/conda.sh"
conda activate neurocaas
bash iac_utils/fulldeploy.sh ${{ steps.split.outputs._1 }}
- name: set test status to success
id: successful_test
uses: octokit/[email protected]
with:
route: POST /repos/{owner}/{repo}/deployments/{deployment}/statuses
owner: cunningham-lab
repo: neurocaas
repository: ${{ github.repository }}
deployment: ${{ fromJson(steps.create_deployment.outputs.data).id }}
environment: dev
environment_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
mediaType: '{"previews": ["ant-man"]}'
state: success
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: set test status to failure
id: failed_test
uses: octokit/[email protected]
if: failure()
with:
route: POST /repos/{owner}/{repo}/deployments/{deployment}/statuses
owner: cunningham-lab
repo: neurocaas
repository: ${{ github.repository }}
deployment: ${{ fromJson(steps.create_deployment.outputs.data).id }}
environment: dev
environment_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
mediaType: '{"previews": ["ant-man"]}'
state: failure
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"