ci: organize and speed up workflows (#215)

* ci: organize and speed up workflows

Reduced `ci.yml` costs and carbon emissions by using only one `job`

---

Part of the https://github.com/Cambridge-ICCS/green-ci initiative 🍃

* remove emojis

* chore: update pnpm name and yaml array syntax

---------

Co-authored-by: Johann Schopplich <mail@johannschopplich.com>
This commit is contained in:
Okinea Dev
2025-11-24 09:42:30 +01:00
committed by GitHub
parent 11a089bb86
commit 103e357def
3 changed files with 78 additions and 78 deletions

View File

@@ -9,78 +9,50 @@ on:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
lint:
ci:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v5
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 1
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Get pnpm store directory
id: pnpm-cache
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- run: pnpm install --frozen-lockfile
- run: pnpm run lint
persist-credentials: false
typecheck:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 1
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Get pnpm store directory
id: pnpm-cache
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- run: pnpm install --frozen-lockfile
- run: pnpm run test:types
- name: Setup pnpm
uses: pnpm/action-setup@v4
test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 1
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
- name: Get pnpm store directory
id: pnpm-cache
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
- name: Cache pnpm dependencies
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- run: pnpm install --frozen-lockfile
- run: pnpm run test
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm run lint
- name: Typecheck
run: pnpm run test:types
- name: Test
run: pnpm run test