diff --git a/.github/workflows/dhis2-verify-commits.yml.yml b/.github/workflows/dhis2-verify-commits.yml.yml deleted file mode 100644 index 91ad933..0000000 --- a/.github/workflows/dhis2-verify-commits.yml.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: 'dhis2: verify (commits)' - -on: - pull_request: - types: ['opened', 'edited', 'reopened', 'synchronize'] - -jobs: - lint-pr-title: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: c-hive/gha-yarn-cache@v1 - - run: yarn install --frozen-lockfile - - id: commitlint - run: echo ::set-output name=config_path::$(node -e "process.stdout.write(require('@dhis2/cli-style').config.commitlint)") - - uses: JulienKode/pull-request-name-linter-action@v0.5.0 - with: - configuration-path: ${{ steps.commitlint.outputs.config_path }} - - lint-commits: - runs-on: ubuntu-latest - if: ${{ !contains(github.event.pull_request.title, '[skip commit-lint]') }} - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: c-hive/gha-yarn-cache@v1 - - run: yarn install --frozen-lockfile - - id: commitlint - run: echo ::set-output name=config_path::$(node -e "process.stdout.write(require('@dhis2/cli-style').config.commitlint)") - - uses: wagoid/commitlint-github-action@v4 - with: - configFile: ${{ steps.commitlint.outputs.config_path }} diff --git a/.github/workflows/dhis2-verify-lib.yml b/.github/workflows/dhis2-verify-lib.yml deleted file mode 100644 index 8b56a9e..0000000 --- a/.github/workflows/dhis2-verify-lib.yml +++ /dev/null @@ -1,135 +0,0 @@ -name: 'dhis2: verify (lib)' - -on: - push: - branches: - - '**' - -env: - GIT_AUTHOR_NAME: '@dhis2-bot' - GIT_AUTHOR_EMAIL: 'apps@dhis2.org' - GIT_COMMITTER_NAME: '@dhis2-bot' - GIT_COMMITTER_EMAIL: 'apps@dhis2.org' - NPM_TOKEN: ${{secrets.DHIS2_BOT_NPM_TOKEN}} - GH_TOKEN: ${{secrets.DHIS2_BOT_GITHUB_TOKEN}} - CI: true - -jobs: - install: - runs-on: ubuntu-latest - if: "!contains(github.event.head_commit.message, '[skip ci]')" - - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 14.x - - - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: '**/node_modules' - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - - - name: Install - if: steps.yarn-cache.outputs.cache-hit != 'true' - run: | - yarn install --frozen-lockfile - - build: - runs-on: ubuntu-latest - needs: install - if: "!contains(github.event.head_commit.message, '[skip ci]')" - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 14.x - - - uses: actions/cache@v3 - id: yarn-cache - with: - path: '**/node_modules' - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - - - name: Build - run: yarn build - - - uses: actions/upload-artifact@v3 - with: - name: lib-build - path: | - **/build - !**/node_modules - retention-days: 1 - - lint: - runs-on: ubuntu-latest - needs: [install, build] - if: "!contains(github.event.head_commit.message, '[skip ci]')" - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 14.x - - - uses: actions/cache@v3 - id: yarn-cache - with: - path: '**/node_modules' - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - - - name: Lint - run: yarn lint - - test: - runs-on: ubuntu-latest - needs: [install, build] - if: "!contains(github.event.head_commit.message, '[skip ci]')" - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 14.x - - - uses: actions/cache@v3 - id: yarn-cache - with: - path: '**/node_modules' - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - - - name: Build - run: yarn build - - - name: Test - run: yarn test --coverage && yarn cucumber --tags 'not @draft' - - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4.0.1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - - publish: - runs-on: ubuntu-latest - needs: [build, lint, test] - if: "!contains(github.event.head_commit.message, '[skip ci]')" - # if: - # "!contains(github.event.head_commit.message, '[skip ci]') && contains(' - # refs/heads/main - # refs/heads/next - # refs/heads/beta - # ', github.ref)" - steps: - - uses: actions/checkout@v3 - with: - token: ${{env.GH_TOKEN}} - - uses: actions/setup-node@v3 - with: - node-version: 14.x - - - uses: actions/download-artifact@v3 - with: - name: lib-build - - - name: Publish to NPM - run: npx @dhis2/cli-utils release --publish npm diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml new file mode 100644 index 0000000..eb59072 --- /dev/null +++ b/.github/workflows/lint-pr-title.yml @@ -0,0 +1,13 @@ +name: lint-pr-title + +on: + pull_request: + types: ['opened', 'edited', 'reopened', 'synchronize'] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true + +jobs: + lint-pr-title: + uses: dhis2/workflows-platform/.github/workflows/lint-pr-title.yml@v1 diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml new file mode 100644 index 0000000..668b88a --- /dev/null +++ b/.github/workflows/test-and-release.yml @@ -0,0 +1,22 @@ +name: test-and-release + +on: push + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + # Cancel previous runs if not on a release branch + cancel-in-progress: ${{ !contains(github.ref, fromJSON('["master", "main"]')) }} + +jobs: + lint-commits: + uses: dhis2/workflows-platform/.github/workflows/lint-commits.yml@v1 + lint: + uses: dhis2/workflows-platform/.github/workflows/lint.yml@v1 + test: + uses: dhis2/workflows-platform/.github/workflows/test.yml@v1 + release: + needs: [lint-commits, lint, test] + uses: dhis2/workflows-platform/.github/workflows/release.yml@v1 + # Skips forks and dependabot PRs + if: '!github.event.push.repository.fork' + secrets: inherit