ci: prepare for first release of new version #179
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 |