diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index 95ad5aa7..be99e737 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -270,14 +270,109 @@ jobs: env: COVERALLS: ${{ secrets.COVERALLS }} - - test-postman: - needs: [frontend, build] + test-postman-sqlite: + needs: frontend runs-on: ubuntu-latest - strategy: - matrix: - platform: [postman_env_sqlite.json] -# platform: [postman_env_sqlite.json, postman_env_postgres.json, postman_env_mysql.json] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: 1.15.x + + - name: Setting ENV's + run: | + echo "::add-path::$(go env GOPATH)/bin" + echo "::add-path::/opt/hostedtoolcache/node/12.18.2/x64/bin" + echo ::set-env name=VERSION::$(cat version.txt) + shell: bash + + - name: Download Compiled Frontend (rice-box.go) + uses: actions/download-artifact@v1 + with: + name: static-rice-box + path: ./source + + - name: Install Statping + env: + VERSION: ${{ env.VERSION }} + COMMIT: ${{ github.sha }} + run: | + make build + chmod +x statping + mv statping $(go env GOPATH)/bin/ + - name: Run Statping + run: | + API_SECRET=demosecret123 statping --port=8585 > /dev/null & + sleep 5 + - name: Postman SQLite Tests + uses: matt-ball/newman-action@master + with: + apiKey: ${{ secrets.POSTMAN_API }} + collection: ./dev/postman.json + environment: ./dev/postman_env_sqlite.json + timeoutRequest: 30000 + delayRequest: 600 + + test-postman-mysql: + needs: frontend + runs-on: ubuntu-latest + + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: password123 + MYSQL_DATABASE: statping + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: 1.15.x + + - name: Setting ENV's + run: | + echo "::add-path::$(go env GOPATH)/bin" + echo "::add-path::/opt/hostedtoolcache/node/12.18.2/x64/bin" + echo ::set-env name=VERSION::$(cat version.txt) + shell: bash + + - name: Download Compiled Frontend (rice-box.go) + uses: actions/download-artifact@v1 + with: + name: static-rice-box + path: ./source + + - name: Install Statping + env: + VERSION: ${{ env.VERSION }} + COMMIT: ${{ github.sha }} + MJML_APP: ${{ secrets.MJML_APP }} + MJML_PRIVATE: ${{ secrets.MJML_PRIVATE }} + run: | + make build + chmod +x statping + mv statping $(go env GOPATH)/bin/ + - name: Run Statping + run: | + API_SECRET=demosecret123 statping --port=8585 > /dev/null & + sleep 5 + - name: Postman MySQL Tests + uses: matt-ball/newman-action@master + with: + apiKey: ${{ secrets.POSTMAN_API }} + collection: ./dev/postman.json + environment: ./dev/postman_env_mysql.json + timeoutRequest: 30000 + delayRequest: 600 + + test-postman-postgres: + needs: frontend + runs-on: ubuntu-latest + services: postgres: image: postgres:10.8 @@ -288,47 +383,49 @@ jobs: ports: - 5432:5432 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - mysql: - image: mysql:5.7 - env: - MYSQL_ROOT_PASSWORD: password123 - MYSQL_DATABASE: statping - ports: - - 3306:3306 - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: 1.15.x - - name: Download Statping + - name: Setting ENV's + run: | + echo "::add-path::$(go env GOPATH)/bin" + echo "::add-path::/opt/hostedtoolcache/node/12.18.2/x64/bin" + echo ::set-env name=VERSION::$(cat version.txt) + shell: bash + + - name: Download Compiled Frontend (rice-box.go) uses: actions/download-artifact@v1 with: - name: statping-linux-amd64 - path: ./build + name: static-rice-box + path: ./source - name: Install Statping + env: + VERSION: ${{ env.VERSION }} + COMMIT: ${{ github.sha }} run: | - cd build && tar -xvf statping-linux-amd64.tar.gz - mv statping ../ - - - name: Get Statping Version - run: ./statping version - + make build + chmod +x statping + mv statping $(go env GOPATH)/bin/ - name: Run Statping run: | - API_SECRET=demosecret123 ./statping --ip=0.0.0.0 --port=8585 > /dev/null & - sleep 15 - - - name: Postman Tests + API_SECRET=demosecret123 statping --port=8585 > /dev/null & + sleep 5 + - name: Postman Postgres Tests uses: matt-ball/newman-action@master with: apiKey: ${{ secrets.POSTMAN_API }} collection: ./dev/postman.json - environment: ./dev/${{ matrix.platform }} - timeoutRequest: 60000 + environment: ./dev/postman_env_postgres.json + timeoutRequest: 30000 delayRequest: 600 sentry-release: - needs: [test, test-postman] + needs: [test, test-postman-sqlite, test-postman-postgres, test-postman-mysql] runs-on: ubuntu-latest steps: - name: Checkout Statping Repo diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 83c42ab1..ebbc7b48 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -254,64 +254,8 @@ jobs: env: COVERALLS: ${{ secrets.COVERALLS }} - - test-postman: - needs: [frontend, build] - runs-on: ubuntu-latest - strategy: - matrix: - platform: [postman_env_sqlite.json, postman_env_postgres.json, postman_env_mysql.json] - services: - postgres: - image: postgres:10.8 - env: - POSTGRES_USER: root - POSTGRES_PASSWORD: password123 - POSTGRES_DB: statping - ports: - - 5432:5432 - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - mysql: - image: mysql:5.7 - env: - MYSQL_ROOT_PASSWORD: password123 - MYSQL_DATABASE: statping - ports: - - 3306:3306 - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 - steps: - - uses: actions/checkout@v2 - - - name: Download Statping - uses: actions/download-artifact@v1 - with: - name: statping-linux-amd64 - path: ./build - - - name: Install Statping - env: - VERSION: ${{ env.VERSION }} - COMMIT: ${{ github.sha }} - run: | - cd build && tar -xvf statping-linux-amd64.tar.gz - mv statping ../ - - - name: Run Statping - run: | - API_SECRET=demosecret123 ./statping --ip=0.0.0.0 --port=8585 > /dev/null & - sleep 15 - - - name: Postman Tests - uses: matt-ball/newman-action@master - with: - apiKey: ${{ secrets.POSTMAN_API }} - collection: ./dev/postman.json - environment: ./dev/${{ matrix.platform }} - timeoutRequest: 30000 - delayRequest: 600 - release: - needs: [build, test, test-postman] + needs: [build, test] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 319a230b..239851c8 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -6,6 +6,13 @@ on: - '*/*' # matches every branch containing a single '/' - '!master' # excludes master - '!dev' # excludes dev + pull_request: + branches: + - '*' # matches every branch + - '*/*' # matches every branch containing a single '/' + - '!master' # excludes master + - '!dev' # excludes dev + jobs: compile: