setup ci #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI Tests | |
| on: | |
| push: | |
| branches: [ main, development/*, improvement/* ] | |
| pull_request: | |
| branches: [ main, development/* ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| mongodb: | |
| image: mongo:6.0 | |
| ports: | |
| - 27017:27017 | |
| options: >- | |
| --health-cmd "mongosh --eval 'db.adminCommand({ping: 1})'" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Checkout cloudserverclient | |
| uses: actions/checkout@v4 | |
| with: | |
| path: cloudserverclient | |
| - name: Checkout cloudserver | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: scality/cloudserver | |
| path: cloudserver | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'yarn' | |
| cache-dependency-path: | | |
| cloudserverclient/yarn.lock | |
| cloudserver/yarn.lock | |
| - name: Install cloudserver dependencies | |
| working-directory: cloudserver | |
| run: yarn install --frozen-lockfile | |
| - name: Start cloudserver in background | |
| working-directory: cloudserver | |
| run: | | |
| S3VAULT=mem S3METADATA=mongodb S3DATA=mem REMOTE_MANAGEMENT_DISABLE=true yarn start & | |
| echo $! > cloudserver.pid | |
| env: | |
| CI: true | |
| - name: Wait for cloudserver to be ready | |
| run: | | |
| echo "Waiting for cloudserver to start..." | |
| timeout 60 bash -c 'until curl -f http://localhost:8000 2>/dev/null; do sleep 2; done' | |
| echo "Cloudserver is ready!" | |
| - name: Install cloudserverclient dependencies | |
| working-directory: cloudserverclient | |
| run: yarn install --frozen-lockfile | |
| - name: Build cloudserverclient | |
| working-directory: cloudserverclient | |
| run: yarn build | |
| - name: Install test dependencies | |
| working-directory: cloudserverclient/tests | |
| run: yarn install --frozen-lockfile | |
| - name: Run GetSingleObject test | |
| working-directory: cloudserverclient/tests | |
| run: yarn test testApis.test.ts -t "GetSingleObject" | |
| - name: Stop cloudserver | |
| if: always() | |
| working-directory: cloudserver | |
| run: | | |
| if [ -f cloudserver.pid ]; then | |
| kill $(cat cloudserver.pid) || true | |
| fi |