Skip to content

Commit

Permalink
updating readme [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
ersilia-bot committed Apr 11, 2024
1 parent e75358b commit 5849d98
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 31 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test-model-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ jobs:
- 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
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/test-model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
- 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
Expand Down Expand Up @@ -102,7 +106,14 @@ jobs:
echo "$assignees" >> $GITHUB_STEP_SUMMARY
echo "shuffled_assignee=$assignees" >> $GITHUB_OUTPUT
echo "shuffled_assignee=$assignees" >> $GITHUB_ENV
- name: Check for existing issue
id: check_issue
run: |
gh auth login --with-token <<< ${{ secrets.GITHUB_TOKEN }}
issue_number=$(gh issue list --limit 100 --search "${{ vars.test_issue_title }}" --json number --jq '.[0].number')
echo "::set-output name=issue_number::$issue_number"
- name: Create a Test issue
uses: actions-ecosystem/action-create-issue@b63bc2bbacb6a838dfe4a9f70da6665ae0962a49
id: create_issue
Expand All @@ -115,3 +126,4 @@ jobs:
This model is ready for testing. If you are assigned to this issue, please try it out using the CLI, Google Colab and DockerHub and let us know if it works!
labels: |
test
if: steps.check_issue.outputs.issue_number == ''
108 changes: 79 additions & 29 deletions .github/workflows/upload-model-to-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ on:

jobs:
upload_model_to_dockerhub:
if: github.repository != 'ersilia-os/eos-template'
if: ${{ github.repository != 'ersilia-os/eos-template' && github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3

# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

# log in to dockerhub
- name: Login to Docker Hub
Expand All @@ -35,7 +35,22 @@ jobs:
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'

- 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: Generate the Dockerfile
id: generate-dockerfile
env:
Expand All @@ -44,11 +59,67 @@ jobs:
wget https://raw.githubusercontent.com/ersilia-os/ersilia/master/.github/scripts/place_a_dockerfile_in_current_eos_repo.py
python -m pip install requests
python place_a_dockerfile_in_current_eos_repo.py $REPO_NAME
# We cannot tag it as anything other than latest because
# ersilia cli only looks for the 'latest' tag
- name: Build only AMD64 Image for Testing
id: buildForTest
uses: docker/build-push-action@v5
with:
context: .
load: true
tags: ersiliaos/${{ github.event.repository.name }}:latest

- 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
# TODO This is very hacky, maybe we want to use the ersilia test command in the future for this
- name: Test Built Image
id: testBuiltImage
run: |
ersilia -v fetch ${{ github.event.repository.name }} --from_dockerhub
ersilia -v serve ${{ github.event.repository.name }}
ersilia -v run -i "CCCC" -o "output.json"
expected=$(jq '.[0].output.outcome[]' output.json | wc -l)
result=$(jq '.[0].output.outcome[] | select(. != null)' output.json | wc -l)
echo "Expected correct outcomes $expected"
echo "Returned correct outcomes $result"
if ! ([ $result -gt 0 ] && [ $result -le $expected ])
then
echo "Error in model output, aborting build and push"
exit 1
fi
env:
PULL_IMAGE: n

- name: Build and push
id: buildMultiple
continue-on-error: true
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
timeout-minutes: 45
with:
context: .
platforms: linux/amd64,linux/arm64
Expand All @@ -69,15 +140,15 @@ jobs:
- name: Build only for Linux/amd64
id: buildSingle
if: steps.buildCheck.outputs.failed == 'true'
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ersiliaos/${{ github.event.repository.name }}:latest

- name: Update Metadata JSON file with DockerHub info
id: UpdateMetadata
id: updateMetadata
run: |
mv Dockerfile_legacy Dockerfile
python3 -c "
Expand All @@ -94,6 +165,7 @@ jobs:
json.dump(data, f, indent=4)
"
rm arch.txt
rm place_a_dockerfile_in_current_eos_repo.py
- name: Commit and push changes done to the Metadata JSON file
uses: actions-js/push@156f2b10c3aa000c44dbe75ea7018f32ae999772 # pin@v1.4
Expand All @@ -105,28 +177,6 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
amend: true
force: 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: 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
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/upload-model-to-s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
upload_model_to_s3:
if: github.repository != 'ersilia-os/eos-template'
if: ${{ github.repository != 'ersilia-os/eos-template' && github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout persist credentials
Expand All @@ -25,6 +25,10 @@ jobs:
- 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
Expand Down
14 changes: 14 additions & 0 deletions output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"input": {
"key": "IJDNQMDRQITEOD-UHFFFAOYSA-N",
"input": "CCCC",
"text": "CCCC"
},
"output": {
"outcome": [
1.605723
]
}
}
]
File renamed without changes.

0 comments on commit 5849d98

Please sign in to comment.