From 8578d44d90c7a01831eeeead3a288b6ac600cf45 Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Wed, 11 Jan 2023 13:43:11 +0200 Subject: [PATCH] github workflow fixes Signed-off-by: Jari Kolehmainen --- .github/workflows/bump-master-version.yaml | 8 ++-- .github/workflows/check-docs.yml | 4 +- .github/workflows/electronegativity.yml | 2 +- .github/workflows/license-header.yml | 2 +- .github/workflows/publish-master-npm.yml | 12 +++--- .github/workflows/publish-release-npm.yml | 40 ++++---------------- .github/workflows/test.yml | 2 +- Makefile | 43 ++++++++++++++++++++++ 8 files changed, 63 insertions(+), 50 deletions(-) create mode 100644 Makefile diff --git a/.github/workflows/bump-master-version.yaml b/.github/workflows/bump-master-version.yaml index 7c4d06ad2b..fd210c88cb 100644 --- a/.github/workflows/bump-master-version.yaml +++ b/.github/workflows/bump-master-version.yaml @@ -19,15 +19,13 @@ jobs: fetch-depth: 0 - name: Install dependencies run: | - npm i --location=global semver + yarn ci - name: Bump version to first alpha of next minor version run: | - NEW_VERSION=$(cat package.json | jq .version --raw-output| xargs semver -i preminor --preid alpha) - cat package.json | jq --arg new_version "$NEW_VERSION" '.version = $new_version' > new-package.json - mv new-package.json package.json + yarn bump-version preminor - uses: peter-evans/create-pull-request@v4 with: - add-paths: package.json + add-paths: lerna.json,packages/*/package.json commit-message: Update package.json version to next preminor because of recent release signoff: true delete-branch: true diff --git a/.github/workflows/check-docs.yml b/.github/workflows/check-docs.yml index defc5f3ca1..cccb0222cb 100644 --- a/.github/workflows/check-docs.yml +++ b/.github/workflows/check-docs.yml @@ -24,8 +24,8 @@ jobs: - name: Generate Extensions API Reference using typedocs run: | yarn install - yarn typedocs-extensions-api + yarn run build:docs - name: Verify that the markdown is valid run: | - yarn run verify-docs + yarn run mkdocs:verify diff --git a/.github/workflows/electronegativity.yml b/.github/workflows/electronegativity.yml index 6ba06e2721..861b63c7e7 100644 --- a/.github/workflows/electronegativity.yml +++ b/.github/workflows/electronegativity.yml @@ -18,7 +18,7 @@ jobs: - uses: doyensec/electronegativity-action@v1.1 with: - input: src/ + input: packages/core/src/ electron-version: "19.0.4" severity: medium diff --git a/.github/workflows/license-header.yml b/.github/workflows/license-header.yml index 2e33292785..ba277b3245 100644 --- a/.github/workflows/license-header.yml +++ b/.github/workflows/license-header.yml @@ -25,4 +25,4 @@ jobs: set -e export PATH=${PATH}:`go env GOPATH`/bin - addlicense -check -l mit -c "OpenLens Authors" src/**/*.?css + addlicense -check -l mit -c "OpenLens Authors" packages/*/src/**/*.?css diff --git a/.github/workflows/publish-master-npm.yml b/.github/workflows/publish-master-npm.yml index 7824dd1c84..5fc307e1ee 100644 --- a/.github/workflows/publish-master-npm.yml +++ b/.github/workflows/publish-master-npm.yml @@ -25,13 +25,11 @@ jobs: with: node-version: ${{ matrix.node-version }} - - name: Generate NPM package + - name: Generate NPM packages run: | - make build-extensions-npm + yarn ci + yarn run build - - name: publish new release + - name: Publish NPM package run: | - make publish-extensions-npm - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - NPM_RELEASE_TAG: master + yarn lerna publish from-package --dist-tag master --no-push --no-git-tag-version --yes diff --git a/.github/workflows/publish-release-npm.yml b/.github/workflows/publish-release-npm.yml index 18be26f4f3..9081daaf82 100644 --- a/.github/workflows/publish-release-npm.yml +++ b/.github/workflows/publish-release-npm.yml @@ -12,8 +12,8 @@ on: type: string description: The version to release manually jobs: - publish-extensions: - name: Publish Extensions NPM Package Release + publish-npm-packages: + name: Publish NPM Packages runs-on: ubuntu-latest strategy: matrix: @@ -30,39 +30,13 @@ jobs: with: node-version: ${{ matrix.node-version }} - - name: Generate NPM package + - name: Generate NPM packages run: | - make build-extensions-npm + yarn ci + yarn run build - - name: Publish NPM package + - name: Publish NPM packages run: | - make publish-extensions-npm - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - publish-library: - name: Publish Library NPM Package Release - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [16.x] - steps: - - name: Checkout Release - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ inputs.version }} - - - name: Using Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - - name: Generate NPM package - run: | - make build-library-npm - - - name: Publish NPM package - run: | - make publish-library-npm + yarn lerna publish from-package --no-push --no-git-tag-version --yes env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e71bfb0be8..8bb861f8a0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -51,7 +51,7 @@ jobs: timeout_minutes: 10 max_attempts: 3 retry_on: error - command: make node_modules + command: yarn ci - run: make test name: Run tests diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..11c6ba1649 --- /dev/null +++ b/Makefile @@ -0,0 +1,43 @@ +CMD_ARGS = $(filter-out $@,$(MAKECMDGOALS)) + +%: + @: + +ELECTRON_BUILDER_EXTRA_ARGS ?= + +ifeq ($(OS),Windows_NT) + DETECTED_OS := Windows +else + DETECTED_OS := $(shell uname) +endif + +node_modules: yarn.lock + yarn install --check-files --frozen-lockfile --network-timeout=100000 + yarn lerna bootstrap + +.PHONY: lint +lint: node_modules + yarn lint + +.PHONY: test +test: node_modules + yarn run test:unit + +.PHONY: integration +integration: build + yarn test:integration + +.PHONY: build +build: + yarn run build +ifeq "$(DETECTED_OS)" "Windows" +# https://github.com/ukoloff/win-ca#clear-pem-folder-on-publish + rm -rf packages/core/node_modules/win-ca/pem +endif + yarn lerna run build:app --publish onTag $(ELECTRON_BUILDER_EXTRA_ARGS) + + +.PHONY: clean +clean: + yarn run clean + yarn run clean:node_modules