Skip to content

Commit

Permalink
ci: update actions, add nodejs 20 and 22 to test matrix, migrate to z…
Browse files Browse the repository at this point in the history
…x-semrel
  • Loading branch information
antongolub committed Apr 29, 2024
1 parent 5696017 commit 134c1e3
Showing 1 changed file with 24 additions and 66 deletions.
90 changes: 24 additions & 66 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,20 @@
name: CI
on: [push, pull_request]
jobs:
# Handle [skip ci] / [ci skip] directives in commit messages
init:
if: github.event_name == 'push'
name: init
runs-on: ubuntu-20.04
outputs:
skip: ${{ steps.ci-skip-step.outputs.ci-skip }}
skip-not: ${{ steps.ci-skip-step.outputs.ci-skip-not }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- id: ci-skip-step
uses: mstachniuk/ci-skip@v1

# Fast unit tests flow
test_push:
push:
if: github.event_name == 'push'
needs: init
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkuout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: ${{ github.ref == 'refs/heads/master' && '0' || '1' }}

- name: Setup NodeJS
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Yarn install
run: yarn
Expand All @@ -47,68 +30,43 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Semantic Release
if: github.ref == 'refs/heads/master'
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_PROVENANCE: true
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: [email protected]
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: Anton Golub
GIT_COMMITTER_EMAIL: Anton Golub
run: npm_config_yes=true npx zx-semrel

# Full tests for PR
test_pr:
if: github.event_name == 'pull_request'
strategy:
matrix:
os: [ windows-2019, ubuntu-20.04 ]
node-version: [ 12, 14, 16 ]
os: [ windows-latest, ubuntu-22.04 ]
node-version: [ 12, 14, 16, 18, 20, 22 ]
name: Test (Node v${{ matrix.node-version }}, OS ${{ matrix.os }})
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
uses: actions/checkout@v4

- name: Setup NodeJS v${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Yarn install
run: yarn

- name: Intergarion test
if: matrix.node-version != '16' || matrix.os != 'ubuntu-20.04'
if: matrix.node-version != '20' || matrix.os != 'ubuntu-22.04'
run: cli/synp.js -s yarn.lock

- name: Full test suite
if: matrix.node-version == '16' && matrix.os == 'ubuntu-20.04'
if: matrix.node-version == '20' && matrix.os == 'ubuntu-22.04'
run: yarn test

# Release
release:
name: Release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-20.04
needs: test_push
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup NodeJS
uses: actions/setup-node@v2
with:
node-version: 16

- name: Yarn install
run: yarn

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
with:
extra_plugins: |
@semantic-release/changelog@6
@semantic-release/git@10
@semantic-release/github@8
@semantic-release/npm@8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_AUTHOR_EMAIL: '[email protected]'
GIT_COMMITTER_EMAIL: '[email protected]'
GIT_AUTHOR_NAME: '@antongolub'
GIT_COMMITTER_NAME: '@antongolub'

0 comments on commit 134c1e3

Please sign in to comment.