blob: f47a7158c35c3875ec7188bc3dd0151c4df188fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# 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 master branch
on:
push:
branches: [ 2-set-up-binder-1 ]
pull_request:
branches: [ 2-set-up-binder-1 ]
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:
# We would ideally have two jobs here called "build" and "test"
# However, in order to do that we would have to publish the image as an artifact
# to share it between jobs
# https://help.github.com/en/actions/configuring-and-managing-workflows/persisting-workflow-data-using-artifacts
# and it looks like the generated image is too large
# https://github.com/MobilityNet/mobilitynet-analysis-scripts/runs/613707818?check_suite_focus=true
# -rw-r--r-- 1 runner docker 3.3G Apr 23 21:37 /tmp/mobilitynet_84f67fcad71c.tar
# Filesystem Size Used Avail Use% Mounted on
# /dev/sda1 84G 79G 5.1G 94% /
# https://github.com/MobilityNet/mobilitynet-analysis-scripts/runs/612938777?check_suite_focus=true
# Fail to upload '/tmp/mobilitynet_ec3aba6d029f.tar' due to 'Blob is incomplete (missing block).
# while we figure out how to trim that, we have to run them as steps in the same job
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: jupyterhub/repo2docker-action@master
with:
IMAGE_NAME: "toriis-analysis"
- 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-analysis exists"
docker image list | grep toriis-analysis | 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-analysis_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-analysis_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-analysis_test ls
DOCKER_WD=`docker exec toriis-analysis_test pwd`
echo "DOCKER_WD=$DOCKER_WD"
docker exec toriis-analysis_test ls $DOCKER_WD
docker exec toriis-analysis_test ls $DOCKER_WD/$OUT_FILENAME
docker cp mobilitynet_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 mobilitynet_test
|