aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/ci.yml
blob: 947238adb0acd57ed20c9e33d520f3fa0accf008 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: CI

on:
  push:
  pull_request:
  workflow_dispatch:

jobs:
  test:
    strategy:
      matrix:
        python-version: [3.6, 3.7, 3.8, 3.9, 3.x]
    runs-on: ubuntu-latest
    name: 'Python ${{ matrix.python-version }}'
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: '${{ matrix.python-version }}'
      - name: Run tests
        run: make test

  deploy:
    needs: [test]
    runs-on: ubuntu-latest
    name: Deploy
    if: github.ref == 'refs/heads/master'
    env:
      DOCKER_HOST: 'tcp://${{ secrets.DEPLOY_DOCKER_HOST }}:${{ secrets.DEPLOY_DOCKER_PORT }}'
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Set up VPN
        uses: egor-tensin/setup-wireguard@v1
        with:
          endpoint: '${{ secrets.WG_ENDPOINT }}'
          endpoint_public_key: '${{ secrets.WG_ENDPOINT_PUBLIC_KEY }}'
          ips: '${{ secrets.WG_IPS }}'
          allowed_ips: '${{ secrets.WG_ALLOWED_IPS }}'
          private_key: '${{ secrets.WG_PRIVATE_KEY }}'
          preshared_key: '${{ secrets.WG_PRESHARED_KEY }}'
      - name: Deploy
        run: make deploy