diff options
| author | Gabriel Kosmacher <73120774+kennykos@users.noreply.github.com> | 2023-03-13 13:22:02 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-13 13:22:02 -0500 |
| commit | 8e3b0bfe3487044cce57d78d803b1c8f8cbe37c5 (patch) | |
| tree | f033ede7b3b855af02c4a331405728af93c3904e /.github/workflows | |
| parent | 28c1eff12954a8c24d88fa4df036bd7221c919f3 (diff) | |
| parent | d92093d87deee8b0a03a13af4a53f78753e9ab77 (diff) | |
Merge pull request #4 from kennykos/1-set-up-binder
1 set up binder
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/analysis-notebook-test-binder.yml | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/.github/workflows/analysis-notebook-test-binder.yml b/.github/workflows/analysis-notebook-test-binder.yml new file mode 100644 index 0000000..e0185c0 --- /dev/null +++ b/.github/workflows/analysis-notebook-test-binder.yml @@ -0,0 +1,108 @@ +# This is a basic workflow to help you get started with Actions + +name: analysis-notebook-test-binder + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the main branch +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + schedule: + # * is a special character in YAML so you have to quote this string + - cron: '5 4 * * 0' + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + outputs: + IMAGE_SHA_NAME: ${{ steps.install-using-repo2docker.outputs.IMAGE_SHA_NAME }} + OUT_IMGNAME: ${{ steps.package-build.outputs.OUT_IMGNAME }} + strategy: + matrix: + # Two tests are sufficient because the other notebooks are already + # tested in the manual install and the timeline notebooks are almost + # identical + target: [ui_security_inventory_23_parsing.ipynb] + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout + uses: actions/checkout@v2 + + - name: Create a docker image using repo2docker + id: install-using-repo2docker + uses: shankari/repo2docker-action@master + with: + IMAGE_NAME: "toriis" + + - name: Verify repo2docker environment + run: | + echo "image SHA was ${{ steps.install-using-repo2docker.outputs.IMAGE_SHA_NAME }}" + echo "Listing all images" + docker image list + + echo "Checking to see if toriis exists" + docker image list | grep toriis | wc -l + echo "Checking to see if repo2docker creation image exists" + docker image list | grep repo2docker | wc -l + + echo "Reading versions of related software" + echo "---- DOCKER ----" + docker --version + CURR_DOCKER_VER=`docker --version` + echo "---- CONDA ----" + docker run ${{ steps.install-using-repo2docker.outputs.IMAGE_SHA_NAME }} /srv/conda/bin/conda --version | cut -d " " -f 2 + CURR_CONDA_VER=`docker run ${{ steps.install-using-repo2docker.outputs.IMAGE_SHA_NAME }} /srv/conda/bin/conda --version | cut -d " " -f 2` + echo "---- repo2docker----" + docker run jupyter/repo2docker:master pip3 list | grep jupyter-repo2docker + CURR_R2D_VER=`docker run jupyter/repo2docker:master pip3 list | grep jupyter-repo2docker` + echo "On checking, docker ver is $CURR_DOCKER_VER" + echo " conda ver is $CURR_CONDA_VER and" + echo " repo2docker ver is $CURR_R2D_VER" + + - name: Start the recently built docker container + run: | + echo "image SHA was ${{ steps.install-using-repo2docker.outputs.IMAGE_SHA_NAME }}" + docker run --name toriis_test -d -p 8888:8888 ${{ steps.install-using-repo2docker.outputs.IMAGE_SHA_NAME }} jupyter notebook --ip 0.0.0.0 + + - name: Test the interactive timeline + run: | + echo "About to run notebooks" + docker exec toriis_test python bin/run_notebooks.py ${{ matrix.target }} + echo "After running the notebooks, checking container list" + docker container list + + - name: Copy the failure output + id: copy-failure-output + if: failure() + run: | + OUT_FILENAME=`echo ${{ matrix.target }} | sed "s/.ipynb/_out.ipynb/"` + echo "output filename = $OUT_FILENAME" + + echo "About to copy file from docker" + docker exec toriis_test ls + DOCKER_WD=`docker exec toriis_test pwd` + echo "DOCKER_WD=$DOCKER_WD" + docker exec toriis_test ls $DOCKER_WD + docker exec toriis_test ls $DOCKER_WD/$OUT_FILENAME + docker cp toriis_test:$DOCKER_WD/$OUT_FILENAME /tmp + ls -al /tmp/$OUT_FILENAME + echo "::set-output name=OUT_FILENAME::${OUT_FILENAME}" + + - name: Upload result for the interactive timeline + if: failure() + uses: actions/upload-artifact@v1 + with: + name: ${{ steps.copy-failure-output.outputs.OUT_FILENAME }} + path: /tmp/${{ steps.copy-failure-output.outputs.OUT_FILENAME }} + + - name: Shutdown the recently built docker container + run: | + echo "Running docker container list" + docker container list + docker stop toriis |
