Skip to content

Instantly share code, notes, and snippets.

- name: Login to gcloud registry
id: gcloud
uses: elgohr/gcloud-login-action@0.2
with:
account_key: ${{ secrets.GCLOUD_KEY }}
steps:
- name: Checkout working branch
uses: actions/checkout@v1
- name: Set Docker Registry
run: echo ::set-env name=DOCKER_REGISTRY::eu.gcr.io
- name: Set Docker Image
run: echo ::set-env name=DOCKER_IMAGE::${{ env.DOCKER_REGISTRY }}/acme-555555/backend
docker-image:
name: Build & Publish Docker Image
needs: [tests]
runs-on: ubuntu-latest
- name: Install gettext for translations
run: |
sudo apt-get update && sudo apt-get install -y gettext
- name: Test with pytest
run: |
python manage.py compilemessages
pytest --verbose
env:
CLUSTER_ENV: test
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install dependencies, config poetry virtualenv
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config virtualenvs.create false
poetry install --no-interaction
- name: Cache Poetry
uses: actions/cache@v1
id: cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install PostgreSQL 11 client
run: |
sudo apt-get -yqq install libpq-dev
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
steps:
- name: Checkout working branch
uses: actions/checkout@v1
- name: Setup ssh
run: |
mkdir ~/.ssh/
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
touch ~/.ssh/known_hosts