From 5b2fe019652c099e5cfc62747b7415aa8d4427b0 Mon Sep 17 00:00:00 2001 From: Sean Date: Wed, 18 Nov 2020 15:04:17 +0100 Subject: [PATCH] Replace travis with github actions Remove travis, add github actions --- .github/workflows/run-tests.yml | 134 ++++++++++++++++++++++++++++++ .travis.yml | 140 -------------------------------- 2 files changed, 134 insertions(+), 140 deletions(-) create mode 100644 .github/workflows/run-tests.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 000000000..cbe945e30 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,134 @@ +name: CI + +on: + pull_request: + branches: [master] + +jobs: + test-server: + runs-on: ubuntu-latest + env: + USING_COVERAGE: "3.6,3.8" + strategy: + matrix: + python-version: ["3.6", "3.7", "3.8"] + defaults: + run: + working-directory: ./server + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: "${{ matrix.python-version }}" + + - name: install python dependencies + run: | + pip install --upgrade pip + pip install --upgrade --requirement requirements.txt + pip freeze + + - name: lint with flake8 + run: flake8 openslides tests + + - name: lint with isort + run: isort --check-only --diff --recursive openslides tests + + - name: lint with black + run: black --check --diff openslides tests + + - name: test using mypy + run: mypy openslides/ tests/ + + - name: test using pytest + run: pytest --cov --cov-fail-under=75 + + install-client-dependencies: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./client + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + id: node-module-cache + with: + path: | + **/node_modules + key: node_modules-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + node_modules- + - uses: actions/setup-node@v2-beta + with: + node-version: "12" + + - name: install client dependencies + if: steps.node-module-cache.outputs.cache-hit != 'true' + run: npm ci + + check-client-code: + needs: install-client-dependencies + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./client + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + **/node_modules + key: node_modules-${{ hashFiles('**/package-lock.json') }} + + - name: check code using linter + run: npm run lint-check + + - name: check code using prettify + run: npm run prettify-check + + test-client: + needs: install-client-dependencies + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./client + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + **/node_modules + key: node_modules-${{ hashFiles('**/package-lock.json') }} + - name: test client + run: npm run test-silently + + build-client-debug: + needs: install-client-dependencies + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./client + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + **/node_modules + key: node_modules-${{ hashFiles('**/package-lock.json') }} + - name: build client debug + run: npm run build-debug + + build-client-prod: + needs: install-client-dependencies + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./client + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + **/node_modules + key: node_modules-${{ hashFiles('**/package-lock.json') }} + - name: build client prod + run: npm run build diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a71818155..000000000 --- a/.travis.yml +++ /dev/null @@ -1,140 +0,0 @@ -dist: xenial -os: linux - -cache: - - directories: - - $HOME/.cache/pip - - client/node_modules - -jobs: - include: - - stage: "Dependencies" - name: "Installing dependencies for python" - language: python - python: - - "3.6" - cache: - pip: true - before_install: - - python --version - - cd server - install: - - pip install --upgrade pip - - pip install --upgrade --requirement requirements.txt - - pip freeze - script: skip - - - name: "Installing npm dependencies" - language: node_js - node_js: "12.18" - cache: - - directories: - - "client/node_modules" - before_install: - - npm install -g @angular/cli@~8.0.6 - - ng --version - - cd client - install: - - npm install - script: skip - - - stage: "Run tests" - name: "Client: Testing" - language: node_js - node_js: "12.18" - services: - - xvfb - install: - - cd client - - export CHROME_BIN=/usr/bin/google-chrome - - export DISPLAY=:99.0 - script: - - npm run test-silently - - - name: "Client: Production Build (ES5)" - language: node_js - node_js: "12.18" - install: - - cd client - - sed -i '/\"target\"/c\\"target\":\"es5\",' tsconfig.json - script: - - npm run build - - - name: "Client: Production Build (ES2015)" - language: node_js - node_js: "12.18" - install: - - cd client - - echo "Firefox ESR" > browserslist - script: - - npm run build - - - name: "Client: Build" - language: node_js - node_js: "12.18" - script: - - cd client - - npm run build-debug - - - name: "Client: Linting" - language: node_js - node_js: "12.18" - script: - - cd client - - npm run lint-check - - - name: "Client: Code Formatting Check" - language: node_js - node_js: "12.18" - script: - - cd client - - npm run prettify-check - - - name: "Server: Tests Python 3.6" - language: python - python: - - "3.6" - before_install: - - cd server - script: - - mypy openslides/ tests/ - - pytest --cov --cov-fail-under=75 - - - name: "Server: Tests Python 3.7" - language: python - python: - - "3.7" - before_install: - - cd server - script: - - flake8 openslides tests - - isort --check-only --diff --recursive openslides tests - - black --check --diff openslides tests - - mypy openslides/ tests/ - - pytest --cov --cov-fail-under=75 - - - name: "Server: Tests Python 3.8" - language: python - python: - - "3.8" - before_install: - - cd server - script: - - flake8 openslides tests - - isort --check-only --diff --recursive openslides tests - - black --check --diff openslides tests - - mypy openslides/ tests/ - - pytest --cov --cov-fail-under=75 - - - name: "Server: Tests Startup Routine Python 3.7" - language: python - python: - - "3.7" - before_install: - - cd server - script: - - set -e - - python manage.py createsettings - - python manage.py migrate - - python manage.py runserver --noreload & (sleep 20 && kill $(ps aux | grep 'manage.py runserver' | head -n -1 | awk '{print $2}')) - - set +e