Skip to content

Commit

Permalink
build: migrate to pnpm (#772)
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 authored Aug 9, 2024
1 parent a078cfe commit 61ea0b4
Show file tree
Hide file tree
Showing 21 changed files with 14,256 additions and 20,130 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,36 @@ on:
- master

jobs:
build:
runs-on: ubuntu-20.04
build-real:
runs-on: ubuntu-24.04

strategy:
matrix:
node: [18, 20]
node: ['20', '22']
fail-fast: false

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
cache: 'pnpm'

- run: npm ci
- run: pnpm install --frozen-lockfile
- run: npm run build
- run: npm run start -- --help

build:
# so we do not need to update GitHub repo config
needs: build-real
runs-on: ubuntu-latest

strategy:
matrix:
node: ['18', '20']
fail-fast: false
steps:
- run: echo pass
25 changes: 19 additions & 6 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,36 @@ on:
- master

jobs:
check:
runs-on: ubuntu-20.04
check-real:
runs-on: ubuntu-24.04

strategy:
fail-fast: false
matrix:
node: [20]
node: ['22']
check: [check-source-formatting, check-types, lint]

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm
cache: 'pnpm'

- run: npm ci
- run: pnpm install --frozen-lockfile
- run: npm run ${{ matrix.check }}

check:
# so we do not need to update GitHub repo config
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ['20']
check: [check-source-formatting, check-types, lint]
needs:
- check-real
steps:
- run: echo ok
11 changes: 1 addition & 10 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

strategy:
fail-fast: false
Expand All @@ -27,15 +27,6 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/distribute-archlinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
aur:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/distribute-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,22 @@ on:

jobs:
flood-bin:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

strategy:
matrix:
node: [20]
node: ['22']

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
registry-url: 'https://registry.npmjs.org'
cache: npm
cache: 'pnpm'

- name: Set up QEMU
run: |
Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/publish-rolling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,25 @@ on:

jobs:
npm:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

strategy:
matrix:
node: [20]
node: ['22']

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
registry-url: 'https://registry.npmjs.org'
cache: npm
cache: pnpm

- run: npm ci
- run: pnpm install --frozen-lockfile

- name: Tag rolling release
id: tag_release
Expand Down Expand Up @@ -64,7 +66,7 @@ jobs:

docker:
needs: npm
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -115,11 +117,11 @@ jobs:
RTORRENT_VERSION=master
docker-dbg:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

strategy:
matrix:
node: [20]
node: ['22']

steps:
- uses: actions/checkout@v4
Expand All @@ -129,7 +131,7 @@ jobs:
with:
node-version: ${{ matrix.node }}
registry-url: 'https://registry.npmjs.org'
cache: npm
cache: 'pnpm'

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down Expand Up @@ -171,11 +173,11 @@ jobs:

pkg:
needs: npm
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

strategy:
matrix:
node: [20]
node: ['22']

steps:
- name: Use Node.js ${{ matrix.node }}
Expand Down Expand Up @@ -256,7 +258,7 @@ jobs:

docker-distroless:
needs: pkg
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
release:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

strategy:
matrix:
Expand All @@ -16,15 +16,17 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
node-version: ${{ matrix.node + 2 }}
registry-url: 'https://registry.npmjs.org'
cache: npm
cache: 'pnpm'

- run: sudo npm i -g pkg
- run: npm ci
- run: pnpm install --frozen-lockfile

- run: npm publish --access public
env:
Expand Down Expand Up @@ -70,7 +72,7 @@ jobs:
release-docker:
needs: release
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

Expand Down
22 changes: 18 additions & 4 deletions .github/workflows/test-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,23 @@ on:
- master

jobs:
test-backend:
test-backend-real:
runs-on: ubuntu-22.04

strategy:
matrix:
node: ['18', '20']
node: ['20', '22']
fail-fast: false

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4

- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm
cache: 'pnpm'

- run: sudo add-apt-repository -y ppa:qbittorrent-team/qbittorrent-stable
- run: sudo add-apt-repository -y ppa:transmissionbt/ppa
Expand All @@ -34,7 +35,7 @@ jobs:
wget https://github.com/jesec/rtorrent/releases/latest/download/rtorrent-linux-amd64.deb
sudo dpkg -i rtorrent-linux-amd64.deb
- run: npm ci
- run: pnpm install --frozen-lockfile
- run: npm test || npm test || npm test

- uses: codecov/codecov-action@v3
Expand All @@ -46,3 +47,16 @@ jobs:
- run: npm test -- --selectProjects rtorrent || npm test -- --selectProjects rtorrent || npm test -- --selectProjects rtorrent
if: matrix['node'] == '20'

test-backend:
# so we do not need to update GitHub repo config
runs-on: ubuntu-latest
needs:
- test-backend-real
strategy:
matrix:
node: ['18', '20']
fail-fast: false

steps:
- run: echo pass
2 changes: 1 addition & 1 deletion .github/workflows/translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
synchronize-with-crowdin:
if: github.repository_owner == 'jesec'
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ dist-pkg/

# Coverage reports
coverage/
pnpm-lock.yaml
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ WORKDIR /usr/src/app/
COPY . ./

# Fetch dependencies from npm
RUN npm ci --legacy-peer-deps
RUN pnpm install --frozen-lockfile --legacy-peer-deps

# Build assets
RUN npm run build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {FC, lazy, Suspense} from 'react';
import {ComponentType, FC, lazy, Suspense} from 'react';

import packageJSON from '../../../../../../package.json';

const AboutMarkdown = lazy(() =>
const AboutMarkdown = lazy<ComponentType<{FloodVersion: unknown; CommitBadge: unknown}>>(() =>
import(/* webpackChunkName: 'about' */ '../../../../ABOUT.md').then((module) => ({default: module.react})),
);

Expand Down
3 changes: 2 additions & 1 deletion client/src/javascript/components/sidebar/LogoutButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {ClassNamesArg, cx} from '@emotion/css';
import {cx} from '@emotion/css';
import {FC} from 'react';
import {useLingui} from '@lingui/react';
import {ClassNamesArg} from '@emotion/react';

import AuthActions from '@client/actions/AuthActions';
import ConfigStore from '@client/stores/ConfigStore';
Expand Down
2 changes: 1 addition & 1 deletion distribution/containers/Dockerfile.release
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use node alpine docker image
FROM docker.io/node:alpine
FROM docker.io/node:22-alpine

ARG PACKAGE=flood
ARG VERSION=latest
Expand Down
Loading

0 comments on commit 61ea0b4

Please sign in to comment.