|
1 | 1 | name: Tests |
| 2 | + |
2 | 3 | on: |
3 | 4 | push: |
4 | | - workflow_dispatch: |
5 | | - schedule: |
6 | | - - cron: "0 0 * * 0" |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + schedule: |
| 9 | + - cron: "0 */6 * * *" |
| 10 | + |
7 | 11 | jobs: |
8 | 12 | run_tests: |
9 | 13 | name: Run Tests |
10 | 14 | runs-on: ubuntu-latest |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + java-version: ["8", "11", "17"] |
11 | 18 | steps: |
12 | | - - uses: actions/checkout@v2 |
13 | | - - name: Set up JDK 17 |
14 | | - uses: actions/setup-java@v2 |
| 19 | + - name: Update repositories |
| 20 | + run: | |
| 21 | + apt update || echo "apt-update failed" # && apt -y upgrade |
| 22 | +
|
| 23 | + - name: Set up JDK ${{ matrix.java-version }} |
| 24 | + uses: actions/setup-java@v4 |
15 | 25 | with: |
16 | | - java-version: 17 |
17 | | - distribution: 'adopt' |
| 26 | + java-version: ${{ matrix.java-version }} |
| 27 | + distribution: "adopt" |
18 | 28 | cache: gradle |
19 | | - - id: run |
| 29 | + |
| 30 | + - name: Checkout ${{ github.event.repository.name }} |
| 31 | + uses: actions/checkout@v4 |
| 32 | + |
| 33 | + - name: Setup couchbase |
20 | 34 | run: | |
21 | | - ./gradlew --no-daemon test |
| 35 | + apt install -y iputils-ping || echo "apt-install failed" |
| 36 | + ping -c 1 couchbase && ( |
| 37 | + apt install -y socat |
| 38 | + socat TCP-LISTEN:8091,fork TCP:couchbase:8091 & |
| 39 | + socat TCP-LISTEN:8092,fork TCP:couchbase:8092 & |
| 40 | + socat TCP-LISTEN:8093,fork TCP:couchbase:8093 & |
| 41 | + socat TCP-LISTEN:8094,fork TCP:couchbase:8094 & |
| 42 | + socat TCP-LISTEN:8095,fork TCP:couchbase:8095 & |
| 43 | + socat TCP-LISTEN:8096,fork TCP:couchbase:8096 & |
| 44 | + socat TCP-LISTEN:9140,fork TCP:couchbase:9140 & |
| 45 | + socat TCP-LISTEN:11210,fork TCP:couchbase:11210 & |
| 46 | + socat TCP-LISTEN:11211,fork TCP:couchbase:11211 & |
| 47 | + socat TCP-LISTEN:11207,fork TCP:couchbase:11207 & |
| 48 | + socat TCP-LISTEN:18091,fork TCP:couchbase:18091 & |
| 49 | + socat TCP-LISTEN:18092,fork TCP:couchbase:18092 & |
| 50 | + socat TCP-LISTEN:18093,fork TCP:couchbase:18093 & |
| 51 | + socat TCP-LISTEN:18094,fork TCP:couchbase:18094 & |
| 52 | + socat TCP-LISTEN:18095,fork TCP:couchbase:18095 & |
| 53 | + socat TCP-LISTEN:18096,fork TCP:couchbase:18096 & |
| 54 | + ) && echo "Initialized couchbase port forwarding" || echo "ping couchbase failed, not forwarding ports" |
| 55 | + printf "Waiting for CB startup..." |
| 56 | + wget -O /dev/null http://localhost:8091/ && echo "DONE" || (echo "FAIL" && panic) |
| 57 | + curl -v -X POST http://localhost:8091/node/controller/setupServices -d 'services=kv%2Cn1ql%2Cindex' |
| 58 | + curl -v -X POST http://localhost:8091/pools/default -d 'memoryQuota=256' -d 'indexMemoryQuota=256' |
| 59 | + curl -u Administrator:password -v -X POST http://localhost:8091/settings/web -d 'password=password&username=Administrator&port=SAME' |
| 60 | + curl -v -X POST http://localhost:8091/pools/default/buckets \ |
| 61 | + -u Administrator:password \ |
| 62 | + -d name=user_profile \ |
| 63 | + -d bucketType=couchbase\ |
| 64 | + -d ramQuotaMB=1024 \ |
| 65 | + -d durabilityMinLevel=majorityAndPersistActive |
| 66 | + curl -u Administrator:password -v -X POST http://localhost:8091/settings/indexes -d 'storageMode=memory_optimized' |
| 67 | + curl -u Administrator:password -v -X GET http://localhost:8091/pools/default | jq '.' | grep hostname |
| 68 | + curl -u Administrator:password -v -X POST http://localhost:8091/sampleBuckets/install -d '["travel-sample"]' |
| 69 | +
|
| 70 | + - name: Run Gradle Tests |
| 71 | + id: run |
| 72 | + run: ./gradlew --no-daemon test |
| 73 | + |
22 | 74 | - name: Report Status |
23 | 75 | if: always() |
24 | 76 | uses: ravsamhq/notify-slack-action@v1 |
25 | 77 | with: |
26 | 78 | status: ${{ job.status }} |
27 | | - notify_when: 'failure' |
| 79 | + notify_when: "failure" |
28 | 80 | env: |
29 | 81 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 82 | + |
| 83 | + services: |
| 84 | + couchbase: |
| 85 | + image: public.ecr.aws/z2f7n8a1/couchbase-da-containers:couchbase-neo |
| 86 | + options: >- |
| 87 | + --health-cmd "wget -q -O - localhost:8091" |
| 88 | + --health-interval 10s |
| 89 | + --health-timeout 5s |
| 90 | + --health-retries 10 |
| 91 | + ports: |
| 92 | + - 8091-8096 |
| 93 | + - 9140 |
| 94 | + - 11210-11211 |
| 95 | + - 11207 |
| 96 | + - 18091-18096 |
0 commit comments