diff --git a/.github/workflows/upload-model-to-dockerhub.yml b/.github/workflows/upload-model-to-dockerhub.yml index 5cfe0af..82d5b02 100644 --- a/.github/workflows/upload-model-to-dockerhub.yml +++ b/.github/workflows/upload-model-to-dockerhub.yml @@ -14,12 +14,12 @@ jobs: 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 @@ -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: @@ -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 [ $expected -ne $result ] + 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 @@ -69,7 +140,7 @@ 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 @@ -77,7 +148,7 @@ jobs: 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 " @@ -106,32 +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: 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 diff --git a/output.json b/output.json new file mode 100644 index 0000000..9f2c237 --- /dev/null +++ b/output.json @@ -0,0 +1,113 @@ +[ + { + "input": { + "key": "IJDNQMDRQITEOD-UHFFFAOYSA-N", + "input": "CCCC", + "text": "CCCC" + }, + "output": { + "outcome": [ + "CCCC", + "CCCCC", + "CCCP", + "CCCBr", + "CCCN", + "[CH2-]CCC", + "[CH2]CCC", + "CCCF", + "CCCCl", + "CCCO", + "CCCI", + "CCCS", + "CCCSC", + "CC[Si]CC", + "CC[CH-]CC", + "CC[SiH2]CC", + "CCNCC", + "CCSCC", + "CCCNC", + "CCC[SiH2]C", + "CC[SnH4+2]CC", + "CCOCC", + "CC[CH]CC", + "C[CH-]CCC", + "CCBCC", + "CCPCC", + "CCCOC", + "C[CH]CCC", + "CCCPC", + "CC[Sn]CC", + "[CH2-]CCCC", + "CCCCI", + "C#CCCC", + "CCCCN", + "CCCC#N", + "CCCC[Sn+2]", + "CCCC[SiH2]", + "CCCC[SnH]", + "CCCCO", + "[C-]#[N+]CCC", + "CCCC[SiH3]", + "CCCC[SnH3]", + "CCCCP", + "[CH2]CCCC", + "CCCC=O", + "CCCCBr", + "CCCC[SnH6+3]", + "CCCCF", + "CCCCCl", + "C=CCCC", + "CCCCS", + "CCOC", + "CCSC", + "C[CH-]CC", + "C[CH]CC", + "CCNC", + "CCC(C)C", + "CC[C@@H](C)S", + "CCC(C)=O", + "C=C(C)CC", + "CC[C@@H](C)I", + "CC[C@H](C)O", + "CC[C@H](C)Br", + "CC[C@@H](C)Br", + "CCC(C)=S", + "CC[C-](C)C", + "CC[C@H](C)Cl", + "CC[C@H](C)S", + "CC[C@@H](C)N", + "CC[C@H](C)I", + "CC[C@@H](C)F", + "CC[C@@H](C)O", + "CC[C@H](C)N", + "CC[C@@H](C)Cl", + "CC[C@H](C)F", + "C/C=C/CC", + "C/C=C\\CC", + "CC=CCC", + "CC#[N+]CC", + "CC#CCC", + "C#CCC", + "C=CCC", + "C/C=C/C", + "CC#CC", + "C/C=C\\C", + "C[CH]C(C)C", + "[CH2]CCCCl", + "[CH2-]CCCF", + "[CH2]CCCO", + "CC1CC1", + "C[C@@H]1CCO1", + "C[C@@H]1CCN1", + "CC1CCC1", + "[CH]1CCC1", + "[CH2-]C1CC1", + "BrC1CCC1", + "[CH-]1CCC1", + "C1CCCC1", + "C1CCC1", + "C1C2CC12" + ] + } + } +] \ No newline at end of file