|
| 1 | +name: Test |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +jobs: |
| 9 | + test-installs: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v5 |
| 13 | + - uses: ./ |
| 14 | + - name: Test it was installed |
| 15 | + run: | |
| 16 | + cz version |
| 17 | + test-version: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v5 |
| 21 | + - uses: ./ |
| 22 | + with: |
| 23 | + version: 4.0.0 |
| 24 | + - name: Test version matches |
| 25 | + uses: actions/github-script@v8 |
| 26 | + with: |
| 27 | + script: | |
| 28 | + const assert = require('node:assert/strict'); |
| 29 | + const czVersion = await exec.getExecOutput('cz', ['version']); |
| 30 | + const expectedVersion = '4.0.0'; |
| 31 | + assert.equal(czVersion.stdout.trim(), expectedVersion); |
| 32 | + test-extra-requirements: |
| 33 | + strategy: |
| 34 | + matrix: |
| 35 | + extra_requirements: |
| 36 | + - pip_name: cz-conventional-gitmoji |
| 37 | + cz_name: cz_gitmoji |
| 38 | + - pip_name: cz-kpn |
| 39 | + cz_name: cz_kpn |
| 40 | + - pip_name: cz-kpn cz-conventional-gitmoji==0.7.0 |
| 41 | + cz_name: cz_kpn |
| 42 | + runs-on: ubuntu-latest |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v5 |
| 45 | + - uses: ./ |
| 46 | + with: |
| 47 | + extra_requirements: ${{ matrix.extra_requirements.pip_name }} |
| 48 | + - name: Test extra requirements were installed |
| 49 | + uses: actions/github-script@v8 |
| 50 | + env: |
| 51 | + EXTRA_REQUIREMENTS: ${{ matrix.extra_requirements.cz_name }} |
| 52 | + with: |
| 53 | + script: | |
| 54 | + const assert = require('node:assert/strict'); |
| 55 | + const extraRequirements = process.env.EXTRA_REQUIREMENTS; |
| 56 | + const czList = await exec.getExecOutput('cz', ['ls']); |
| 57 | + const allItems = czList.stdout.trim().split('\n'); |
| 58 | + const result = allItems.includes(extraRequirements); |
| 59 | + assert.ok(result, `Expected ${extraRequirements} to be included in the list of installed cz plugins, but it was not.`); |
0 commit comments