Skip to content

Update test-model.yml #25

Update test-model.yml

Update test-model.yml #25

Workflow file for this run

# This workflow tests the model on the main branch
name: Model test on push
on:
push:
branches: ["main"]
workflow_dispatch:
jobs:
test:
if: github.repository != 'ersilia-os/eos-template'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
with:
lfs: true
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.12"
auto-activate-base: false
- name: Install dependencies
run: |
conda run -n base conda install git-lfs -c conda-forge
conda run -n base git-lfs install
conda run -n base conda install gh -c conda-forge
conda run -n base python -m pip install 'git+https://github.com/ersilia-os/ersilia.git#egg=ersilia[test]'
- name: Update metadata to AirTable
id: update-metadata-to-airtable
env:
USER_NAME: ${{ github.repository_owner }}
BRANCH: "main"
REPO_NAME: ${{ github.event.repository.name }}
AIRTABLE_API_KEY: ${{ secrets.AIRTABLE_API_KEY }}
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: |
source activate
pip install requests pyairtable
echo "Updating metadata to AirTable looking at owner: $USER_NAME"
wget https://raw.githubusercontent.com/ersilia-os/ersilia/master/.github/scripts/airtableops.py
python3 airtableops.py airtable-update --user $USER_NAME --repo $REPO_NAME --branch $BRANCH --api-key $AIRTABLE_API_KEY
rm airtableops.py
- name: Sync metadata to S3 JSON
id: sync-metadata-to-s3
env:
AIRTABLE_API_KEY: ${{ secrets.AIRTABLE_API_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
wget https://raw.githubusercontent.com/ersilia-os/ersilia/master/.github/scripts/convert_airtable_to_json.py
pip install boto3 requests pyairtable
python convert_airtable_to_json.py $AIRTABLE_API_KEY $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY
rm convert_airtable_to_json.py
- name: Update README file
id: update-readme-file
env:
MODEL_ID: ${{ github.event.repository.name }}
run: |
conda run -n base bash -c "
echo 'Updating README file with AirTable metadata for model: $MODEL_ID' &&
wget https://raw.githubusercontent.com/ersilia-os/ersilia/master/.github/scripts/airtableops.py &&
python3 airtableops.py readme-update --repo $MODEL_ID --path . &&
rm airtableops.py &&
less README.md
"
- name: Commit and push changes done to the README file
uses: actions-js/push@156f2b10c3aa000c44dbe75ea7018f32ae999772 # pin@v1.4
with:
author_name: "ersilia-bot"
author_email: "ersilia-bot@users.noreply.github.com"
message: "updating readme [skip ci]"
repository: "ersilia-os/${{ github.event.repository.name }}"
github_token: ${{ secrets.GITHUB_TOKEN }}
amend: true
force: true
- name: Fetch model and run it simply
env:
MODEL_ID: ${{ github.event.repository.name }}
run: |
conda run -n base bash -c "
ersilia -v fetch $MODEL_ID --from_github &&
ersilia serve $MODEL_ID &&
ersilia example -f input.csv -n 3 &&
ersilia run -i input.csv -o output.csv &&
ersilia close &&
ersilia delete $MODEL_ID &&
head output.csv
"
# TODO(@dhanshree) We can potentially restore the retries.
# - name: Test model
# env:
# MODEL_ID: ${{ github.event.repository.name }}
# run: |
# ersilia -v test $MODEL_ID --from_github --shallow > test.log
# Upload EOS logs and test logs
- name: Upload log output
if: always()
uses: actions/upload-artifact@v4.5.0
with:
name: debug-logs
retention-days: 14
path: |
/home/runner/eos/*.log
./*.log