Skip to content

Commit

Permalink
ci: better ci workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Tomer Figenblat <[email protected]>
  • Loading branch information
TomerFi committed Feb 11, 2024
1 parent cdd29ab commit 2fa6750
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 143 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: CI

on:
pull_request:
branches:
- master
push:
branches:
- master
paths:
- src/**
- Dockerfile
- package.json
- package-lock.json

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

permissions:
pull-requests: read

jobs:
code:
uses: ./.github/workflows/test_package.yml
image:
needs: code
uses: ./.github/workflows/test_image.yml
71 changes: 0 additions & 71 deletions .github/workflows/pr.yml

This file was deleted.

9 changes: 0 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ jobs:
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Setup qemu
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ vars.PLATFORMS }}

- name: Setup docker buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
Expand Down Expand Up @@ -110,7 +102,6 @@ jobs:
with:
context: .
push: ${{ github.event.inputs.dry-run != 'true' }}
platforms: ${{ vars.PLATFORMS }}
tags: |
tomerfi/version-bumper:latest
tomerfi/version-bumper:${{ steps.bump.outputs.version }}
Expand Down
63 changes: 0 additions & 63 deletions .github/workflows/stage.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/test_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Build and Test Image

on:
workflow_call:
workflow_dispatch:

jobs:
image:
runs-on: ubuntu-latest
name: Test container image
env:
TESTING_TAG: tomerfi/version-bumper:testing
steps:
- uses: docker/setup-buildx-action@v3
- 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='^@tomerfi/version-bumper ([0-9]\.){2}[0-9](.+)?$'
sut=$(docker run --rm ${{ env.TESTING_TAG }} -v)
[[ $sut =~ $pattern ]] || exit 1
29 changes: 29 additions & 0 deletions .github/workflows/test_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Test and Build Package

on:
workflow_call:
workflow_dispatch:

jobs:
test:
strategy:
matrix:
node: ['20', 'latest']
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
name: "Test project { os: ${{ matrix.os }}, node: ${{ matrix.node }} }"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm
# required for testing
- run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- run: npm ci
- run: npm run lint
- run: npm test

0 comments on commit 2fa6750

Please sign in to comment.