From d20b70ddc2189f693d0efe479048fff9d24dbf58 Mon Sep 17 00:00:00 2001 From: Marius Tobiassen Bungum Date: Tue, 17 Dec 2024 09:36:47 +0100 Subject: [PATCH] :construction_worker: Update actions to use bun --- .github/workflows/build.yaml | 13 +++++------ .github/workflows/build_storybook.yaml | 21 ++++++++++------- .github/workflows/code_coverage.yaml | 31 +++++++++++++++++--------- .github/workflows/eslint.yaml | 18 +++++++++++++++ .github/workflows/lint.yaml | 21 ----------------- .github/workflows/npm_publish.yaml | 13 ++++++----- .github/workflows/pull_request.yaml | 6 ++--- .github/workflows/test.yaml | 15 +++++-------- 8 files changed, 73 insertions(+), 65 deletions(-) create mode 100644 .github/workflows/eslint.yaml delete mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8680c49..2f4b0f6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -5,17 +5,14 @@ jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [21.x] - steps: - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + + - name: Use bun + uses: oven-sh/setup-bun@v2 - name: Install dependencies - run: npm ci + run: bun install --frozen-lockfile - name: Build - run: npm run build + run: bun run build diff --git a/.github/workflows/build_storybook.yaml b/.github/workflows/build_storybook.yaml index 09282c6..743e64d 100644 --- a/.github/workflows/build_storybook.yaml +++ b/.github/workflows/build_storybook.yaml @@ -5,17 +5,22 @@ jobs: build-storybook: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [21.x] - steps: - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + + - name: Use bun + uses: oven-sh/setup-bun@v2 - name: Install dependencies - run: npm ci + run: bun install --frozen-lockfile - name: Build - run: npm run build-storybook + run: bun run build-storybook + + build-storybook-with-docker: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Build the docker image + run: docker build . --file Dockerfile diff --git a/.github/workflows/code_coverage.yaml b/.github/workflows/code_coverage.yaml index 4d909f2..5013bd1 100644 --- a/.github/workflows/code_coverage.yaml +++ b/.github/workflows/code_coverage.yaml @@ -1,21 +1,32 @@ -name: Test +name: "Coverage" + on: workflow_call: + jobs: - code-coverage: + coverage: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [21.x] + permissions: + # Required to checkout the code + contents: read + # Required to put a comment into the pull-request + pull-requests: write steps: - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + + - name: Use bun + uses: oven-sh/setup-bun@v2 - name: Install dependencies - run: npm ci + run: bun install --frozen-lockfile + + - name: "Check coverage" + run: bun run test:coverage-ci - - name: Unit tests - run: npm run test:coverage + - name: 'Report Coverage' + # Set if: always() to also generate the report if tests are failing + # Only works if you set `reportOnFailure: true` in your vite config as specified above + if: always() + uses: davelosert/vitest-coverage-report-action@v2 \ No newline at end of file diff --git a/.github/workflows/eslint.yaml b/.github/workflows/eslint.yaml new file mode 100644 index 0000000..19fb0a9 --- /dev/null +++ b/.github/workflows/eslint.yaml @@ -0,0 +1,18 @@ +name: ESLint +on: + workflow_call: +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Use bun + uses: oven-sh/setup-bun@v2 + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Linting + run: bun run lint diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml deleted file mode 100644 index 09e9e1e..0000000 --- a/.github/workflows/lint.yaml +++ /dev/null @@ -1,21 +0,0 @@ -name: Lint -on: - workflow_call: -jobs: - lint: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [21.x] - - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - - - name: Install dependencies - run: npm ci - - - name: Linting - run: npm run lint diff --git a/.github/workflows/npm_publish.yaml b/.github/workflows/npm_publish.yaml index 5e4c3cc..94881b5 100644 --- a/.github/workflows/npm_publish.yaml +++ b/.github/workflows/npm_publish.yaml @@ -9,20 +9,21 @@ permissions: jobs: publish: runs-on: ubuntu-latest + steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 21.x + + - name: Use bun + uses: oven-sh/setup-bun@v2 - name: Install dependencies - run: npm ci + run: bun install --frozen-lockfile - name: Run Tests - run: npm run test:ci + run: bun run test:ci - name: Build Components - run: npm run build + run: bun run build-components - uses: JS-DevTools/npm-publish@v3 with: diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 4da7a17..8c6f9be 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -8,9 +8,9 @@ on: - ".github/workflows/**" workflow_dispatch: jobs: - lint: - name: Lint - uses: ./.github/workflows/lint.yaml + eslint: + name: ESLint + uses: ./.github/workflows/eslint.yaml test: name: Test diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6b4dfbb..b1bf303 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -5,17 +5,14 @@ jobs: test: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [21.x] - steps: - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + + - name: Use bun + uses: oven-sh/setup-bun@v2 - name: Install dependencies - run: npm ci + run: bun install --frozen-lockfile - - name: Unit tests - run: npm run test:ci + - name: Tests + run: bun run test:ci