From f94e1872f3089098a9685fa4f25e3a334136d5b7 Mon Sep 17 00:00:00 2001 From: carlosmondra Date: Mon, 24 Jul 2023 10:35:57 -0600 Subject: [PATCH] Make steps more clear and efficient (#1780) * Make steps more clear and efficient * Fix indentation * Add missing clone command --------- Co-authored-by: Melisa Bok --- .circleci/config.yml | 100 +++++++++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 42 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b33e9dc22..1430bd382 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,6 +12,8 @@ parameters: jobs: build: + # The resource_class feature allows configuring CPU and RAM resources for each job. Different resource classes are available for different executors. https://circleci.com/docs/2.0/configuration-reference/#resourceclass + resource_class: large parallelism: 10 working_directory: ~/openreview-py-repo docker: @@ -25,46 +27,50 @@ jobs: transport.host: localhost steps: - checkout - - run: - name: Initialize Replica Set + name: Initialize replica set command: | sudo apt-get install gnupg curl curl -fsSL https://pgp.mongodb.com/server-6.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg --dearmor echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list sudo apt-get update sudo apt-get upgrade -y - sudo apt-get install -y mongodb-org=6.0.7 mongodb-org-database=6.0.7 mongodb-org-server=6.0.7 mongodb-org-mongos=6.0.7 mongodb-org-tools=6.0.7 + sudo apt-get install -y mongodb-org=6.0.7 mongosh mongodb://localhost:27017 --eval "rs.initiate()" - - run: pip install ~/openreview-py-repo - - run: git clone - https://$OPENREVIEW_GITHUB@github.com/openreview/openreview-api-v1.git - ~/openreview - - run: cd ~/openreview && git checkout << - pipeline.parameters.openreview-api-v1-branch >> - - run: git clone - https://$OPENREVIEW_GITHUB@github.com/openreview/openreview-web.git - ~/openreview-web - - run: git clone - https://$OPENREVIEW_GITHUB@github.com/openreview/openreview-api.git - ~/openreview-v2 - - run: cd ~/openreview-v2 && git checkout << - pipeline.parameters.openreview-api-v2-branch >> - - run: mkdir ~/openreview/logs - - run: mkdir ~/openreview/files - - run: mkdir ~/openreview/files/attachments - - run: mkdir ~/openreview/files/pdfs - - run: mkdir ~/openreview/files/temp - - run: mkdir ~/openreview-v2/logs - - run: mkdir ~/openreview-v2/files - - run: mkdir ~/openreview-v2/files/attachments - - run: mkdir ~/openreview-v2/files/pdfs - - run: mkdir ~/openreview-v2/files/temp - - run: mkdir ~/openreview-py-repo/coverage + - run: + name: Install openreview-py + command: | + pip install ~/openreview-py-repo + - run: + name: Clone OpenReview API V1 branch << pipeline.parameters.openreview-api-v1-branch >> + command: | + git clone https://$OPENREVIEW_GITHUB@github.com/openreview/openreview-api-v1.git ~/openreview + cd ~/openreview && git checkout << pipeline.parameters.openreview-api-v1-branch >> + - run: + name: Clone OpenReview API V2 branch << pipeline.parameters.openreview-api-v2-branch >> + command: | + git clone https://$OPENREVIEW_GITHUB@github.com/openreview/openreview-api.git ~/openreview-v2 + cd ~/openreview-v2 && git checkout << pipeline.parameters.openreview-api-v2-branch >> + - run: + name: Clone openreview-web + command: | + git clone https://$OPENREVIEW_GITHUB@github.com/openreview/openreview-web.git ~/openreview-web + - run: + name: Create API directories + command: | + mkdir -p ~/openreview/logs + mkdir -p ~/openreview/files/attachments + mkdir -p ~/openreview/files/pdfs + mkdir -p ~/openreview/files/temp + mkdir -p ~/openreview-v2/logs + mkdir -p ~/openreview-v2/files/attachments + mkdir -p ~/openreview-v2/files/pdfs + mkdir -p ~/openreview-v2/files/temp + mkdir -p ~/openreview-py-repo/coverage - run: # source: https://support.mozilla.org/en-US/kb/install-firefox-linux#w_system-firefox-installation-for-advanced-users # source: https://ubuntu-mate.community/t/firefox-installation-guide-non-snap/25299 - name: install firefox + name: Install Firefox command: | wget "https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=en-US" -O firefox-latest.tar.bz2 tar xjf firefox-*.tar.bz2 @@ -76,33 +82,45 @@ jobs: echo export PATH="$PATH:/usr/local/bin/firefox" >> ~/.bashrc source ~/.bashrc - run: - name: run api + name: Start API V1 command: | cd ~/openreview npm run cleanStart background: true - run: - name: install web-app + name: Wait for API V1 to start + shell: /bin/sh + command: | + wget --retry-connrefused --waitretry=2 --read-timeout=20 --timeout=150 http://localhost:3000 + : + - run: + name: Start API V2 + command: | + cd ~/openreview-v2 + npm run cleanStart + background: true + - run: + name: Wait for API V2 to start + shell: /bin/sh + command: | + wget --retry-connrefused --waitretry=2 --read-timeout=20 --timeout=150 http://localhost:3001 + : + - run: + name: Install openreview-web command: | cd ~/openreview-web npm install cp .env.example .env.local NODE_ENV=production SUPER_USER=openreview.net npm run build - run: - name: run web-app + name: Start openreview-web command: | cd ~/openreview-web export NEXT_PORT=3030 NODE_ENV=production SUPER_USER=openreview.net npm run start background: true - run: - name: run api-v2 - command: | - cd ~/openreview-v2 - npm run cleanStart - background: true - - run: - name: install firefox driver + name: Install Firefox driver command: | sudo apt-get update sudo apt-get install firefox @@ -111,7 +129,7 @@ jobs: tar -xvzf geckodriver* chmod +x geckodriver - run: - name: run tests + name: Run tests command: | cd ~/openreview-py-repo pip install -U pytest @@ -125,8 +143,6 @@ jobs: path: test-reports - store_artifacts: path: test-reports - # The resource_class feature allows configuring CPU and RAM resources for each job. Different resource classes are available for different executors. https://circleci.com/docs/2.0/configuration-reference/#resourceclass - resource_class: large deploy: working_directory: ~/openreview-py-repo docker: