Skip to content

Commit

Permalink
ci: test ci/cd
Browse files Browse the repository at this point in the history
  • Loading branch information
robsonos committed Dec 4, 2023
1 parent b97d8a1 commit dd09c57
Show file tree
Hide file tree
Showing 8 changed files with 2,537 additions and 102 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Continuous deployment
on:
push:
branches:
- main

permissions:
contents: read # for checkout

jobs:
release:
runs-on: macos-13
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
92 changes: 92 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Continuous integration
on:
push:
branches:
- dev

jobs:
lint:
runs-on: macos-13
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Lint
run: yarn lint

verify-web:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Verify web
run: yarn verify:web

verify-android:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Java
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'zulu'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Verify android
run: yarn verify:android

verify-ios:
runs-on: macos-13
steps:
# https://github.com/actions/virtual-environments/blob/main/images/macos/macos-12-Readme.md#xcode
- name: Set up Xcode
run: sudo xcode-select --switch /Applications/Xcode_14.2.app

- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Verify ios
run: npm run verify:ios
24 changes: 24 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
{
"path": "@semantic-release/npm",
"npmPublish": true,
"pkgRoot": "."
},
{
"path": "@semantic-release/git",
"assets": [
"package.json",
"yarn.lock",
"CHANGELOG.md"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
}
23 changes: 9 additions & 14 deletions android/src/main/java/com/example/plugin/nordicdfu/NordicDfu.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ public void onEnablingDfuMode(@NonNull final String deviceAddress) {

@Override
public void onProgressChanged(
@NonNull final String deviceAddress,
final int percent,
final float speed,
final float avgSpeed,
final int currentPart,
final int partsTotal) {
@NonNull final String deviceAddress,
final int percent,
final float speed,
final float avgSpeed,
final int currentPart,
final int partsTotal
) {
JSObject ret = new JSObject();
ret.put("deviceAddress", deviceAddress);
ret.put("percent", percent);
Expand Down Expand Up @@ -116,7 +117,6 @@ public void onDfuCompleted(@NonNull final String deviceAddress) {
JSObject ret = new JSObject();
ret.put("deviceAddress", deviceAddress);
dfuEventListener.onDfuEvent("DFU_COMPLETED", ret);

// TODO: end activity
// new Handler()
// .postDelayed(
Expand Down Expand Up @@ -144,11 +144,7 @@ public void onDfuAborted(@NonNull final String deviceAddress) {
}

@Override
public void onError(
@NonNull final String deviceAddress,
final int error,
final int errorType,
final String message) {
public void onError(@NonNull final String deviceAddress, final int error, final int errorType, final String message) {
JSObject ret = new JSObject();
ret.put("deviceAddress", deviceAddress);
ret.put("error", error);
Expand All @@ -162,8 +158,7 @@ public void onResume(Context context) {
DfuServiceListenerHelper.registerProgressListener(context, dfuProgressListener);
}

public void onPause(Context context) {
}
public void onPause(Context context) {}

public void onDestroy(Context context) {
DfuServiceListenerHelper.unregisterProgressListener(context, dfuProgressListener);
Expand Down
10 changes: 2 additions & 8 deletions example/src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing';
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';

// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
);
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
4 changes: 2 additions & 2 deletions ios/Plugin/NordicDfuPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import UserNotifications

@objc(NordicDfuPlugin)
public class NordicDfuPlugin: CAPPlugin, CBCentralManagerDelegate, DFUServiceDelegate, DFUProgressDelegate, NotificationHandlerProtocol {
public var DFU_CHANGE_EVENT: String = "DFUStateChanged"
public var dfuChangeEvent: String = "DFUStateChanged"
var notificationRequestLookup = [String: JSObject]()
private var manager: CBCentralManager?

Expand Down Expand Up @@ -147,7 +147,7 @@ public class NordicDfuPlugin: CAPPlugin, CBCentralManagerDelegate, DFUServiceDel
"state": state,
"data": data,
]
notifyListeners(DFU_CHANGE_EVENT, data: ret)
notifyListeners(dfuChangeEvent, data: ret)
}

@objc func startDFU(_ call: CAPPluginCall) {
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"author": "Robson Oliveira dos Santos",
"license": "MIT",
"engines": {
"node": ">=16.0.0"
"node": ">=18.0.0"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -60,6 +60,9 @@
"@ionic/eslint-config": "^0.3.0",
"@ionic/prettier-config": "^2.0.0",
"@ionic/swiftlint-config": "^1.1.2",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/npm": "^11.0.1",
"eslint": "^7.26.0",
"husky": "^8.0.3",
"np": "^8.0.4",
Expand All @@ -68,6 +71,7 @@
"pretty-quick": "^3.1.3",
"rimraf": "^3.0.2",
"rollup": "^2.79.1",
"semantic-release": "^22.0.8",
"swiftlint": "^1.0.1",
"typescript": "~4.9.4"
},
Expand Down
Loading

0 comments on commit dd09c57

Please sign in to comment.