From 96f26596b3c5d9d2a0cdfb823561c5048549a3d9 Mon Sep 17 00:00:00 2001 From: Roman Yurchak Date: Fri, 17 Aug 2018 11:29:10 +0300 Subject: [PATCH 1/2] Better Circle CI workflow --- .circleci/config.yml | 69 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 58 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 503375ee0..90bfd7da4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,11 +1,13 @@ version: 2 + +defaults: &defaults + working_directory: ~/repo + docker: + - image: circleci/python:3.6.5-stretch-browsers + jobs: build: - docker: - - image: circleci/python:3.6.5-stretch-browsers - - working_directory: ~/repo - + <<: *defaults steps: - checkout @@ -23,7 +25,13 @@ jobs: sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 --slave /usr/bin/g++ g++ /usr/bin/g++-8 sudo update-alternatives --set gcc /usr/bin/gcc-8 - sudo pip install pytest-xdist pytest-instafail selenium PyYAML + sudo pip install virtualenv + + virtualenv pyodide-env + + source pyodide-env/bin/activate + + pip install pytest pytest-xdist pytest-instafail selenium PyYAML # Get recent version of Firefox and geckodriver wget -O firefox.tar.bz2 https://download.mozilla.org/\?product\=firefox-nightly-latest-ssl\&os\=linux64\&lang\=en-US @@ -36,13 +44,11 @@ jobs: unzip chromedriver_linux64.zip mv chromedriver firefox - # This Debian is so old, it doesn't know about wasm as a mime type, which then - # causes Firefox to complain when loading it. Let's just add the new mime type. - sudo bash -c "echo 'application/wasm wasm' >> /etc/mime.types" - run: name: lint command: | + source pyodide-env/bin/activate make lint - restore_cache: @@ -53,9 +59,11 @@ jobs: name: build no_output_timeout: 1200 command: | + source pyodide-env/bin/activate ccache -z make ccache -s + make build/test.html build/test_data.txt - save_cache: paths: @@ -63,15 +71,47 @@ jobs: - ~/.ccache key: v1-emsdk-{{ checksum "emsdk/Makefile" }}-v6-{{ .BuildNum }} + - persist_to_workspace: + root: . + paths: + - ./* + + test-firefox: + <<: *defaults + steps: + - attach_workspace: + at: . - run: name: test command: | + # This Debian is so old, it doesn't know about wasm as a mime type, which then + # causes Firefox to complain when loading it. Let's just add the new mime type. + sudo bash -c "echo 'application/wasm wasm' >> /etc/mime.types" + + source pyodide-env/bin/activate export PATH=$PWD/firefox:$PATH - make test + pytest test -v --instafail -k firefox + + test-chrome: + <<: *defaults + steps: + - attach_workspace: + at: ~/repo/build + - run: + name: test + command: | + # This Debian is so old, it doesn't know about wasm as a mime type, which then + # causes Firefox to complain when loading it. Let's just add the new mime type. + sudo bash -c "echo 'application/wasm wasm' >> /etc/mime.types" + + source pyodide-env/bin/activate + export PATH=$PWD/firefox:$PATH + pytest test -v --instafail -k chrome deploy: machine: enabled: true + steps: - run: name: Deploy to Github Pages @@ -83,9 +123,16 @@ workflows: build-and-deploy: jobs: - build - - deploy: + - test-chrome: requires: - build + - test-firefox: + requires: + - build + - deploy: + requires: + - test-chrome + - test-firefox filters: branches: only: master From ff6f7e3616594dd74c7cb7f199ed478f45448c1b Mon Sep 17 00:00:00 2001 From: Roman Yurchak Date: Fri, 24 Aug 2018 17:31:28 +0300 Subject: [PATCH 2/2] Better CircleCI workspace usage --- .circleci/config.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 90bfd7da4..072dd09f6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -74,11 +74,14 @@ jobs: - persist_to_workspace: root: . paths: - - ./* + - ./build + - ./pyodide-env + - ./firefox test-firefox: <<: *defaults steps: + - checkout - attach_workspace: at: . - run: @@ -95,8 +98,9 @@ jobs: test-chrome: <<: *defaults steps: + - checkout - attach_workspace: - at: ~/repo/build + at: . - run: name: test command: | @@ -113,6 +117,9 @@ jobs: enabled: true steps: + - checkout + - attach_workspace: + at: . - run: name: Deploy to Github Pages command: |