name: CI - Linux

on:
  pull_request:
    branches:
      - master
jobs:
  build:
    name: Test on node ${{ matrix.node_version }} and ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      max-parallel: 1
      matrix:
        node_version: [12.x, 14.x, 16.x]
        os: [ubuntu-latest]
    steps:
      - uses: actions/checkout@v1
        with:
            fetch-depth: 0
            ref: ''
      - name: Use Node.js ${{ matrix.node_version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node_version }}
      - name: Start Server -> Run Unit and Functional Tests ( install, lint, browserify, test)
        env:
          CI: true
          MINIO_CI_CD: true
          MINT_MODE: full
          SERVER_ENDPOINT: localhost:9000
          MINIO_ROOT_USER: minio
          MINIO_ROOT_PASSWORD: minio123
          MINIO_KMS_SECRET_KEY: "my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw="
          ACCESS_KEY: minio
          SECRET_KEY: minio123
          ENABLE_HTTPS: 0
        run: |
          wget --quiet -O /tmp/minio https://dl.min.io/server/minio/release/linux-amd64/minio
          chmod +x /tmp/minio
          /tmp/minio -C /tmp/minio-config server /tmp/data{1...4} &
          npm install
          npm run lint
          npm run browserify
          npm run test

