From 91dba898338e778d36741f52858658526c845fc7 Mon Sep 17 00:00:00 2001 From: "Fred K. Schott" Date: Thu, 22 Jul 2021 08:51:07 -0700 Subject: [PATCH] improve ci (#802) --- .github/workflows/ci.yml | 99 +++++++++++++++++++ .github/workflows/nodejs.yml | 90 ----------------- .../workflows/{changelog.yml => release.yml} | 24 +++-- 3 files changed, 113 insertions(+), 100 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/nodejs.yml rename .github/workflows/{changelog.yml => release.yml} (52%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..cd8aabeddd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,99 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + paths-ignore: + - '.vscode/**' + - 'docs/**' + - 'examples/**' + - 'www/**' + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + node_version: [12, 14, 16] + include: + - os: windows-latest + node_version: 14 + fail-fast: false + + name: "Test: node-${{ matrix.node_version }}, ${{ matrix.os }}" + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set node version to ${{ matrix.node_version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node_version }} + + - name: Get yarn cache directory + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Set dependencies cache + uses: actions/cache@v2 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('yarn.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('yarn.lock') }} + ${{ runner.os }}-${{ matrix.node_version }}- + + - name: Debug + run: yarn versions + + - name: Install dependencies + run: yarn install --frozen-lockfile --ignore-engines + + - name: Build + run: yarn build:all + + - name: Test + run: yarn test + + lint: + runs-on: ubuntu-latest + name: "Lint: node-14, ubuntu-latest" + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set node version to 14 + uses: actions/setup-node@v2 + with: + node-version: 14 + + - name: Get yarn cache directory + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Set dependencies cache + uses: actions/cache@v2 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('yarn.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('yarn.lock') }} + ${{ runner.os }}-${{ matrix.node_version }}- + + - name: Debug + run: yarn versions + + - name: Install dependencies + run: yarn install --frozen-lockfile --ignore-engines + + - name: Build + run: yarn build:all + + - name: Lint + run: yarn lint + # linting is currently not passing, so just do this for inline for now + continue-on-error: true \ No newline at end of file diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml deleted file mode 100644 index 7aefe0cc53..0000000000 --- a/.github/workflows/nodejs.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: Node CI - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - skip_run: - continue-on-error: true - runs-on: ubuntu-latest - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@master - with: - concurrent_skipping: 'never' - skip_after_successful_duplicate: 'true' - paths_ignore: '["README.md", "**/README.md", "docs/**"]' - do_not_skip: '["workflow_dispatch", "schedule"]' - changeset: - needs: skip_run # allow skip_run to cancel this job if it’s not needed - if: ${{ needs.skip_run.outputs.should_skip != 'true' }} - name: Ensure changeset - runs-on: ubuntu-latest - steps: - - name: Check out PR branch - uses: actions/checkout@v2 - - - name: Check out main branch - uses: actions/checkout@v2 - with: - ref: main - - - name: Set up Node.js 14.x - uses: actions/setup-node@v2 - with: - node-version: 14.x - - - name: Install dependencies - run: yarn --frozen-lockfile --ignore-engines - env: - CI: true - - - run: yarn changeset status --since=main - test: - needs: skip_run # allow skip_run to cancel this job if it’s not needed - if: ${{ needs.skip_run.outputs.should_skip != 'true' }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest] - node-version: [12.x, 14.x, 16.x] - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - - run: yarn --frozen-lockfile --ignore-engines - env: - CI: true - - run: yarn build - env: - CI: true - - run: yarn test - env: - CI: true - # test-templates: - # if: ${{ github.head_ref }} == "changeset-release/main" # only run on version PRs (this test is too slow to run every PR) - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - uses: actions/setup-node@v2 - # with: - # node-version: 14.x - # - run: yarn --frozen-lockfile --ignore-engines - # env: - # CI: true - # - run: yarn build - # env: - # CI: true - # - run: yarn test:templates - # env: - # GITHUB_SHA: $GITHUB_SHA - # CI: true diff --git a/.github/workflows/changelog.yml b/.github/workflows/release.yml similarity index 52% rename from .github/workflows/changelog.yml rename to .github/workflows/release.yml index fb3c480c80..d690431001 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/release.yml @@ -2,12 +2,8 @@ name: Changelog on: push: - paths-ignore: - - '.vscode/**' - - 'assets/**' - - 'docs/**' - - 'examples/**' - - 'www/**' + paths: + - '.changeset/**' branches: - main @@ -26,10 +22,18 @@ jobs: with: node-version: 14.x - - name: Install dependencies - run: yarn --frozen-lockfile --ignore-engines - env: - CI: true + - name: Get yarn cache directory + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Set dependencies cache + uses: actions/cache@v2 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('yarn.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('yarn.lock') }} + ${{ runner.os }}-${{ matrix.node_version }}- - name: Create release PR uses: changesets/action@master