|
| 1 | +name: Test Scaffold |
| 2 | + |
| 3 | +# Workflow to **validate** the **integrity** of the scaffold template itself. |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - 1.x |
| 9 | + |
| 10 | + pull_request: |
| 11 | + branches: |
| 12 | + - 1.x |
| 13 | + - 'feature/**' |
| 14 | + |
| 15 | +jobs: |
| 16 | + scaffold-test: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout code |
| 21 | + uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Setup PHP |
| 24 | + uses: shivammathur/setup-php@v2 |
| 25 | + |
| 26 | + - name: Check coding standards |
| 27 | + uses: luizm/action-sh-checker@v0.8.0 |
| 28 | + env: |
| 29 | + SHFMT_OPTS: -i 2 -ci -s -d |
| 30 | + |
| 31 | + - name: Setup Node.js |
| 32 | + uses: actions/setup-node@v4 |
| 33 | + |
| 34 | + - name: Setup kcov |
| 35 | + run: wget https://github.com/SimonKagstrom/kcov/releases/download/v42/kcov-amd64.tar.gz && tar -xf kcov-amd64.tar.gz && sudo mv ./usr/local/bin/kcov /usr/local/bin/kcov && kcov --version |
| 36 | + |
| 37 | + - name: Install dependencies |
| 38 | + run: npm ci |
| 39 | + working-directory: .scaffold/tests |
| 40 | + |
| 41 | + - name: Run tests |
| 42 | + run: kcov --include-pattern=.sh,.bash --bash-parse-files-in-dir=. --exclude-pattern=vendor,node_modules,.scaffold-coverage-html "$(pwd)"/.scaffold-coverage-html .scaffold/tests/node_modules/.bin/bats .scaffold/tests/bats |
| 43 | + |
| 44 | + - name: Upload coverage report as an artifact |
| 45 | + uses: actions/upload-artifact@v4 |
| 46 | + with: |
| 47 | + name: ${{github.job}}-code-coverage-report |
| 48 | + path: ./.scaffold-coverage-html |
| 49 | + if-no-files-found: error |
| 50 | + |
| 51 | + - name: Upload coverage report to Codecov |
| 52 | + uses: codecov/codecov-action@v4 |
| 53 | + if: ${{ env.CODECOV_TOKEN != '' }} |
| 54 | + with: |
| 55 | + directory: ./.scaffold-coverage-html |
| 56 | + fail_ci_if_error: true |
| 57 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 58 | + env: |
| 59 | + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 60 | + |
| 61 | + scaffold-test-actions: |
| 62 | + runs-on: ubuntu-latest |
| 63 | + |
| 64 | + steps: |
| 65 | + - name: Checkout code |
| 66 | + uses: actions/checkout@v4 |
| 67 | + |
| 68 | + - name: Check coding standards with yamllint |
| 69 | + run: yamllint --config-file .scaffold/tests/.yamllint-for-gha.yml .github/workflows |
| 70 | + continue-on-error: ${{ vars.DREVOPS_CI_YAMLLINT_IGNORE_FAILURE == '1' }} |
| 71 | + |
| 72 | + - name: Check coding standards with actionlint |
| 73 | + run: docker run --rm -v "${GITHUB_WORKSPACE:-.}":/app --workdir /app rhysd/actionlint:1.6.27 -ignore 'SC2002:' -ignore 'SC2155:' |
| 74 | + continue-on-error: ${{ vars.DREVOPS_CI_ACTIONLINT_IGNORE_FAILURE == '1' }} |
| 75 | + |
| 76 | + scaffold-test-docs: |
| 77 | + runs-on: ubuntu-latest |
| 78 | + |
| 79 | + steps: |
| 80 | + - name: Checkout code |
| 81 | + uses: actions/checkout@v4 |
| 82 | + with: |
| 83 | + fetch-depth: 0 |
| 84 | + |
| 85 | + - name: Setup Node.js |
| 86 | + uses: actions/setup-node@v4 |
| 87 | + |
| 88 | + - name: Install dependencies |
| 89 | + run: npm install |
| 90 | + working-directory: '${{ github.workspace }}/.scaffold/docs' |
| 91 | + |
| 92 | + - name: Build documentation site |
| 93 | + run: npm run build |
| 94 | + working-directory: '${{ github.workspace }}/.scaffold/docs' |
| 95 | + |
| 96 | + - name: Run tests |
| 97 | + run: npm run test |
| 98 | + working-directory: '${{ github.workspace }}/.scaffold/docs' |
| 99 | + |
| 100 | + - name: Deploy to Netlify |
| 101 | + uses: nwtgck/actions-netlify@v3.0 |
| 102 | + with: |
| 103 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 104 | + publish-dir: '.scaffold/docs/build' |
| 105 | + production-branch: 1.x |
| 106 | + deploy-message: "Deploy from GitHub Actions" |
| 107 | + enable-pull-request-comment: true |
| 108 | + enable-commit-comment: true |
| 109 | + overwrites-pull-request-comment: true |
| 110 | + env: |
| 111 | + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |
| 112 | + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
| 113 | + timeout-minutes: 1 |
0 commit comments