File data loading #446
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: Sim Request | |
on: | |
issues: | |
types: [labeled, edited] | |
jobs: | |
build: | |
if: contains(github.event.issue.labels.*.name, 'sim request') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# with: | |
# ref: '8f63eb1612a7fd3b6e6182ea7db8a863ff7c4478' | |
- name: Set up latest Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
# - name: View the github context | |
# env: | |
# GITHUB_CONTEXT: ${{ toJson(github) }} | |
# run: | | |
# echo "$GITHUB_CONTEXT" | |
- name: Checkout branch for results | |
run: | | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config user.name "github-actions[bot]" | |
git config --add --bool push.autoSetupRemote true | |
git fetch origin | |
BRANCH=sim-request-${{ github.event.issue.number }}; \ | |
if `git show-ref --verify --quiet refs/remotes/origin/$BRANCH`; then \ | |
echo "Checking out existing branch..."; \ | |
git checkout $BRANCH; \ | |
else \ | |
echo "Checking out new branch..."; \ | |
git checkout -b $BRANCH; \ | |
fi | |
- name: Run pool simulation | |
id: sim-run | |
env: | |
BODY: ${{ github.event.issue.body }} | |
run: | | |
# will extract settings from BODY env var | |
python3 .github/workflows/parse_sim_request.py > sim_settings.json | |
python3 .github/workflows/run_sim_request.py < sim_settings.json | |
- name: Save results | |
id: sim-save | |
run: | | |
git add . | |
git commit -m "Commit sim results - GH run ID: ${{ github.run_id }}" | |
git push | |
- name: Failure comment | |
if: failure() | |
uses: peter-evans/create-or-update-comment@v2 | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
Simulation run has failed. Please contact the research team for assistance. | |
- name: Success comment | |
if: steps.sim-save.outcome == 'success' | |
uses: peter-evans/create-or-update-comment@v2 | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
Simulation run has completed successfuly. | |
[Sim results](https://github.com/curveresearch/curvesim/tree/sim-request-${{ github.event.issue.number }}/results) | |