From 3262b82ffa29efe907f3daf099a40780c07ceded Mon Sep 17 00:00:00 2001 From: Bert De Block Date: Fri, 11 Aug 2023 13:26:28 +0200 Subject: [PATCH] Make sure `node-version` is always specified in the GitHub CI file --- files/.github/workflows/ci.yml | 18 ++--- .../fixtures/default/.github/workflows/ci.yml | 74 +++++++++++++++++++ tests/fixtures/pnpm/.github/workflows/ci.yml | 65 ++++++++++++++++ tests/fixtures/yarn/.github/workflows/ci.yml | 74 +++++++++++++++++++ tests/smoke-tests/defaults.test.ts | 9 +++ 5 files changed, 228 insertions(+), 12 deletions(-) create mode 100644 tests/fixtures/default/.github/workflows/ci.yml create mode 100644 tests/fixtures/pnpm/.github/workflows/ci.yml create mode 100644 tests/fixtures/yarn/.github/workflows/ci.yml diff --git a/files/.github/workflows/ci.yml b/files/.github/workflows/ci.yml index b316e7f2..74cd813f 100644 --- a/files/.github/workflows/ci.yml +++ b/files/.github/workflows/ci.yml @@ -18,11 +18,9 @@ jobs: steps: - uses: actions/checkout@v3 - <% if (pnpm) {%>- uses: wyvox/action-setup-pnpm@v2 - <% } else { %>- name: Install Node - uses: actions/setup-node@v3 + - uses: <%= pnpm ? 'wyvox/action-setup-pnpm@v2' : 'actions/setup-node@v3' %> with: - node-version: 16.x + node-version: 16<% if (!pnpm) { %> cache: <%= yarn ? 'yarn' : 'npm' %> - name: Install Dependencies run: <%= yarn ? 'yarn install --frozen-lockfile' : 'npm ci' %><%}%> @@ -37,11 +35,9 @@ jobs: steps: - uses: actions/checkout@v3 - <% if (pnpm) {%>- uses: wyvox/action-setup-pnpm@v2 - <% } else { %>- name: Install Node - uses: actions/setup-node@v3 + - uses: <%= pnpm ? 'wyvox/action-setup-pnpm@v2' : 'actions/setup-node@v3' %> with: - node-version: 16.x + node-version: 16<% if (!pnpm) { %> cache: <%= yarn ? 'yarn' : 'npm' %> - name: Install Dependencies run: <%= yarn ? 'yarn install --frozen-lockfile' : 'npm ci' %><%}%> @@ -67,11 +63,9 @@ jobs: steps: - uses: actions/checkout@v3 - <% if (pnpm) {%>- uses: wyvox/action-setup-pnpm@v2 - <% } else { %>- name: Install Node - uses: actions/setup-node@v3 + - uses: <%= pnpm ? 'wyvox/action-setup-pnpm@v2' : 'actions/setup-node@v3' %> with: - node-version: 16.x + node-version: 16<% if (!pnpm) { %> cache: <%= yarn ? 'yarn' : 'npm' %> - name: Install Dependencies run: <%= yarn ? 'yarn install --frozen-lockfile' : 'npm ci' %><%}%> diff --git a/tests/fixtures/default/.github/workflows/ci.yml b/tests/fixtures/default/.github/workflows/ci.yml new file mode 100644 index 00000000..e0f67013 --- /dev/null +++ b/tests/fixtures/default/.github/workflows/ci.yml @@ -0,0 +1,74 @@ +name: CI + +on: + push: + branches: + - main + - master + pull_request: {} + +concurrency: + group: ci-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + test: + name: "Tests" + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: npm + - name: Install Dependencies + run: npm ci + - name: Lint + run: npm run lint + - name: Run Tests + run: npm run test + + floating: + name: "Floating Dependencies" + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: npm + - name: Install Dependencies + run: npm ci + - name: Run Tests + run: npm run test + + try-scenarios: + name: ${{ matrix.try-scenario }} + runs-on: ubuntu-latest + needs: 'test' + + strategy: + fail-fast: false + matrix: + try-scenario: + - ember-lts-4.8 + - ember-lts-4.12 + - ember-release + - ember-beta + - ember-canary + - embroider-safe + - embroider-optimized + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: npm + - name: Install Dependencies + run: npm ci + - name: Run Tests + run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }} + working-directory: test-app diff --git a/tests/fixtures/pnpm/.github/workflows/ci.yml b/tests/fixtures/pnpm/.github/workflows/ci.yml new file mode 100644 index 00000000..2a18bc47 --- /dev/null +++ b/tests/fixtures/pnpm/.github/workflows/ci.yml @@ -0,0 +1,65 @@ +name: CI + +on: + push: + branches: + - main + - master + pull_request: {} + +concurrency: + group: ci-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + test: + name: "Tests" + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: wyvox/action-setup-pnpm@v2 + with: + node-version: 16 + - name: Lint + run: pnpm lint + - name: Run Tests + run: pnpm test + + floating: + name: "Floating Dependencies" + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: wyvox/action-setup-pnpm@v2 + with: + node-version: 16 + - name: Run Tests + run: pnpm test + + try-scenarios: + name: ${{ matrix.try-scenario }} + runs-on: ubuntu-latest + needs: 'test' + + strategy: + fail-fast: false + matrix: + try-scenario: + - ember-lts-4.8 + - ember-lts-4.12 + - ember-release + - ember-beta + - ember-canary + - embroider-safe + - embroider-optimized + + steps: + - uses: actions/checkout@v3 + - uses: wyvox/action-setup-pnpm@v2 + with: + node-version: 16 + - name: Run Tests + run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }} + working-directory: test-app diff --git a/tests/fixtures/yarn/.github/workflows/ci.yml b/tests/fixtures/yarn/.github/workflows/ci.yml new file mode 100644 index 00000000..7dbcfdf5 --- /dev/null +++ b/tests/fixtures/yarn/.github/workflows/ci.yml @@ -0,0 +1,74 @@ +name: CI + +on: + push: + branches: + - main + - master + pull_request: {} + +concurrency: + group: ci-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + test: + name: "Tests" + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: yarn + - name: Install Dependencies + run: yarn install --frozen-lockfile + - name: Lint + run: yarn lint + - name: Run Tests + run: yarn test + + floating: + name: "Floating Dependencies" + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: yarn + - name: Install Dependencies + run: yarn install --frozen-lockfile + - name: Run Tests + run: yarn test + + try-scenarios: + name: ${{ matrix.try-scenario }} + runs-on: ubuntu-latest + needs: 'test' + + strategy: + fail-fast: false + matrix: + try-scenario: + - ember-lts-4.8 + - ember-lts-4.12 + - ember-release + - ember-beta + - ember-canary + - embroider-safe + - embroider-optimized + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: yarn + - name: Install Dependencies + run: yarn install --frozen-lockfile + - name: Run Tests + run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }} + working-directory: test-app diff --git a/tests/smoke-tests/defaults.test.ts b/tests/smoke-tests/defaults.test.ts index c1216158..57fe3d7c 100644 --- a/tests/smoke-tests/defaults.test.ts +++ b/tests/smoke-tests/defaults.test.ts @@ -37,6 +37,7 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) { expect(await fse.pathExists(yarn), 'yarn.lock does not exist').toBe(false); expect(await fse.pathExists(pnpm), 'pnpm-lock.yaml does not exist').toBe(false); + await matchesFixture('.github/workflows/ci.yml', { cwd: helper.projectRoot }); await matchesFixture('.github/workflows/push-dist.yml', { cwd: helper.projectRoot }); break; @@ -46,6 +47,10 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) { expect(await fse.pathExists(npm), 'package-lock.json does not exist').toBe(false); expect(await fse.pathExists(pnpm), 'pnpm-lock.yaml does not exist').toBe(false); + await matchesFixture('.github/workflows/ci.yml', { + cwd: helper.projectRoot, + scenario: 'yarn', + }); await matchesFixture('.github/workflows/push-dist.yml', { cwd: helper.projectRoot, scenario: 'yarn', @@ -58,6 +63,10 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) { expect(await fse.pathExists(npm), 'package-lock.json does not exist').toBe(false); expect(await fse.pathExists(yarn), 'yarn.lock does not exist').toBe(false); + await matchesFixture('.github/workflows/ci.yml', { + cwd: helper.projectRoot, + scenario: 'pnpm', + }); await matchesFixture('.github/workflows/push-dist.yml', { cwd: helper.projectRoot, scenario: 'pnpm',