diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..d9bafab26d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,120 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + lint: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + node: [14] + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + cache: 'yarn' + + - name: Install dependencies + run: yarn --immutable + + - name: Lint + run: yarn lint + + test: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest, macos-latest] # TODO: add windows-latest by #408 + node: [14] + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + cache: 'yarn' + + - name: Install dependencies + run: yarn --immutable + + - name: Stub + run: yarn stub + + - name: Test (presets) + run: yarn test:presets + + test-compat: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest, macos-latest] # TODO: add windows-latest by #408 + node: [14] + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + cache: 'yarn' + cache-dependency-path: | + yarn.lock + test/fixtures/compat/yarn.lock + + - name: Install dependencies + run: yarn --immutable + + - name: Install dependencies (compat fixture) + run: yarn --immutable && cd test/fixtures/compat && yarn --immutable + + - name: Stub + run: yarn stub + + - name: Test (presets compat) + run: yarn test:compat + + build-release: + needs: + - test + - test-compat + - lint + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + node: [14] + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + cache: 'yarn' + + - name: Install dependencies + run: yarn --immutable + + - name: Build + run: yarn build + + - name: Release Edge + if: | + github.event_name == 'push' && + !contains(github.event.head_commit.message, '[skip-release]') && + !contains(github.event.head_commit.message, 'chore') && + !contains(github.event.head_commit.message, 'docs') + run: ./scripts/release-edge.sh + env: + NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}} diff --git a/.github/workflows/test-compat.yml b/.github/workflows/test-compat.yml deleted file mode 100644 index b3efc9479c..0000000000 --- a/.github/workflows/test-compat.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: test-compat - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - test-compat: - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest] - node: [14] - - steps: - - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node }} - - - name: checkout - uses: actions/checkout@master - - - uses: actions/cache@v2 - id: yarn-cache - with: - path: | - .yarn - test/fixtures/compat/.yarn - key: ${{ runner.os }}-yarn-compat-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn-compat- - - - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: yarn --immutable && cd test/fixtures/compat && yarn --immutable - - - name: Build - run: yarn build - - - name: Test - run: TEST_COMPAT=1 yarn test:presets diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index eba33409d6..0000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: test - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - test: - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest] - node: [14] - - steps: - - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node }} - - - name: checkout - uses: actions/checkout@master - - - uses: actions/cache@v2 - id: yarn-cache - with: - path: .yarn - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: yarn --immutable - - - name: Lint - run: yarn lint - - - name: Build - run: yarn build - - - name: Test - run: yarn test:presets - - - name: Release Edge - if: github.event_name == 'push' && !contains(github.event.head_commit.message, '[skip-release]') - run: ./scripts/release-edge.sh - env: - NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}} diff --git a/test/presets/_tests.mjs b/test/presets/_tests.mjs index 22209b8bbd..82746c0f21 100644 --- a/test/presets/_tests.mjs +++ b/test/presets/_tests.mjs @@ -1,4 +1,5 @@ import { resolve } from 'path' +import { pathToFileURL } from 'url' import destr from 'destr' import { listen } from 'listhen' import { $fetch } from 'ohmyfetch/node' @@ -9,7 +10,7 @@ import { fixtureDir, resolveWorkspace } from '../utils.mjs' const isCompat = Boolean(process.env.TEST_COMPAT) export function importModule (path) { - return import(path) + return import(pathToFileURL(path).href) } export function setupTest (preset) {