|
| 1 | +# This is a basic workflow to help you get started with Actions |
| 2 | + |
| 3 | +name: CI |
| 4 | + |
| 5 | +# Controls when the workflow will run |
| 6 | +on: |
| 7 | + # Triggers the workflow on push or pull request events but only for the master branch |
| 8 | + push: |
| 9 | + branches: [ master, next, feature/new-ui ] |
| 10 | + pull_request: |
| 11 | + branches: [ master, next, feature/new-ui ] |
| 12 | + |
| 13 | + # Allows you to run this workflow manually from the Actions tab |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 17 | +jobs: |
| 18 | + # This workflow contains a single job called "build" |
| 19 | + build: |
| 20 | + # The type of runner that the job will run on |
| 21 | + runs-on: ubuntu-latest |
| 22 | + |
| 23 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 24 | + steps: |
| 25 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 26 | + - uses: actions/checkout@v2 |
| 27 | + |
| 28 | + - name: Installing Countly |
| 29 | + shell: bash |
| 30 | + run: sudo bash ./bin/countly.install.sh |
| 31 | + |
| 32 | + - name: NodeJS version |
| 33 | + shell: bash |
| 34 | + run: nodejs --version |
| 35 | + |
| 36 | + - name: NPM version |
| 37 | + shell: bash |
| 38 | + run: npm --version |
| 39 | + |
| 40 | + - name: Mongo version |
| 41 | + shell: bash |
| 42 | + run: mongo --version |
| 43 | + |
| 44 | + - name: Enable all plugins |
| 45 | + shell: bash |
| 46 | + run: sudo bash ./bin/scripts/countly.enable.all.plugins.sh |
| 47 | + |
| 48 | + - name: Reinstall plugins |
| 49 | + shell: bash |
| 50 | + run: sudo bash ./bin/scripts/countly.install.plugins.sh |
| 51 | + |
| 52 | + - name: ShellCheck |
| 53 | + shell: bash |
| 54 | + run: countly shellcheck |
| 55 | + |
| 56 | + - name: ESLint |
| 57 | + shell: bash |
| 58 | + run: npx eslint . |
| 59 | + |
| 60 | + - name: DistFiles |
| 61 | + shell: bash |
| 62 | + run: sudo countly task dist-all |
| 63 | + |
| 64 | + - name: Tests |
| 65 | + shell: bash |
| 66 | + run: sudo countly test |
| 67 | + |
| 68 | + - name: Output API Logs |
| 69 | + if: ${{ always() }} |
| 70 | + run: cat log/countly-api.log |
| 71 | + |
| 72 | + - name: Output Dashboard Logs |
| 73 | + if: ${{ always() }} |
| 74 | + run: cat log/countly-dashboard.log |
| 75 | + |
| 76 | + - name: Output MongoDB Logs |
| 77 | + if: ${{ always() }} |
| 78 | + run: sudo cat /var/log/mongodb/mongod.log |
| 79 | + |
| 80 | + - name: Send slack notification |
| 81 | + id: slack |
| 82 | + if: always() |
| 83 | + |
| 84 | + with: |
| 85 | + payload: "{\"url\":\"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\",\"status\":\"${{ job.status }}\"}" |
| 86 | + env: |
| 87 | + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 88 | + |
| 89 | + deploy: |
| 90 | + runs-on: ubuntu-latest |
| 91 | + needs: build |
| 92 | + |
| 93 | + steps: |
| 94 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 95 | + - uses: actions/checkout@v2 |
| 96 | + |
| 97 | + - name: Enable command line |
| 98 | + shell: bash |
| 99 | + run: sudo bash ./bin/scripts/detect.init.sh |
| 100 | + |
| 101 | + - name: Installing dependencies |
| 102 | + shell: bash |
| 103 | + run: npm install |
| 104 | + |
| 105 | + - name: Deploy server |
| 106 | + shell: bash |
| 107 | + env: |
| 108 | + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} |
| 109 | + run: bash ./bin/scripts/deploy.sh |
| 110 | + |
| 111 | + - name: Deploy documentation |
| 112 | + shell: bash |
| 113 | + env: |
| 114 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 115 | + run: bash ./bin/scripts/generateDocs.sh |
0 commit comments