Skip to content

Commit

Permalink
Merge pull request #283 from proto-graphql/izumin5210/ci
Browse files Browse the repository at this point in the history
ci: refactor workflows
  • Loading branch information
izumin5210 authored Oct 8, 2023
2 parents a427855 + efdb2fa commit f0d6d77
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 75 deletions.
17 changes: 17 additions & 0 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Setup Node environment"
description: "Setup Node.js environment"
inputs:
node-version:
description: Node.js version
default: "18.x"
runs:
using: "composite"
steps:
- uses: actions/setup-node@v1
with:
node-version: ${{ inputs.node-version }}
cache: "pnpm"
- run: corepack enable
shell: bash
- run: pnpm install --frozen-lockfile
shell: bash
90 changes: 52 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,67 @@
name: CI

on: [push]
on:
pull_request:
branches:
- "**"
push:
branches:
- main

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-node
- run: pnpm lint
- name: check code is up to date
run: git diff --exit-code

format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-node
- run: pnpm format
- name: check code is up to date
run: git diff --exit-code

test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: pnpm/action-setup@v2
with:
version: 7
- uses: actions/setup-node@v1
with:
node-version: 18.x
cache: 'pnpm'
- uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ github.token }}
- run: pnpm install --frozen-lockfile
- run: pnpm test
- name: Coveralls
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: packages/protoc-gen-nexus/coverage/lcov.info
base-path: packages/protoc-gen-nexus
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-node
- run: pnpm test
- name: check code is up to date
run: git diff --exit-code
- name: Coveralls
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: packages/protoc-gen-nexus/coverage/lcov.info
base-path: packages/protoc-gen-nexus

test-e2e:
name: E2E Test - Node.js v${{ matrix.node-version }}
strategy:
matrix:
node-version: [16, 18]
node-version: ["16.x", "18.x"]
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: pnpm/action-setup@v2
with:
version: 7
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ github.token }}
- run: pnpm install --frozen-lockfile
- run: pnpm test:e2e
- uses: actions/checkout@v3
with:
submodules: true
- uses: ./.github/actions/setup-node
with:
node-version: ${{ matrix.node-version }}
- uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ github.token }}
- run: pnpm test:e2e
- name: check code is up to date
run: git diff --exit-code
25 changes: 0 additions & 25 deletions .github/workflows/lint.yml

This file was deleted.

14 changes: 2 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,11 @@ jobs:
contents: write
pull-requests: write
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true

- uses: pnpm/action-setup@v2
with:
version: 7
- uses: actions/setup-node@v2
with:
node-version: 18.x
cache: 'pnpm'

- name: Install Dependencies
run: pnpm install --frozen-lockfile
- uses: ./.github/actions/setup-node

- name: Create Release Pull Request or Publish to npm
id: changesets
Expand Down

0 comments on commit f0d6d77

Please sign in to comment.