|
| 1 | +name: Push checks |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - beta |
| 8 | + - "[0-9]+-dev" |
| 9 | + pull_request: |
| 10 | + |
| 11 | +jobs: |
| 12 | + lint: |
| 13 | + name: Lint |
| 14 | + runs-on: ubuntu-22.04 |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v2 |
| 17 | + - uses: actions/setup-node@v3 |
| 18 | + with: |
| 19 | + node-version: 16 |
| 20 | + - name: Install dependencies |
| 21 | + run: npm ci |
| 22 | + - name: Run lint |
| 23 | + run: npm run lint |
| 24 | + |
| 25 | + check-types: |
| 26 | + name: Check types |
| 27 | + runs-on: ubuntu-22.04 |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v2 |
| 30 | + - uses: actions/setup-node@v3 |
| 31 | + with: |
| 32 | + node-version: 16 |
| 33 | + - name: Install dependencies |
| 34 | + run: npm ci |
| 35 | + - name: Run types tests |
| 36 | + run: npm run test:types |
| 37 | + |
| 38 | + functional-tests: |
| 39 | + name: Functional Tests |
| 40 | + runs-on: ubuntu-22.04 |
| 41 | + needs: [lint, check-types] |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v2 |
| 44 | + - uses: actions/setup-node@v3 |
| 45 | + with: |
| 46 | + node-version: 16 |
| 47 | + - name: docker pull |
| 48 | + run: docker compose --profile backend pull |
| 49 | + - name: docker install dependencies |
| 50 | + run: docker compose run --no-deps kuzzle /bin/bash -c "npm ci" |
| 51 | + - name: docker backend |
| 52 | + run: | |
| 53 | + # Continue when error |
| 54 | + set +e |
| 55 | + export BACKEND_COMMAND="npm run build && npm run prod"; |
| 56 | + docker compose --profile backend up -d --wait |
| 57 | + exitcode="$?" |
| 58 | + [[ "$exitcode" == "0" ]] || docker compose logs kuzzle |
| 59 | + exit "$exitcode" |
| 60 | + - name: Install dependencies |
| 61 | + run: npm ci |
| 62 | + - name: Run tests |
| 63 | + run: npm run test:functional |
| 64 | + |
| 65 | + release-device-manager: |
| 66 | + name: Release package |
| 67 | + runs-on: ubuntu-22.04 |
| 68 | + if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/2-dev') }} |
| 69 | + needs: [functional-tests] |
| 70 | + permissions: |
| 71 | + contents: write |
| 72 | + issues: write |
| 73 | + pull-requests: write |
| 74 | + steps: |
| 75 | + - name: Checkout |
| 76 | + uses: actions/checkout@v3 |
| 77 | + |
| 78 | + - name: Setup Node.js |
| 79 | + uses: actions/setup-node@v3 |
| 80 | + with: |
| 81 | + node-version: "lts/*" |
| 82 | + registry-url: "https://registry.npmjs.org" |
| 83 | + |
| 84 | + - name: Install dependencies |
| 85 | + run: npm ci |
| 86 | + |
| 87 | + - name: Build |
| 88 | + run: npm run build |
| 89 | + |
| 90 | + - name: Release |
| 91 | + env: |
| 92 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 93 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 94 | + SEMANTIC_RELEASE_NPM_PUBLISH: "true" |
| 95 | + SEMANTIC_RELEASE_SLACK_WEBHOOK: ${{ secrets.SEMANTIC_RELEASE_SLACK_WEBHOOK }} |
| 96 | + run: npx semantic-release |
| 97 | + |
| 98 | + release-types: |
| 99 | + name: Release type package |
| 100 | + runs-on: ubuntu-22.04 |
| 101 | + if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/2-dev') }} |
| 102 | + needs: [release-device-manager] |
| 103 | + permissions: |
| 104 | + contents: write |
| 105 | + issues: write |
| 106 | + pull-requests: write |
| 107 | + steps: |
| 108 | + - name: Checkout |
| 109 | + uses: actions/checkout@v3 |
| 110 | + |
| 111 | + - name: Setup Node.js |
| 112 | + uses: actions/setup-node@v3 |
| 113 | + with: |
| 114 | + node-version: "lts/*" |
| 115 | + registry-url: "https://registry.npmjs.org" |
| 116 | + |
| 117 | + - name: Install dependencies |
| 118 | + run: npm ci |
| 119 | + |
| 120 | + - name: Build type package |
| 121 | + run: npm -prefix ./types run build |
| 122 | + |
| 123 | + - name: Publish package |
| 124 | + env: |
| 125 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 126 | + run: cd types && npm publish |
| 127 | + |
| 128 | + documentation_deploy: |
| 129 | + needs: [release-device-manager] |
| 130 | + name: Documentation - Deploy |
| 131 | + runs-on: ubuntu-22.04 |
| 132 | + steps: |
| 133 | + - uses: actions/checkout@v3 |
| 134 | + with: |
| 135 | + token: ${{ secrets.ACCESS_TOKEN_CI }} |
| 136 | + |
| 137 | + - name: Extract references from context |
| 138 | + shell: bash |
| 139 | + id: extract-refs |
| 140 | + run: | |
| 141 | + version=$(jq -r .version package.json | cut -d. -f 1) |
| 142 | + echo "major-version=$(($version == 0 ? 1 : $version))" >> $GITHUB_OUTPUT |
| 143 | + echo "repo=$(echo $GITHUB_REPOSITORY | cut -d/ -f 2)" >> $GITHUB_OUTPUT |
| 144 | +
|
| 145 | + - uses: convictional/trigger-workflow-and-wait@v1.6.3 |
| 146 | + with: |
| 147 | + owner: kuzzleio |
| 148 | + repo: documentation |
| 149 | + github_token: ${{ secrets.ACCESS_TOKEN_CI }} |
| 150 | + workflow_file_name: child_repo.workflow.yml |
| 151 | + ref: ${{ github.ref_name == 'master' && 'master' || 'develop' }} |
| 152 | + client_payload: '{"repo_name":"${{ steps.extract-refs.outputs.repo }}","branch":"${{ github.ref_name }}","version":"${{ steps.extract-refs.outputs.major-version }}"}' |
0 commit comments