Skip to content

Commit

Permalink
ci: define node version once and use it everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
alichtman committed Feb 10, 2025
1 parent 28c09ea commit 92d700a
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 19 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ on:
required: false
default: false

env:
NODE_VERSION: '22.x'

jobs:
config:
uses: ./.github/workflows/shared-config.yml

build-mac-and-windows:
needs: [config]
runs-on: macos-latest
strategy:
matrix:
Expand All @@ -29,7 +30,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version: ${{ needs.config.outputs.node-version }}
cache: 'npm'

- name: Install dependencies
Expand All @@ -48,13 +49,14 @@ jobs:

build-linux-appimage:
runs-on: ubuntu-latest
needs: [config]
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version: ${{ needs.config.outputs.node-version }}
cache: 'npm'

- name: Install dependencies
Expand All @@ -74,6 +76,7 @@ jobs:

build-linux-flatpak:
runs-on: ubuntu-latest
needs: [config]
container:
image: bilelmoussaoui/flatpak-github-actions:kde-6.5
options: --privileged
Expand All @@ -86,7 +89,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
node-version: ${{ needs.config.outputs.node-version }}
cache: 'npm'

- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ on:
branches: ['main']
pull_request:
branches: ['main']
schedule:
- cron: '40 23 * * 3'
# schedule:
# - cron: '40 23 * * 3'

jobs:
analyze:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/flatpak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ on:
default: false

jobs:
config:
uses: ./.github/workflows/shared-config.yml

flatpak:
runs-on: ubuntu-latest
needs: [config]
container:
image: bilelmoussaoui/flatpak-github-actions:freedesktop-23.08
options: --privileged
Expand All @@ -24,7 +28,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '21.x'
node-version: ${{ needs.config.outputs.node-version }}
cache: 'npm'

- name: Install dependencies
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/linux-appimage-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: AppImage Build (Testing)

on:
Expand All @@ -10,19 +9,20 @@ on:
required: false
default: false

env:
NODE_VERSION: '22.x'

jobs:
config:
uses: ./.github/workflows/shared-config.yml

build-linux-appimage:
runs-on: ubuntu-latest
needs: [config]
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version: ${{ needs.config.outputs.node-version }}
cache: 'npm'

- name: Install dependencies
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/shared-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Shared Configuration

on:
workflow_call:
outputs:
node-version:
description: 'Node.js version to use'
value: '22.x'

jobs:
noop:
runs-on: ubuntu-latest
steps: []
12 changes: 7 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
# We should really have some tests!
name: Test

on:
workflow_dispatch
on: workflow_dispatch

jobs:
config:
uses: ./.github/workflows/shared-config.yml

test:
runs-on: ${{ matrix.os }}

needs: [config]
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
Expand All @@ -20,7 +22,7 @@ jobs:
- name: Install Node.js and NPM
uses: actions/setup-node@v4
with:
node-version: 22
node-version: ${{ needs.config.outputs.node-version }}
cache: npm

- name: npm install
Expand All @@ -31,7 +33,7 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run package
npm run build
npm run lint
npm exec tsc
npm test

0 comments on commit 92d700a

Please sign in to comment.