diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy-docs.yml similarity index 96% rename from .github/workflows/deploy_docs.yml rename to .github/workflows/deploy-docs.yml index e9ba5a38..e7f0a87a 100644 --- a/.github/workflows/deploy_docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -3,9 +3,9 @@ name: Publish documentation on GitHub Pages on: workflow_dispatch jobs: - authorize: + authorize: name: Authorize - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - name: ${{ github.actor }} permission check to do a release uses: octokit/request-action@v2.0.0 @@ -17,7 +17,7 @@ jobs: gh-pages: name: Publish to GitHub Pages - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest needs: [authorize] steps: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..2694a0bd --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,35 @@ +name: Lint + +on: pull_request + +jobs: + lint-check: + name: Check for ESLint + Prettier Violations + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: node_modules cache + uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + run: | + yarn install --frozen-lockfile --network-timeout 300000 + + - name: Prettier check + run: | + yarn run lint:prettier + + - name: Eslint check + run: | + yarn run lint:eslint diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 23f736e1..3d7c4059 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,17 +1,17 @@ name: Release -on: +on: workflow_dispatch: inputs: dryRun: - description: 'Do a dry run to preview instead of a real release' + description: 'Do a dry run to preview instead of a real release' required: true default: 'true' jobs: - authorize: + authorize: name: Authorize - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - name: ${{ github.actor }} permission check to do a release uses: octokit/request-action@v2.0.0 @@ -23,7 +23,7 @@ jobs: release: name: Release - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest needs: [authorize] env: GIT_AUTHOR_NAME: amplitude-sdk-bot @@ -66,7 +66,7 @@ jobs: - name: Run tests run: make test - - name: Release --dry-run # Uses release.config.js + - name: Release --dry-run # Uses release.config.js if: ${{ github.event.inputs.dryRun == 'true'}} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/semantic-pr.yml b/.github/workflows/semantic-pr.yml index bc42590b..d2c8aad3 100644 --- a/.github/workflows/semantic-pr.yml +++ b/.github/workflows/semantic-pr.yml @@ -7,7 +7,7 @@ on: jobs: pr-title-check: name: Check PR for semantic title - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - name: PR title is valid if: > diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 48d524f9..a74f39c9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,43 +1,43 @@ name: Test -on: [push, pull_request] +# https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662 +on: + push: + branches: + - main + pull_request: + branches: + - main jobs: test: + name: Execute full unit test suite strategy: fail-fast: false matrix: node-version: [10.x, 12.x, 14.x] - os: [macos-10.14, ubuntu-18.04] + os: [macOS-latest, ubuntu-latest] runs-on: ${{ matrix.os }} steps: - - name: Check out Git repository - uses: actions/checkout@v2 - - - name: node_modules cache - uses: actions/cache@v2 - with: - path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - - name: yarn install - run: | - yarn install --frozen-lockfile - - - name: prettier check - run: | - yarn run lint:prettier - - - name: eslint check - run: | - yarn run lint:eslint - - - name: Build and run tests - run: | - make test + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: node_modules cache + uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + run: | + yarn install --frozen-lockfile --network-timeout 300000 + + - name: Build and run tests + run: | + make test