Skip to content

Commit

Permalink
ci: update ci/cd pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
mato533 committed Dec 6, 2024
1 parent a59e3ce commit 12cb74d
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 20 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ jobs:
with:
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
- name: Copy license and readme
run: |
cp README.md packages/electron-typed-ipc-bridge/
cp LICENSE packages/electron-typed-ipc-bridge/
- name: Build
working-directory: packages/electron-typed-ipc-bridge
run: pnpm run build

- name: Publish
working-directory: packages/electron-typed-ipc-bridge
run: pnpm publish --provenance --no-git-checks --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -45,6 +51,7 @@ jobs:

- name: Run tests with coverage
id: test
working-directory: packages/electron-typed-ipc-bridge
env:
TEST_RESULT: 'coverage/junit.xml'
run: |
Expand All @@ -63,21 +70,21 @@ jobs:
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/coverage-final.json
files: packages/electron-typed-ipc-bridge/coverage/coverage-final.json
verbose: true

- name: Upload test results to Codecov
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ${{ steps.test.outputs.file-name }}
file: packages/electron-typed-ipc-bridge/${{ steps.test.outputs.file-name }}

- name: Upload coverage report to the code climate
uses: paambaati/codeclimate-action@v9
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: ${{ github.workspace }}/coverage/clover.xml:clover
coverageLocations: ${{ github.workspace }}/packages/electron-typed-ipc-bridge/coverage/clover.xml:clover

create-release:
name: Create Release
Expand Down Expand Up @@ -110,8 +117,8 @@ jobs:
- name: Download tarball
id: download
run: |
APP_NAME="$(cat ./package.json |jq .name|sed -e 's/"//g'| head -n1)"
APP_VERSION="$(cat ./package.json |jq .version|sed -e 's/"//g'| head -n1)"
APP_NAME="$(cat ./package.json |jq -r .name)"
APP_VERSION="$(cat ./package.json |jq -r .version)"
TAR_URL="$(pnpm view "${APP_NAME}@${APP_VERSION}" dist.tarball)"
TAR_NAME="${TAR_URL##*/}"
echo "URL: ${TAR_URL}"
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
uses: ./.github/workflows/test.yml

get-version:
name: Get versioon from package.json
name: Get version from package.json
runs-on: ubuntu-latest
needs:
- check-release
Expand All @@ -59,8 +59,9 @@ jobs:

- name: Parse package.json
id: identify-version
working-directory: packages/electron-typed-ipc-bridge
run: |
APP_VERSION="$(cat ./package.json |jq .version|sed -e 's/"//g'| head -n1)"
APP_VERSION="$(cat ./package.json |jq -r .version)"
if [ ! -n "${APP_VERSION}" ]; then
exit 255
fi
Expand All @@ -84,7 +85,7 @@ jobs:
private-key: ${{ secrets.PRIVATE_KEY }}
owner: ${{ github.repository_owner }}

- name: Configration for git
- name: Configuration for git
run: |
git config --global user.name "${GH_USER}"
git config --global user.email "${GH_EMAIL}"
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/create-rlease-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:

# You can add your own logic here based on the selected version type
- name: Bump version based on input
working-directory: packages/electron-typed-ipc-bridge
run: |
case "${VERSION_TYPE}" in
major)
Expand All @@ -68,8 +69,9 @@ jobs:
- name: Parse package.json
id: identify-version
working-directory: packages/electron-typed-ipc-bridge
run: |
APP_VERSION="$(cat ./package.json |jq .version|sed -e 's/"//g'| head -n1)"
APP_VERSION="$(cat ./package.json |jq -r .version)"
if [ ! -n "${APP_VERSION}" ]; then
exit 255
fi
Expand Down Expand Up @@ -119,7 +121,7 @@ jobs:
git commit -F-<<EOF
chore: update the CHANGELOG.md for ${APP_VERSION_TEXT}
[AUTO] this commit is created by github actions automatialy.
[AUTO] this commit is created by github actions automatically.
EOF
- name: Commit package.json
Expand All @@ -131,7 +133,7 @@ jobs:
git commit -F-<<EOF
chore: update version of package.json for ${APP_VERSION_TEXT}
[AUTO] this commit is created by github actions automatialy.
[AUTO] this commit is created by github actions automatically.
EOF
- name: Push commits
env:
Expand Down
24 changes: 15 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@ jobs:
cache: 'pnpm'

- name: Type check
working-directory: packages/electron-typed-ipc-bridge
run: pnpm run typecheck

- name: Run the test
working-directory: packages/electron-typed-ipc-bridge
run: pnpm run test

- name: Build
id: build
shell: bash
working-directory: packages/electron-typed-ipc-bridge
run: |
pnpm run build
TAR_INFO="$(pnpm pack --json)"
Expand All @@ -52,33 +55,33 @@ jobs:
- name: Setup playground
env:
TAR_NAME: ${{ steps.build.outputs.tar-name }}
working-directory: ./playground
working-directory: packages/sample-app
shell: bash
run: |
pnpm install "../${TAR_NAME}"
- name: Type check
working-directory: ./playground
working-directory: packages/sample-app
run: pnpm run typecheck

- name: Build (Windows)
if: runner.os == 'Windows'
working-directory: ./playground
working-directory: packages/sample-app
run: pnpm build:win

- name: Test (E2E) on Windows
if: runner.os == 'Windows'
working-directory: ./playground
working-directory: packages/sample-app
run: pnpm test:e2e

- name: Build (Linux)
if: runner.os == 'Linux'
working-directory: ./playground
working-directory: packages/sample-app
run: pnpm build:linux

- name: Test (E2E) on Linux
if: runner.os == 'Linux'
working-directory: ./playground
working-directory: packages/sample-app
run: |
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"
Expand All @@ -104,6 +107,7 @@ jobs:
id: test
env:
TEST_RESULT: 'coverage/junit.xml'
working-directory: packages/electron-typed-ipc-bridge
run: |
pnpm exec vitest run --coverage \
--coverage.reportOnFailure \
Expand All @@ -118,14 +122,14 @@ jobs:
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/coverage-final.json
files: packages/electron-typed-ipc-bridge/coverage/coverage-final.json
verbose: true

- name: Upload test results to Codecov
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage/junit.xml
file: packages/electron-typed-ipc-bridge/coverage/junit.xml
verbose: true

- name: Upload coverage report to the code climate
Expand All @@ -134,8 +138,10 @@ jobs:
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: ${{ github.workspace }}/coverage/clover.xml:clover
coverageLocations: packages/electron-typed-ipc-bridge/coverage/clover.xml:clover

- name: Write coverage report to pull request
if: ${{ github.event_name == 'pull_request' }}
uses: davelosert/vitest-coverage-report-action@v2
with:
working-directory: packages/electron-typed-ipc-bridge/

0 comments on commit 12cb74d

Please sign in to comment.