updated workflow files #17
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: Model test on push | |
on: | |
push: | |
branches: ['main'] | |
workflow_dispatch: | |
jobs: | |
test: | |
if: github.repository != 'ersilia-os/eos-template' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout persist credentials | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # [email protected] | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
lfs: 'true' | |
# This might stop working in the future, so we need to keep an eye on it | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
# this might remove tools that are actually needed, | |
# if set to "true" but frees about 6 GB | |
tool-cache: true | |
# all of these default to true, but feel free to set to | |
# "false" if necessary for your workflow | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
swap-storage: true | |
- name: Add conda to system path | |
run: echo $CONDA/bin >> $GITHUB_PATH | |
- name: Source conda | |
run: source $CONDA/etc/profile.d/conda.sh | |
- name: Set Python to 3.10.10 | |
run: | |
conda install -y python=3.10.10 | |
- name: Install dependencies | |
run: | | |
source activate | |
conda init | |
conda install git-lfs -c conda-forge | |
git-lfs install | |
conda install gh -c conda-forge | |
- name: Install ersilia | |
run: | | |
source activate | |
python --version | |
echo "After conda init" | |
conda init | |
python -m pip install git+https://github.com/ersilia-os/ersilia.git | |
- 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: | | |
source activate | |
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: | | |
source activate | |
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 # [email protected] | |
with: | |
author_name: "ersilia-bot" | |
author_email: "[email protected]" | |
message: "updating readme [skip ci]" | |
repository: "ersilia-os/${{ github.event.repository.name }}" | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
amend: true | |
force: true | |
- name: Fetch model | |
env: | |
MODEL_ID: ${{ github.event.repository.name }} | |
run: | | |
source activate | |
ersilia -v fetch $MODEL_ID --from_dir . | |
FOLDER="$HOME/eos/repository/$MODEL_ID" | |
if [ ! -d "$FOLDER" ]; then | |
echo "Error: Folder '$FOLDER' does not exist." >&2 | |
exit 1 | |
fi | |
- name: Generate input and run model | |
env: | |
MODEL_ID: ${{ github.event.repository.name }} | |
run: | | |
source activate | |
ersilia -v serve $MODEL_ID | |
ersilia example -n 5 -f input.csv --predefined | |
ersilia -v run -i "input.csv" -o "output.csv" | |
ersilia close | |
cat output.csv | |
- name: Test output | |
run: | | |
output=$(python .github/scripts/verify_model_outcome.py output.csv) | |
if echo "$output" | grep -q "All outcomes are null"; then | |
echo "Error in model outcome, aborting test" | |
exit 1 | |
fi | |
rm output.csv | |
- name: Upload log output | |
if: always() | |
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb #pin v3.1.1 | |
with: | |
name: debug-logs | |
retention-days: 14 | |
path: /home/runner/eos/*.log |