From dbade5f44d23efa73f68e2688197561313ad7f23 Mon Sep 17 00:00:00 2001 From: Julian Dehm Date: Tue, 29 Jun 2021 11:34:18 +0200 Subject: [PATCH] add github actions replacement for travis --- .github/workflows/django.yml | 68 ++++++++++++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/django.yml diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml new file mode 100644 index 000000000..970e909f0 --- /dev/null +++ b/.github/workflows/django.yml @@ -0,0 +1,68 @@ +name: Django CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: '3.6' + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: '12.x' + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Cache pip packages + uses: actions/cache@v2 + env: + cache-name: cache-pip-packages + with: + path: ~/.cache/pip + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/requirements/dev.txt') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Install Dependencies + run: | + npm install + npm run build + pip install -r requirements/dev.txt + pip install coveralls + - name: Run Tests + run: | + python manage.py collectstatic > /dev/null + py.test --cov + isort --diff -c civic_europe tests + python manage.py makemigrations --dry-run --check --noinput + flake8 civic_europe tests --exclude migrations,settings + npm run lint + - name: Coveralls + env: + GITHUB_TOKEN: ${{ secrets.COV }} + run: | + coveralls + - name: Deploy + if: github.ref == 'refs/heads/main' + env: + TRAVIS_SSH_SECRET: ${{ secrets.DEPLOY }} + run: | + ./scripts/deploy.sh diff --git a/README.md b/README.md index 7d4413e4c..6190977aa 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Civic Europe is a platform for an idea challenge. It is based on [adhocracy 4](https://github.com/liqd/adhocracy4). -[![Build Status](https://travis-ci.org/liqd/a4-civic-europe.svg?branch=master)](https://travis-ci.org/liqd/a4-civic-europe) +![Build Status](https://github.com/liqd/a4-civic-europe/actions/workflows/django.yml/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/liqd/a4-civic-europe/badge.svg?branch=master)](https://coveralls.io/github/liqd/a4-civic-europe?branch=master) ## Requirements