diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..c71c065 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,73 @@ +name: PR Tests + +on: + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + dependencies: + runs-on: ubuntu-latest + + container: + image: node:18 + + strategy: + matrix: + node-version: [18.x] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Cache node modules + uses: actions/cache@v1 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/yarn.lock') }} + + - name: Install yarn + run: npm install -g yarn + + - name: Install dependencies + run: yarn install + + lint: + runs-on: ubuntu-latest + needs: dependencies + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Load node modules + uses: actions/cache@v1 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/yarn.lock') }} + + - name: Code passes lint check + run: yarn lint + + test: + runs-on: ubuntu-latest + needs: dependencies + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Load node modules + uses: actions/cache@v1 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/yarn.lock') }} + + - name: All Tests pass + run: yarn test \ No newline at end of file