aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/wee-slack.yml
blob: f4db2566bef3f4fddb575a3fdb965e55225b335f (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: wee-slack
on: [push, pull_request]

jobs:
  lint:
    if: >
      github.event_name == 'push' || (
        github.event_name == 'pull_request' &&
        github.event.pull_request.head.repo.full_name != github.repository
      )
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python_version: [2.7, 3.7]
    steps:
    - uses: actions/checkout@v2

    - name: Set up Python (${{ matrix.python_version }})
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python_version }}

    - uses: actions/cache@v2
      env:
        cache-name: lint-pip
      with:
        path: ${{ env.pythonLocation }}
        key: ${{ runner.os }}-${{ matrix.python_version }}-${{ env.cache-name }}-${{ github.sha }}
        restore-keys: |
          ${{ runner.os }}-${{ matrix.python_version }}-${{ env.cache-name }}-

    - name: Install Pipenv
      run: |
        pip install --upgrade pipenv

    - uses: actions/cache@v2
      env:
        cache-name: lint-pipenv
      with:
        path: "$GITHUB_WORKSPACE/.venv"
        key: ${{ runner.os }}-${{ matrix.python_version }}-${{ env.cache-name }}-${{ github.sha }}
        restore-keys: |
          ${{ runner.os }}-${{ matrix.python_version }}-${{ env.cache-name }}-

    - name: Install dependencies
      run: |
        pipenv install --dev --skip-lock

    - name: Lint with Flake8
      run: |
        # stop the build if there are Python syntax errors or undefined names
        pipenv run flake8 .

        # exit-zero treats all errors as warnings.
        pipenv run flake8 . --exit-zero --select=C,E,F,W

  test:
    if: >
      github.event_name == 'push' || (
        github.event_name == 'pull_request' &&
        github.event.pull_request.head.repo.full_name != github.repository
      )
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python_version: [2.7, 3.7]
    steps:
    - uses: actions/checkout@v2

    - name: Set up Python (${{ matrix.python_version }})
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python_version }}

    - uses: actions/cache@v2
      env:
        cache-name: test-pip
      with:
        path: ${{ env.pythonLocation }}
        key: ${{ runner.os }}-${{ matrix.python_version }}-${{ env.cache-name }}-${{ github.sha }}
        restore-keys: |
          ${{ runner.os }}-${{ matrix.python_version }}-${{ env.cache-name }}-

    - name: Install Pipenv
      run: |
        pip install --upgrade pipenv

    - uses: actions/cache@v2
      env:
        cache-name: test-pipenv
      with:
        path: "$GITHUB_WORKSPACE/.venv"
        key: ${{ runner.os }}-${{ matrix.python_version }}-${{ env.cache-name }}-${{ github.sha }}
        restore-keys: |
          ${{ runner.os }}-${{ matrix.python_version }}-${{ env.cache-name }}-

    - name: Install dependencies
      run: |
        pipenv install --dev --skip-lock

    - name: python/test
      run: |
        pipenv run pytest