-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (59 loc) · 1.67 KB
/
pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
name: Pull request build
on:
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
pull-requests: read
jobs:
code:
strategy:
matrix:
node: ['20', 'latest']
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
name: "Test project { os: ${{ matrix.os }}, node: ${{ matrix.node }} }"
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm
# required for testing
- name: Configure git
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Install project modules
run: npm ci
- name: Lint source files
run: npm run lint
- name: Run unit tests
run: npm test
image:
runs-on: ubuntu-latest
needs: [code]
name: Test container image
env:
TESTING_TAG: tomerfi/version-bumper:testing
steps:
- name: Setup docker buildx
uses: docker/setup-buildx-action@v3
- name: Build image
uses: docker/build-push-action@v5
with:
tags: ${{ env.TESTING_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
load: true
- name: Test image run
run: |
pattern='^version-bumper ([0-9]\.){2}[0-9](.+)?$'
sut=$(docker run --rm ${{ env.TESTING_TAG }} -v)
[[ $sut =~ $pattern ]] || exit 1