|
| 1 | +name: CI Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, development/*, improvement/* ] |
| 6 | + pull_request: |
| 7 | + branches: [ main, development/* ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + services: |
| 14 | + mongodb: |
| 15 | + image: mongo:6.0 |
| 16 | + ports: |
| 17 | + - 27017:27017 |
| 18 | + options: >- |
| 19 | + --health-cmd "mongosh --eval 'db.adminCommand({ping: 1})'" |
| 20 | + --health-interval 10s |
| 21 | + --health-timeout 5s |
| 22 | + --health-retries 5 |
| 23 | +
|
| 24 | + steps: |
| 25 | + - name: Checkout cloudserverclient |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + path: cloudserverclient |
| 29 | + |
| 30 | + - name: Checkout cloudserver |
| 31 | + uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + repository: scality/cloudserver |
| 34 | + ref: 9.1.4 |
| 35 | + path: cloudserver |
| 36 | + |
| 37 | + - name: Setup Node.js |
| 38 | + uses: actions/setup-node@v4 |
| 39 | + with: |
| 40 | + node-version: '22' |
| 41 | + cache: 'yarn' |
| 42 | + cache-dependency-path: | |
| 43 | + cloudserverclient/yarn.lock |
| 44 | + cloudserver/yarn.lock |
| 45 | +
|
| 46 | + - name: Install cloudserver dependencies |
| 47 | + working-directory: cloudserver |
| 48 | + run: yarn install --frozen-lockfile --network-timeout 100000 --ignore-scripts |
| 49 | + |
| 50 | + - name: Verify cloudserver installation |
| 51 | + working-directory: cloudserver |
| 52 | + run: | |
| 53 | + echo "Checking cloudserver installation..." |
| 54 | + ls -la |
| 55 | + cat package.json | grep '"name"' |
| 56 | + echo "Node version: $(node --version)" |
| 57 | + echo "Yarn version: $(yarn --version)" |
| 58 | +
|
| 59 | + - name: Start cloudserver in background |
| 60 | + working-directory: cloudserver |
| 61 | + run: | |
| 62 | + echo "Starting cloudserver..." |
| 63 | + S3VAULT=mem S3METADATA=mongodb S3DATA=mem REMOTE_MANAGEMENT_DISABLE=true yarn start & |
| 64 | + echo $! > cloudserver.pid |
| 65 | + echo "Cloudserver PID: $(cat cloudserver.pid)" |
| 66 | + env: |
| 67 | + CI: true |
| 68 | + |
| 69 | + - name: Wait for cloudserver to be ready |
| 70 | + run: | |
| 71 | + echo "Waiting for cloudserver to start..." |
| 72 | + timeout 60 bash -c 'until curl -f http://localhost:8000 2>/dev/null; do sleep 2; done' |
| 73 | + echo "Cloudserver is ready!" |
| 74 | +
|
| 75 | + - name: Install cloudserverclient dependencies |
| 76 | + working-directory: cloudserverclient |
| 77 | + run: yarn install --frozen-lockfile |
| 78 | + |
| 79 | + - name: Build cloudserverclient |
| 80 | + working-directory: cloudserverclient |
| 81 | + run: yarn build |
| 82 | + |
| 83 | + - name: Install test dependencies |
| 84 | + working-directory: cloudserverclient/tests |
| 85 | + run: yarn install --frozen-lockfile |
| 86 | + |
| 87 | + - name: Run GetSingleObject test |
| 88 | + working-directory: cloudserverclient/tests |
| 89 | + run: yarn test testApis.test.ts -t "GetSingleObject" |
| 90 | + |
| 91 | + - name: Stop cloudserver |
| 92 | + if: always() |
| 93 | + working-directory: cloudserver |
| 94 | + run: | |
| 95 | + if [ -f cloudserver.pid ]; then |
| 96 | + kill $(cat cloudserver.pid) || true |
| 97 | + fi |
0 commit comments