diff --git a/.github/workflows/nodejs.yml b/.github/workflows/deploy.yml similarity index 81% rename from .github/workflows/nodejs.yml rename to .github/workflows/deploy.yml index 7ed2ef3..12dc5ec 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/deploy.yml @@ -1,6 +1,10 @@ -name: Node CI +name: Deploy -on: [push] +on: + workflow_run: + workflows: ["Test"] + branches: [master] + types: [completed] jobs: build: @@ -32,18 +36,6 @@ jobs: - name: Install dependencies run: yarn install --skip-integrity-check --non-interactive --no-progress - - name: TypeScript check - run: yarn tsc - - - name: Eslint check - run: yarn lint:script - - - name: Vetur check - run: yarn lint:vti - - - name: Unit test - run: yarn test:unit - - name: Build run: | yarn build --base=/vue3-realworld-example-app/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..cdc8332 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,89 @@ +name: Test + +on: [push] + +jobs: + unit_test: + name: Unit test + env: + CI: true + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + + # https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping + - name: Use Node.js 14.x + uses: actions/setup-node@v1 + with: + node-version: 14.x + + - name: Get yarn cache + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v1 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install dependencies + run: yarn install --skip-integrity-check --non-interactive --no-progress + + - name: TypeScript check + run: yarn tsc + + - name: Eslint check + run: yarn lint:script + + - name: Vetur check + run: yarn lint:vti + + - name: Unit test + run: yarn test:unit + + e2e_tests: + name: E2E test + env: + CI: true + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + + # https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping + - name: Use Node.js 14.x + uses: actions/setup-node@v1 + with: + node-version: 14.x + + - name: Get yarn cache + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v1 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install dependencies + run: yarn install --skip-integrity-check --non-interactive --no-progress + + - name: Build + run: yarn build + + - name: E2E test + uses: cypress-io/github-action@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} + with: + config: baseUrl=http://localhost:5000 + start: serve dist + wait-on: http://localhost:5000 diff --git a/cypress.json b/cypress.json index 17ef242..fe61731 100644 --- a/cypress.json +++ b/cypress.json @@ -1,3 +1,4 @@ { + "projectId": "j7s91r", "baseUrl": "http://localhost:3000" }