ci: add CLI tests to CI pipeline #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test CLI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Install npm dependencies | |
run: npm ci | |
- name: Build and package project | |
run: | | |
npm run build | |
npm run build-cli | |
npm pack | |
- name: Upload project artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: built-project | |
path: codeowners-generator-*.tgz | |
retention-days: 5 | |
test: | |
name: Test | |
needs: build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
# - macos-latest | |
# - ubuntu-latest | |
- windows-latest | |
node-version: | |
- 12 | |
# - 14 | |
# - 16 | |
# - 18 | |
# - 20 | |
# - 21 | |
steps: | |
- name: Download project artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: built-project | |
path: . | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install project | |
shell: bash | |
run: npm i -g codeowners-generator-*.tgz | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Test CLI | |
shell: bash | |
run: | | |
cd .github/test-cli-mock-project | |
echo "::group::Show CODEOWNERS content" | |
cat CODEOWNERS | |
echo "" | |
echo "::endgroup::" | |
echo "::group::Get Version" | |
codeowners-generator --version | |
echo "::endgroup::" | |
echo "::group::Check CODEOWNERS content" | |
codeowners-generator generate --check | |
echo "::endgroup::" |