diff --git a/.github/workflows/node-api.yml b/.github/workflows/node-api.yml new file mode 100644 index 000000000..4068890c9 --- /dev/null +++ b/.github/workflows/node-api.yml @@ -0,0 +1,111 @@ +name: Node API CI + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + setup: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: "20.x" + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ~/.cache/yarn + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: Install dependencies + working-directory: ./api-node + run: yarn install --frozen-lockfile + + build: + needs: setup + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: "20.x" + - name: Restore cache + uses: actions/cache@v3 + with: + path: ~/.cache/yarn + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + - name: Install dependencies + working-directory: ./api-node + run: yarn install --frozen-lockfile + - name: Build + working-directory: ./api-node + run: yarn build + + lint: + needs: setup + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: "20.x" + - name: Restore cache + uses: actions/cache@v3 + with: + path: ~/.cache/yarn + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + - name: Install dependencies + working-directory: ./api-node + run: yarn install --frozen-lockfile + - name: Lint + working-directory: ./api-node + run: yarn lint + + test: + needs: setup + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: "20.x" + - name: Restore cache + uses: actions/cache@v3 + with: + path: ~/.cache/yarn + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + - name: Install dependencies + working-directory: ./api-node + run: yarn install --frozen-lockfile + - name: Run unit tests + working-directory: ./api-node + run: yarn test + + e2e-test: + needs: setup + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: "20.x" + - name: Restore cache + uses: actions/cache@v3 + with: + path: ~/.cache/yarn + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + - name: Install dependencies + working-directory: ./api-node + run: yarn install --frozen-lockfile + - name: Run e2e tests + working-directory: ./api-node + run: yarn test:e2e