diff --git a/.github/workflows/ci-branch.yml b/.github/workflows/ci-branch.yml new file mode 100644 index 000000000..e1fd79a7f --- /dev/null +++ b/.github/workflows/ci-branch.yml @@ -0,0 +1,21 @@ +name: CI + +on: + push: + branches: + - develop + - master + pull_request: + types: [opened, synchronize, reopened] + workflow_dispatch: + +concurrency: + group: ci-branch-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + branch: + uses: ./.github/workflows/ci-reusable.yml + with: + checkout-ref: ${{ github.event.pull_request.head.sha || github.sha }} + secrets: inherit diff --git a/.github/workflows/ci-pull-request.yml b/.github/workflows/ci-pull-request.yml new file mode 100644 index 000000000..9ab1857a9 --- /dev/null +++ b/.github/workflows/ci-pull-request.yml @@ -0,0 +1,16 @@ +name: CI + +on: + pull_request: + types: [opened, synchronize, reopened] + +concurrency: + group: ci-pr-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + pull-request: + uses: ./.github/workflows/ci-reusable.yml + with: + checkout-ref: '' + secrets: inherit diff --git a/.github/workflows/ci-reusable.yml b/.github/workflows/ci-reusable.yml new file mode 100644 index 000000000..689493ab7 --- /dev/null +++ b/.github/workflows/ci-reusable.yml @@ -0,0 +1,75 @@ +name: CI Pipeline + +on: + workflow_call: + inputs: + checkout-ref: + description: 'Git ref to checkout (empty for default merge commit)' + type: string + required: false + default: '' + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: ['lts/*', 'node'] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ inputs.checkout-ref || github.ref }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install system dependencies + run: | + curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-4.4.gpg --dearmor + echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-4.4.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list + sudo apt-get update + sudo apt-get install -y build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev + + - name: Clone and setup Enact CLI + run: | + git clone --branch=develop --depth 1 https://github.com/enactjs/cli ../cli + pushd ../cli + npm install + npm link + popd + + - name: Clone and setup Enact framework + run: | + git clone --branch=develop --depth 1 https://github.com/enactjs/enact ../enact + pushd ../enact + npm install + npm run lerna exec -- --ignore enact-sampler --concurrency 1 -- npm --no-package-lock install + npm run lerna exec -- --ignore enact-sampler --concurrency 1 -- npm --no-package-lock link + npm run interlink + popd + + - name: Install project dependencies + run: | + rm -fr node_modules/@enact + npm install + enact link + + - name: Run tests with coverage + run: npm test -- --runInBand --coverage + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false + + - name: Run ESLint + run: npm run lint -- -- --report-unused-disable-directives --max-warnings 0 . + + - name: Validate documentation + run: npm run validate-docs diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9d9649ec1..000000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -dist: jammy -language: node_js -node_js: - - lts/* - - node -sudo: false -before_install: - - curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-4.4.gpg --dearmor - - echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-4.4.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list - - sudo apt-get update - - sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev -install: - - npm config set prefer-offline false - - npm install -g codecov - - git clone --branch=master --depth 1 https://github.com/enactjs/cli ../cli - - pushd ../cli - - npm install - - npm link - - popd - - git clone --branch=develop --depth 1 https://github.com/enactjs/enact ../enact - - pushd ../enact - - npm install - - npm run lerna exec -- --ignore enact-sampler --concurrency 1 -- npm --no-package-lock install - - npm run lerna exec -- --ignore enact-sampler --concurrency 1 -- npm --no-package-lock link - - npm run interlink - - popd - - rm -fr node_modules/@enact - - npm install - - enact link -script: - - echo -e "\x1b\x5b35;1m*** Starting tests...\x1b\x5b0m" - - npm test -- --runInBand --coverage - - codecov - - echo -e "\x1b\x5b35;1m*** Tests complete\x1b\x5b0m" - - echo -e "\x1b\x5b35;1m*** Starting eslint...\x1b\x5b0m" - - npm run lint -- -- --report-unused-disable-directives --max-warnings 0 . - - echo -e "\x1b\x5b35;1m*** eslint complete\x1b\x5b0m" - - echo -e "\x1b\x5b35;1m*** Starting docs validation...\x1b\x5b0m" - - npm run validate-docs - - echo -e "\x1b\x5b35;1m*** Docs validation complete\x1b\x5b0m"