Merge pull request #16 from agi-inc/jacob/demo-readme #86
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 | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run ESLint | |
| run: npm run lint | |
| - name: Check formatting | |
| run: npx prettier --check "src/**/*.ts" "tests/**/*.ts" "examples/**/*.ts" | |
| typecheck: | |
| name: Type Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run TypeScript compiler | |
| run: npm run typecheck | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build package | |
| run: npm run build | |
| - name: Check build output | |
| run: | | |
| test -f dist/index.js || exit 1 | |
| test -f dist/index.mjs || exit 1 | |
| test -f dist/index.d.ts || exit 1 | |
| test: | |
| name: Test (Node ${{ matrix.node-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [20, 22] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run unit tests | |
| run: npm run test | |
| - name: Generate coverage report | |
| if: matrix.node-version == 20 | |
| run: npm run test:coverage | |
| - name: Upload coverage to Codecov | |
| if: matrix.node-version == 20 | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage/coverage-final.json | |
| flags: unittests | |
| name: codecov-agi-node | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| driver-integration: | |
| name: Driver Integration Tests | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| if: >- | |
| github.ref == 'refs/heads/main' || | |
| contains(github.head_ref || '', 'driver') || | |
| github.event_name == 'workflow_dispatch' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install SDK dependencies | |
| run: npm ci | |
| - name: Download agi-driver binary | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_PAT }} | |
| run: | | |
| gh release download --repo agi-inc/agents --pattern "agi-driver-linux-x64" -D /usr/local/bin/ || true | |
| chmod +x /usr/local/bin/agi-driver-linux-x64 2>/dev/null || true | |
| mv /usr/local/bin/agi-driver-linux-x64 /usr/local/bin/agi-driver 2>/dev/null || true | |
| - name: Install Xvfb and xdotool | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y xvfb xdotool scrot | |
| - name: Run driver integration tests | |
| env: | |
| AGI_API_KEY: ${{ secrets.AGI_API_KEY }} | |
| DISPLAY: ":99" | |
| run: | | |
| Xvfb :99 -screen 0 1920x1080x24 & | |
| sleep 2 | |
| npm run test:integration | |
| timeout-minutes: 5 | |
| all-checks: | |
| name: All Checks Passed | |
| if: always() | |
| needs: [lint, typecheck, build, test] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check all jobs | |
| run: | | |
| if [ "${{ needs.lint.result }}" != "success" ] || \ | |
| [ "${{ needs.typecheck.result }}" != "success" ] || \ | |
| [ "${{ needs.build.result }}" != "success" ] || \ | |
| [ "${{ needs.test.result }}" != "success" ]; then | |
| echo "One or more checks failed" | |
| exit 1 | |
| fi | |
| echo "All checks passed!" |