|
| 1 | +# master only |
| 2 | + |
| 3 | +name: Integrate |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: [master] |
| 8 | + |
| 9 | +env: |
| 10 | + FORCE_COLOR: 1 |
| 11 | + |
| 12 | +jobs: |
| 13 | + windowsNode14: |
| 14 | + name: '[Windows] Node.js v14: Unit tests' |
| 15 | + runs-on: windows-latest |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + python-version: [2.7, 3.6] |
| 19 | + steps: |
| 20 | + - name: Checkout repository |
| 21 | + uses: actions/checkout@v2 |
| 22 | + |
| 23 | + - name: Retrieve dependencies from cache |
| 24 | + id: cacheNpm |
| 25 | + uses: actions/cache@v2 |
| 26 | + with: |
| 27 | + path: | |
| 28 | + ~/.npm |
| 29 | + node_modules |
| 30 | + key: npm-v14-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }} |
| 31 | + restore-keys: npm-v14-${{ runner.os }}-${{ github.ref }}- |
| 32 | + |
| 33 | + - name: Set up Python ${{ matrix.python-version }} |
| 34 | + uses: actions/setup-python@v1 |
| 35 | + with: |
| 36 | + python-version: ${{ matrix.python-version }} |
| 37 | + |
| 38 | + - name: Install Node.js and npm |
| 39 | + uses: actions/setup-node@v1 |
| 40 | + with: |
| 41 | + node-version: 14.x |
| 42 | + |
| 43 | + - name: Check python version |
| 44 | + run: | |
| 45 | + python --version |
| 46 | +
|
| 47 | + - name: Install setuptools |
| 48 | + run: python -m pip install --force setuptools wheel |
| 49 | + |
| 50 | + - name: Install pipenv / poetry |
| 51 | + run: python -m pip install pipenv poetry |
| 52 | + |
| 53 | + - name: Install serverless |
| 54 | + run: npm install -g serverless@2 |
| 55 | + |
| 56 | + - name: Install dependencies |
| 57 | + if: steps.cacheNpm.outputs.cache-hit != 'true' |
| 58 | + run: | |
| 59 | + npm update --no-save |
| 60 | + npm update --save-dev --no-save |
| 61 | + - name: Unit tests |
| 62 | + run: npm test |
| 63 | + |
| 64 | + linuxNode14: |
| 65 | + name: '[Linux] Node.js 14: Unit tests' |
| 66 | + runs-on: ubuntu-latest |
| 67 | + strategy: |
| 68 | + matrix: |
| 69 | + python-version: [2.7, 3.6] |
| 70 | + steps: |
| 71 | + - name: Checkout repository |
| 72 | + uses: actions/checkout@v2 |
| 73 | + |
| 74 | + - name: Retrieve dependencies from cache |
| 75 | + id: cacheNpm |
| 76 | + uses: actions/cache@v2 |
| 77 | + with: |
| 78 | + path: | |
| 79 | + ~/.npm |
| 80 | + node_modules |
| 81 | + key: npm-v14-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }} |
| 82 | + restore-keys: npm-v14-${{ runner.os }}-${{ github.ref }}- |
| 83 | + |
| 84 | + - name: Set up Python ${{ matrix.python-version }} |
| 85 | + uses: actions/setup-python@v1 |
| 86 | + with: |
| 87 | + python-version: ${{ matrix.python-version }} |
| 88 | + |
| 89 | + - name: Install Node.js and npm |
| 90 | + uses: actions/setup-node@v1 |
| 91 | + with: |
| 92 | + node-version: 14.x |
| 93 | + |
| 94 | + - name: Check python version |
| 95 | + run: | |
| 96 | + python --version |
| 97 | +
|
| 98 | + - name: Install setuptools |
| 99 | + run: python -m pip install --force setuptools wheel |
| 100 | + |
| 101 | + - name: Install pipenv / poetry |
| 102 | + run: python -m pip install pipenv poetry |
| 103 | + |
| 104 | + - name: Install serverless |
| 105 | + run: npm install -g serverless@2 |
| 106 | + |
| 107 | + - name: Install dependencies |
| 108 | + if: steps.cacheNpm.outputs.cache-hit != 'true' |
| 109 | + run: | |
| 110 | + npm update --no-save |
| 111 | + npm update --save-dev --no-save |
| 112 | + - name: Unit tests |
| 113 | + run: npm test |
| 114 | + |
| 115 | + linuxNode12: |
| 116 | + name: '[Linux] Node.js v12: Unit tests' |
| 117 | + runs-on: ubuntu-latest |
| 118 | + strategy: |
| 119 | + matrix: |
| 120 | + python-version: [2.7, 3.6] |
| 121 | + steps: |
| 122 | + - name: Checkout repository |
| 123 | + uses: actions/checkout@v2 |
| 124 | + |
| 125 | + - name: Retrieve dependencies from cache |
| 126 | + id: cacheNpm |
| 127 | + uses: actions/cache@v2 |
| 128 | + with: |
| 129 | + path: | |
| 130 | + ~/.npm |
| 131 | + node_modules |
| 132 | + key: npm-v12-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }} |
| 133 | + restore-keys: npm-v12-${{ runner.os }}-${{ github.ref }}- |
| 134 | + |
| 135 | + - name: Set up Python ${{ matrix.python-version }} |
| 136 | + uses: actions/setup-python@v1 |
| 137 | + with: |
| 138 | + python-version: ${{ matrix.python-version }} |
| 139 | + |
| 140 | + - name: Install Node.js and npm |
| 141 | + uses: actions/setup-node@v1 |
| 142 | + with: |
| 143 | + node-version: 12.x |
| 144 | + |
| 145 | + - name: Check python version |
| 146 | + run: | |
| 147 | + python --version |
| 148 | +
|
| 149 | + - name: Install setuptools |
| 150 | + run: python -m pip install --force setuptools wheel |
| 151 | + |
| 152 | + - name: Install pipenv / poetry |
| 153 | + run: python -m pip install pipenv poetry |
| 154 | + |
| 155 | + - name: Install serverless |
| 156 | + run: npm install -g serverless@2 |
| 157 | + |
| 158 | + - name: Install dependencies |
| 159 | + if: steps.cacheNpm.outputs.cache-hit != 'true' |
| 160 | + run: | |
| 161 | + npm update --no-save |
| 162 | + npm update --save-dev --no-save |
| 163 | + - name: Unit tests |
| 164 | + run: npm test |
| 165 | + |
| 166 | + tagIfNewVersion: |
| 167 | + name: Tag if new version |
| 168 | + runs-on: ubuntu-latest |
| 169 | + needs: [windowsNode14, linuxNode14, linuxNode12] |
| 170 | + steps: |
| 171 | + - name: Checkout repository |
| 172 | + uses: actions/checkout@v2 |
| 173 | + with: |
| 174 | + # Ensure to have complete history of commits pushed with given push operation |
| 175 | + # It's loose and imperfect assumption that no more than 30 commits will be pushed at once |
| 176 | + fetch-depth: 30 |
| 177 | + # Tag needs to be pushed with real user token, otherwise pushed tag won't trigger the actions workflow |
| 178 | + # Hence we're passing 'serverless-ci' user authentication token |
| 179 | + token: ${{ secrets.USER_GITHUB_TOKEN }} |
| 180 | + |
| 181 | + - name: Tag if new version |
| 182 | + run: | |
| 183 | + NEW_VERSION=`git diff -U0 ${{ github.event.before }} package.json | grep '"version": "' | tail -n 1 | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"` || : |
| 184 | + if [ -n "$NEW_VERSION" ]; |
| 185 | + then |
| 186 | + git tag v$NEW_VERSION |
| 187 | + git push --tags |
| 188 | + fi |
0 commit comments