|
| 1 | +name: Integration Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + node-version: |
| 10 | + description: 'Node.js version' |
| 11 | + required: true |
| 12 | + type: choice |
| 13 | + default: 'all' |
| 14 | + options: |
| 15 | + - 'all' |
| 16 | + - '20' |
| 17 | + - '22' |
| 18 | + - '24' |
| 19 | + |
| 20 | +jobs: |
| 21 | + generate-node-version-matrix: |
| 22 | + name: Generate Node Version Matrix |
| 23 | + runs-on: ubuntu-latest |
| 24 | + outputs: |
| 25 | + node-versions: ${{ steps.set-node-versions.outputs.node-versions }} |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Checkout code |
| 29 | + uses: actions/checkout@v6 |
| 30 | + |
| 31 | + - name: Set Node versions |
| 32 | + id: set-node-versions |
| 33 | + run: | |
| 34 | + if [ "${{ github.event.inputs.node-version }}" == "all" ] || [ -z "${{ github.event.inputs.node-version }}" ]; then |
| 35 | + echo "node-versions=[20, 22, 24]" >> $GITHUB_OUTPUT |
| 36 | + else |
| 37 | + echo "node-versions=[${{ github.event.inputs.node-version }}]" >> $GITHUB_OUTPUT |
| 38 | + fi |
| 39 | +
|
| 40 | + build: |
| 41 | + name: Build Harper (Node.js v${{ matrix.node-version }}) |
| 42 | + needs: generate-node-version-matrix |
| 43 | + runs-on: ubuntu-latest |
| 44 | + |
| 45 | + strategy: |
| 46 | + fail-fast: false |
| 47 | + matrix: |
| 48 | + node-version: ${{ fromJSON(needs.generate-node-version-matrix.outputs.node-versions) }} |
| 49 | + |
| 50 | + steps: |
| 51 | + - name: Checkout code |
| 52 | + uses: actions/checkout@v6 |
| 53 | + |
| 54 | + - name: Setup Node.js ${{ matrix.node-version }} |
| 55 | + uses: actions/setup-node@v6 |
| 56 | + with: |
| 57 | + node-version: ${{ matrix.node-version }} |
| 58 | + package-manager-cache: false |
| 59 | + |
| 60 | + - name: Install dependencies |
| 61 | + run: npm install |
| 62 | + |
| 63 | + - name: Build |
| 64 | + run: npm run build || true # we currently have type errors so just ignore that |
| 65 | + |
| 66 | + - name: Upload build artifacts |
| 67 | + uses: actions/upload-artifact@v4 |
| 68 | + with: |
| 69 | + name: harper-build-artifacts-node-${{ matrix.node-version }} |
| 70 | + path: | |
| 71 | + dist/ |
| 72 | + static/ |
| 73 | + node_modules/ |
| 74 | + package.json |
| 75 | + retention-days: 1 |
| 76 | + |
| 77 | + run-integration-apiTests: |
| 78 | + name: Integration API Tests (Node.js v${{ matrix.node-version }}) |
| 79 | + needs: [generate-node-version-matrix, build] |
| 80 | + runs-on: ubuntu-latest |
| 81 | + |
| 82 | + strategy: |
| 83 | + fail-fast: false |
| 84 | + matrix: |
| 85 | + node-version: ${{ fromJSON(needs.generate-node-version-matrix.outputs.node-versions) }} |
| 86 | + |
| 87 | + steps: |
| 88 | + - name: Checkout code |
| 89 | + uses: actions/checkout@v6 |
| 90 | + |
| 91 | + - name: Setup Node.js ${{ matrix.node-version }} |
| 92 | + uses: actions/setup-node@v6 |
| 93 | + with: |
| 94 | + node-version: ${{ matrix.node-version }} |
| 95 | + package-manager-cache: false |
| 96 | + |
| 97 | + - name: Download build artifacts |
| 98 | + uses: actions/download-artifact@v4 |
| 99 | + with: |
| 100 | + name: harper-build-artifacts-node-${{ matrix.node-version }} |
| 101 | + |
| 102 | + - name: Setup Harper |
| 103 | + env: |
| 104 | + DEFAULTS_MODE: 'dev' |
| 105 | + HDB_ADMIN_USERNAME: 'admin' |
| 106 | + HDB_ADMIN_PASSWORD: 'password' |
| 107 | + ROOTPATH: '/tmp/hdb' |
| 108 | + OPERATIONSAPI_NETWORK_PORT: 9925 |
| 109 | + LOGGING_LEVEL: 'debug' |
| 110 | + LOGGING_STDSTREAMS: true |
| 111 | + THREADS_COUNT: 1 |
| 112 | + THREADS_DEBUG: false |
| 113 | + NODE_HOSTNAME: 'localhost' |
| 114 | + run: | |
| 115 | + node ./dist/bin/harper.js install |
| 116 | + sleep 10 |
| 117 | + node ./dist/bin/harper.js start |
| 118 | + sleep 10 |
| 119 | +
|
| 120 | + - name: Run API Tests |
| 121 | + id: run-api-tests |
| 122 | + env: |
| 123 | + HDB_ADMIN_USERNAME: 'admin' |
| 124 | + HDB_ADMIN_PASSWORD: 'password' |
| 125 | + run: npm run test:integration:api-tests |
| 126 | + |
| 127 | + - name: Upload Harper logs |
| 128 | + if: steps.run-api-tests.outcome == 'failure' |
| 129 | + uses: actions/upload-artifact@v4 |
| 130 | + with: |
| 131 | + name: harper-integration-api-test-logs-node-${{ matrix.node-version }} |
| 132 | + path: /tmp/hdb/log/hdb.log |
| 133 | + retention-days: 2 |
| 134 | + |
| 135 | + run-integration-tests: |
| 136 | + name: Integration Tests ${{matrix.shard}}/4 (Node.js v${{ matrix.node-version }}) |
| 137 | + runs-on: ubuntu-latest |
| 138 | + needs: [generate-node-version-matrix, build] |
| 139 | + strategy: |
| 140 | + fail-fast: false |
| 141 | + matrix: |
| 142 | + node-version: ${{ fromJSON(needs.generate-node-version-matrix.outputs.node-versions) }} |
| 143 | + shard: [1, 2, 3, 4] |
| 144 | + exclude: |
| 145 | + - node-version: 20 |
| 146 | + |
| 147 | + steps: |
| 148 | + - name: Checkout code |
| 149 | + uses: actions/checkout@v6 |
| 150 | + |
| 151 | + - name: Setup Node.js ${{ matrix.node-version }} |
| 152 | + uses: actions/setup-node@v6 |
| 153 | + with: |
| 154 | + node-version: ${{ matrix.node-version }} |
| 155 | + package-manager-cache: false |
| 156 | + |
| 157 | + - name: Download build artifacts |
| 158 | + uses: actions/download-artifact@v4 |
| 159 | + with: |
| 160 | + name: harper-build-artifacts-node-${{ matrix.node-version }} |
| 161 | + |
| 162 | + - name: Run Integration Test Shard ${{ matrix.shard }} |
| 163 | + run: | |
| 164 | + npm run test:integration -- --shard=${{ matrix.shard }}/4 |
0 commit comments