diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c26e46f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,57 @@ +name: ci + +on: + - push + - pull_request + +jobs: + + build: + name: Continuous integration (build) + runs-on: ubuntu-latest + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v2 + + - name: Install 📦 + uses: bahmutov/npm-install@v1 + with: + install-command: yarn --frozen-lockfile --ignore-scripts + useRollingCache: true + + - name: Build 🏗️ + run: yarn build + + - name: Archive build 💽 + uses: actions/upload-artifact@v2 + with: + name: dist + path: dist + retention-days: 1 + + test: + needs: ["build"] + name: Continuous integration (tests) + runs-on: ubuntu-latest + strategy: + matrix: + bundle: ["modern", "module", "cjs"] + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v2 + + - name: Install 📦 + uses: bahmutov/npm-install@v1 + with: + install-command: yarn --frozen-lockfile --ignore-scripts + useRollingCache: true + + - name: Load build 💽 + uses: actions/download-artifact@v2 + with: + name: dist + path: dist + + - name: Test 🔬 + run: yarn test:${{ matrix.bundle }} + diff --git a/.github/workflows/ci:test.yml b/.github/workflows/ci:cover.yml similarity index 71% rename from .github/workflows/ci:test.yml rename to .github/workflows/ci:cover.yml index 39066c3..6049639 100644 --- a/.github/workflows/ci:test.yml +++ b/.github/workflows/ci:cover.yml @@ -1,23 +1,23 @@ -name: ci:test +name: ci:cover on: - push - pull_request jobs: - test: - name: Continuous integration (tests) + cover: + name: Continuous integration (code coverage) runs-on: ubuntu-latest steps: - name: Checkout 🛎️ uses: actions/checkout@v2 - - name: Install 🔧 + - name: Install 📦 uses: bahmutov/npm-install@v1 with: install-command: yarn --frozen-lockfile --ignore-scripts useRollingCache: true - - name: Test 🔬 - run: yarn ci:test + - name: Test and record coverage 🔬 + run: yarn cover - name: Publish coverage report 📃 uses: codecov/codecov-action@v2 diff --git a/.github/workflows/ci:lint-config.yml b/.github/workflows/ci:lint-config.yml new file mode 100644 index 0000000..ca113f6 --- /dev/null +++ b/.github/workflows/ci:lint-config.yml @@ -0,0 +1,20 @@ +name: ci:lint-config +on: + - push + - pull_request +jobs: + cover: + name: Continuous integration (config linting) + runs-on: ubuntu-latest + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v2 + + - name: Install 📦 + uses: bahmutov/npm-install@v1 + with: + install-command: yarn --frozen-lockfile --ignore-scripts + useRollingCache: true + + - name: Lint config 👕 + run: yarn lint-config diff --git a/.github/workflows/ci:build.yml b/.github/workflows/ci:lint.yml similarity index 66% rename from .github/workflows/ci:build.yml rename to .github/workflows/ci:lint.yml index 1d3b5af..ede9890 100644 --- a/.github/workflows/ci:build.yml +++ b/.github/workflows/ci:lint.yml @@ -1,20 +1,20 @@ -name: ci:build +name: ci:lint on: - push - pull_request jobs: - test: - name: Continuous integration (build) + cover: + name: Continuous integration (code linting) runs-on: ubuntu-latest steps: - name: Checkout 🛎️ uses: actions/checkout@v2 - - name: Install 🔧 + - name: Install 📦 uses: bahmutov/npm-install@v1 with: install-command: yarn --frozen-lockfile --ignore-scripts useRollingCache: true - - name: Build 🏗️ - run: yarn ci:build + - name: Lint 👕 + run: yarn lint diff --git a/package.json b/package.json index fd2a86d..f1e97f6 100644 --- a/package.json +++ b/package.json @@ -42,8 +42,6 @@ "build": "NODE_ENV=production microbundle", "build-docs": "esdoc", "build-gh-pages": "npm run build-docs", - "ci:build": "npm run build", - "ci:test": "npm run lint-config && npm run lint && npm run cover", "commit-msg": "commitlint --edit", "cover": "NODE_ENV=cover c8 --all --src src --reporter lcov --reporter text-summary --reporter text npm test", "debug": "NODE_ENV=debug npm test -- -- -- -st --fail-fast",