From 49bde5a54a7bf071f2630305e4786f0e6038bd78 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Sat, 25 Mar 2023 22:01:00 +0100 Subject: [PATCH] chore: rename e2e to itg tests Signed-off-by: CrazyMax --- .github/workflows/e2e.yml | 84 ------------------- .github/workflows/test.yml | 74 ++++++++++++++++ README.md | 1 - .../{bake.test.e2e.ts => bake.test.itg.ts} | 0 ...nstall.test.e2e.ts => install.test.itg.ts} | 0 dev.Dockerfile | 2 +- jest.config.e2e.ts => jest.config.itg.ts | 2 +- package.json | 8 +- 8 files changed, 80 insertions(+), 91 deletions(-) delete mode 100644 .github/workflows/e2e.yml rename __tests__/buildx/{bake.test.e2e.ts => bake.test.itg.ts} (100%) rename __tests__/docker/{install.test.e2e.ts => install.test.itg.ts} (100%) rename jest.config.e2e.ts => jest.config.itg.ts (96%) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml deleted file mode 100644 index 87f483a..0000000 --- a/.github/workflows/e2e.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: e2e - -on: - workflow_dispatch: - push: - branches: - - 'main' - pull_request: - paths-ignore: - - '.github/*-releases.json' - -jobs: - prepare: - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.tests.outputs.matrix }} - steps: - - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 16 - cache: 'yarn' - - - name: Install - run: yarn install - - - name: Create matrix - id: tests - run: | - declare -a tests - for test in $(yarn run test:e2e-list); do - tests+=("${test#$(pwd)/__tests__/}") - done - echo "matrix=$(echo ${tests[@]} | jq -cR 'split(" ")')" >>${GITHUB_OUTPUT} - - - name: Show matrix - run: | - echo ${{ steps.tests.outputs.matrix }} - - test: - runs-on: ${{ matrix.os }} - needs: - - prepare - strategy: - fail-fast: false - matrix: - test: ${{ fromJson(needs.prepare.outputs.matrix) }} - os: - - ubuntu-latest - - macos-latest - - windows-latest - exclude: - - os: macos-latest - test: buildx/bake.test.e2e.ts - - os: windows-latest - test: buildx/bake.test.e2e.ts - steps: - - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 16 - cache: 'yarn' - - - name: Install - run: yarn install - - - name: Test - run: yarn test-coverage:e2e --runTestsByPath __tests__/${{ matrix.test }} --coverageDirectory=./coverage - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Upload coverage - uses: codecov/codecov-action@v3 - with: - file: ./coverage/clover.xml - flags: e2e diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 401f84f..01eb4fe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,7 @@ name: test on: + workflow_dispatch: push: branches: - 'main' @@ -47,3 +48,76 @@ jobs: with: file: ./coverage/clover.xml flags: unit + + prepare-itg: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.tests.outputs.matrix }} + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 16 + cache: 'yarn' + - + name: Install + run: yarn install + - + name: Create matrix + id: tests + run: | + declare -a tests + for test in $(yarn run test:itg-list); do + tests+=("${test#$(pwd)/__tests__/}") + done + echo "matrix=$(echo ${tests[@]} | jq -cR 'split(" ")')" >>${GITHUB_OUTPUT} + - + name: Show matrix + run: | + echo ${{ steps.tests.outputs.matrix }} + + test-itg: + runs-on: ${{ matrix.os }} + needs: + - prepare-itg + strategy: + fail-fast: false + matrix: + test: ${{ fromJson(needs.prepare-itg.outputs.matrix) }} + os: + - ubuntu-latest + - macos-latest + - windows-latest + exclude: + - os: macos-latest + test: buildx/bake.test.itg.ts + - os: windows-latest + test: buildx/bake.test.itg.ts + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 16 + cache: 'yarn' + - + name: Install + run: yarn install + - + name: Test + run: yarn test:itg-coverage --runTestsByPath __tests__/${{ matrix.test }} --coverageDirectory=./coverage + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - + name: Upload coverage + uses: codecov/codecov-action@v3 + with: + file: ./coverage/clover.xml + flags: itg diff --git a/README.md b/README.md index dabd51e..c1d3a58 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ [![Downloads](https://img.shields.io/npm/dw/@docker/actions-toolkit?logo=npm&style=flat-square)](https://www.npmjs.com/package/@docker/actions-toolkit) [![Build workflow](https://img.shields.io/github/actions/workflow/status/docker/actions-toolkit/build.yml?label=build&logo=github&style=flat-square)](https://github.com/docker/actions-toolkit/actions?workflow=build) [![Test workflow](https://img.shields.io/github/actions/workflow/status/docker/actions-toolkit/test.yml?label=test&logo=github&style=flat-square)](https://github.com/docker/actions-toolkit/actions?workflow=test) -[![E2E workflow](https://img.shields.io/github/actions/workflow/status/docker/actions-toolkit/e2e.yml?label=e2e&logo=github&style=flat-square)](https://github.com/docker/actions-toolkit/actions?workflow=e2e) [![Codecov](https://img.shields.io/codecov/c/github/docker/actions-toolkit?logo=codecov&style=flat-square)](https://codecov.io/gh/docker/actions-toolkit) # Actions Toolkit diff --git a/__tests__/buildx/bake.test.e2e.ts b/__tests__/buildx/bake.test.itg.ts similarity index 100% rename from __tests__/buildx/bake.test.e2e.ts rename to __tests__/buildx/bake.test.itg.ts diff --git a/__tests__/docker/install.test.e2e.ts b/__tests__/docker/install.test.itg.ts similarity index 100% rename from __tests__/docker/install.test.e2e.ts rename to __tests__/docker/install.test.itg.ts diff --git a/dev.Dockerfile b/dev.Dockerfile index 6231f4f..61ed02a 100644 --- a/dev.Dockerfile +++ b/dev.Dockerfile @@ -79,7 +79,7 @@ RUN --mount=type=bind,target=.,rw \ --mount=type=bind,from=buildx,source=/buildx,target=/usr/libexec/docker/cli-plugins/docker-buildx \ --mount=type=bind,from=buildx,source=/buildx,target=/usr/bin/buildx \ --mount=type=secret,id=GITHUB_TOKEN \ - GITHUB_TOKEN=$(cat /run/secrets/GITHUB_TOKEN) yarn run test-coverage --coverageDirectory=/tmp/coverage + GITHUB_TOKEN=$(cat /run/secrets/GITHUB_TOKEN) yarn run test:coverage --coverageDirectory=/tmp/coverage FROM scratch AS test-coverage COPY --from=test /tmp/coverage / diff --git a/jest.config.e2e.ts b/jest.config.itg.ts similarity index 96% rename from jest.config.e2e.ts rename to jest.config.itg.ts index d2656db..b09d6e7 100644 --- a/jest.config.e2e.ts +++ b/jest.config.itg.ts @@ -19,7 +19,7 @@ module.exports = { testEnvironment: 'node', moduleFileExtensions: ['js', 'ts'], setupFiles: ['dotenv/config'], - testMatch: ['**/*.test.e2e.ts'], + testMatch: ['**/*.test.itg.ts'], testTimeout: 1800000, // 30 minutes transform: { '^.+\\.ts$': 'ts-jest' diff --git a/package.json b/package.json index e8cb07f..0fedb02 100644 --- a/package.json +++ b/package.json @@ -11,10 +11,10 @@ "prettier": "prettier --check \"./**/*.ts\"", "prettier:fix": "prettier --write \"./**/*.ts\"", "test": "jest", - "test:e2e": "jest -c jest.config.e2e.ts --runInBand --detectOpenHandles", - "test:e2e-list": "jest -c jest.config.e2e.ts --listTests", - "test-coverage": "jest --coverage", - "test-coverage:e2e": "jest --coverage -c jest.config.e2e.ts --runInBand --detectOpenHandles" + "test:coverage": "jest --coverage", + "test:itg": "jest -c jest.config.itg.ts --runInBand --detectOpenHandles", + "test:itg-list": "jest -c jest.config.itg.ts --listTests", + "test:itg-coverage": "jest --coverage -c jest.config.itg.ts --runInBand --detectOpenHandles" }, "repository": { "type": "git",