Skip to content

Commit

Permalink
ci: add workflows for legacy v5 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine committed Sep 11, 2024
1 parent 40abcf5 commit bf2c4d4
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/actions/build-v5/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Build (legacy v5)'
description: 'Build the project'

runs:
using: composite
steps:
- uses: myparcelnl/actions/yarn-install@v4
with:
node-version: 18

- name: 'Cache build'
uses: actions/cache@v4
id: cache-build
with:
path: |
./dist
key: ${{ runner.os }}-build-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/src') }}

- name: 'Create build'
if: steps.cache-build.outputs.cache-hit != 'true'
run: yarn build
shell: bash
env:
NODE_OPTIONS: --openssl-legacy-provider
36 changes: 36 additions & 0 deletions .github/actions/test-v5/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Run tests'
description: 'Run tests and upload coverage'

inputs:
codecov-token:
description: 'Codecov token'
required: true

runs:
using: composite
steps:
- name: 'Cache coverage'
uses: actions/cache@v4
id: cache-coverage
with:
path: ./coverage
key: ${{ runner.os }}-coverage-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/src') }}
restore-keys: |
${{ runner.os }}-coverage-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-coverage-
- uses: myparcelnl/actions/yarn-install@v4
if: steps.cache-coverage.outputs.cache-hit != 'true'
with:
node-version: 18

- name: 'Run tests'
if: steps.cache-coverage.outputs.cache-hit != 'true'
run: ./node_modules/.bin/cross-env yarn test:unit --coverage
shell: bash
env:
NODE_ICU_DATA: node_modules/full-icu

- uses: codecov/codecov-action@v4
with:
token: ${{ inputs.codecov-token }}
63 changes: 63 additions & 0 deletions .github/workflows/push-v5.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: 'On push (legacy v5) ⚙️'

on:
push:
branches:
- v5.x

paths-ignore:
- ./**/*.md
- ./.idea/**

concurrency:
group: '${{ github.workflow }}-${{ github.ref }}'
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/test-v5
with:
codecov-token: ${{ secrets.CODECOV_TOKEN }}

build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/build-v5

release:
runs-on: ubuntu-22.04
needs:
- test
- build
steps:
- uses: myparcelnl/actions/setup-git-credentials@v4
id: credentials
with:
app-id: ${{ secrets.MYPARCEL_APP_ID }}
private-key: ${{ secrets.MYPARCEL_APP_PRIVATE_KEY }}

- uses: actions/checkout@v4
with:
token: ${{ steps.credentials.outputs.token }}
fetch-depth: 0

- uses: ./.github/actions/build-v5

- uses: myparcelnl/actions/semantic-release@v4
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
token: ${{ steps.credentials.outputs.token }}

rebase-prs:
needs:
- test
- build
uses: ./.github/workflows/rebase-prs.yml
secrets: inherit
29 changes: 29 additions & 0 deletions .github/workflows/run-tests-v5.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 'Run tests (legacy v5) 🧪'

on:
pull_request:
branches:
- v5.x

merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/test-v5
with:
codecov-token: ${{ secrets.CODECOV_TOKEN }}

build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/build-v5

0 comments on commit bf2c4d4

Please sign in to comment.