Github Actions
Automate, customize, and execute your software development workflows right in your repository with GitHub Actions. You can discover, create, and share actions to perform any job you'd like, including CI/CD, and combine actions in a completely customized workflow.
Refer to official documentation for detailed usage. →
The following YAML workflow file created into the .github/workflows/ci.yml
as a default by superplate, if GitHub Actions selected as a CI plugin.
.github/workflows/ci.yml
name: ci
on: push: branches: - main - master pull_request: branches: - main - master
jobs: ci: runs-on: ${{ matrix.os }}
strategy: matrix: os: [ubuntu-latest] node: [14]
steps: - name: Checkout uses: actions/checkout@master
- name: Setup node env uses: actions/setup-node@v2.1.2 with: node-version: ${{ matrix.node }}
- name: Cache node_modules uses: actions/cache@v2 with: path: ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node-
- name: Install dependencies run: npm ci
- name: Run tests run: npm run test
tip
The following commands are added to .github/workflows/ci.yml
by superplate if any of plugins listed below is selected during project creation phase.
note
You can use the following commands in case of adding Github Actions to existing project later.
#
Package manager- npm
- yarn
- name: Cache node_modules uses: actions/cache@v2 with: path: ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node-
- name: Get yarn cache directory path id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache node_modules uses: actions/cache@v2 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn-
#
Install dependencies- npm
- yarn
- name: Install dependencies run: npm ci
- name: Install dependencies run: yarn
#
Run ESlint- npm
- yarn
- name: Run lint run: npm run lint
- name: Run lint run: yarn lint
#
Testing#
Run tests- npm
- yarn
- name: Run tests run: npm run test
- name: Run tests run: yarn test
#
Run Cypress E2E Testing- npm
- yarn
- name: Run e2e test run: npm run cypress:test
- name: Run e2e test run: yarn cypress:test
#
WebdriverIO E2E Testing- npm
- yarn
- name: Run e2e test run: npm run webdriver:run
- name: Run e2e test run: yarn webdriver:run