From d70560f6aa189cb0dbbc7be889c6c4e6b3a36f76 Mon Sep 17 00:00:00 2001 From: Daniel Bate Date: Thu, 2 Nov 2023 10:30:05 +0000 Subject: [PATCH] feat: introduce test setup action (#1389) * feat: introduce test setup composite action * chore: changeset * feat: use correct test setup action in test workflow * feat: rename test setup action stage * chore: empty changeset --- .changeset/young-dots-knock.md | 2 ++ .github/actions/ci-setup/action.yaml | 2 +- .github/actions/test-setup/action.yaml | 34 ++++++++++++++++++++++++++ .github/workflows/test.yaml | 10 ++------ 4 files changed, 39 insertions(+), 9 deletions(-) create mode 100644 .changeset/young-dots-knock.md create mode 100644 .github/actions/test-setup/action.yaml diff --git a/.changeset/young-dots-knock.md b/.changeset/young-dots-knock.md new file mode 100644 index 00000000000..a49ba48448f --- /dev/null +++ b/.changeset/young-dots-knock.md @@ -0,0 +1,2 @@ +--- +--- \ No newline at end of file diff --git a/.github/actions/ci-setup/action.yaml b/.github/actions/ci-setup/action.yaml index 503ae5c9af0..d7238b669aa 100644 --- a/.github/actions/ci-setup/action.yaml +++ b/.github/actions/ci-setup/action.yaml @@ -1,4 +1,4 @@ -name: "CI setup" +name: "CI Setup" inputs: node-version: description: "Node version" diff --git a/.github/actions/test-setup/action.yaml b/.github/actions/test-setup/action.yaml new file mode 100644 index 00000000000..b37f3e33084 --- /dev/null +++ b/.github/actions/test-setup/action.yaml @@ -0,0 +1,34 @@ +name: "Test Setup" +inputs: + node-version: + description: "Node version" + default: 18.14.1 + pnpm-version: + description: "PNPM version" + default: 8.9.0 +runs: + using: "composite" + steps: + - name: Cache PNPM modules + uses: actions/cache@v3 + with: + path: ~/.local/share/pnpm/store/v4 + key: ${{ runner.os }}-node-${{ inputs.node-version }}-pnpm-${{ inputs.pnpm-version }}-lock-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: ${{ inputs.node-version }} + registry-url: "https://registry.npmjs.org" + + - name: Setup PNPM + uses: pnpm/action-setup@v2.1.0 + with: + version: ${{ inputs.pnpm-version }} + run_install: true + + - name: Build + run: pnpm build + shell: bash \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bf1111e10db..4feb422465a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -23,14 +23,11 @@ jobs: uses: actions/checkout@v3 - name: CI Setup - uses: ./.github/actions/ci-setup + uses: ./.github/actions/test-setup - name: Forc Format Check run: pnpm forc:check - - name: Build - run: pnpm build - # linting of some tests depends on pretest being run so that it generates the necessary files - name: Pretest run: pnpm pretest @@ -83,10 +80,7 @@ jobs: fetch-depth: 0 - name: CI Setup - uses: ./.github/actions/ci-setup - - - name: Build - run: pnpm build + uses: ./.github/actions/test-setup - name: Pretest run: pnpm pretest