From 30e2abcf86cc9eed68d1b2c7701caee911fddbd9 Mon Sep 17 00:00:00 2001 From: WEBER Logan Date: Thu, 28 Sep 2023 14:48:53 +0200 Subject: [PATCH] ci: use github actions instead of travis --- .github/workflows/angular.yml | 62 ++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 31 +++++++++++++++++ .github/workflows/workflow.yml | 8 +++++ package.json | 3 ++ yarn.lock | 5 +++ 5 files changed, 109 insertions(+) create mode 100644 .github/workflows/angular.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/workflow.yml diff --git a/.github/workflows/angular.yml b/.github/workflows/angular.yml new file mode 100644 index 00000000..bc609276 --- /dev/null +++ b/.github/workflows/angular.yml @@ -0,0 +1,62 @@ +on: + workflow_call: + +env: + NODE_JS_VERSION: 12 + +jobs: + install-and-scan-deps: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: ${{env.NODE_JS_VERSION}} + cache: 'yarn' + - uses: actions/cache@v3 + with: + key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + path: '**/node_modules' + - run: yarn config get cacheFolder + - run: yarn --frozen-lockfile + - run: yarn run improved-yarn-audit --min-severity high || true + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: ${{env.NODE_JS_VERSION}} + cache: 'yarn' + - uses: actions/cache@v3 + with: + key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + path: '**/node_modules' + - run: yarn config get cacheFolder + - run: yarn --frozen-lockfile + - run: yarn lint + needs: + - install-and-scan-deps + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: ${{env.NODE_JS_VERSION}} + cache: 'yarn' + - uses: actions/cache@v3 + with: + key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + path: '**/node_modules' + - run: yarn --frozen-lockfile + - run: yarn build:lib + - run: yarn build:demo --base-href "/ngx-openlayers/" --progress false + - uses: actions/upload-artifact@v3 + with: + name: build + path: dist/ + needs: + - install-and-scan-deps diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..ea2cccda --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +on: + push: + tags: + - '*' + +jobs: + angular: + uses: ./.github/workflows/angular.yml + release-on-npm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v3 + with: + name: build + path: dist + - uses: actions/setup-node@v3 + with: + node-version: ${{env.NODE_JS_VERSION}} + cache: 'yarn' + registry-url: 'https://registry.npmjs.org' + - uses: actions/cache@v3 + with: + key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + path: '**/node_modules' + - run: cp projects/ngx-openlayers/CHANGELOG.md dist/ngx-openlayers/CHANGELOG.md + - run: cd dist/ngx-openlayers/ && npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + needs: + - angular diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml new file mode 100644 index 00000000..12004a75 --- /dev/null +++ b/.github/workflows/workflow.yml @@ -0,0 +1,8 @@ +on: + push: + tags-ignore: + - '**' + +jobs: + angular: + uses: ./.github/workflows/angular.yml diff --git a/package.json b/package.json index 9364f17c..1a19f815 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,9 @@ "@angular/language-service": "^14.3.0", "@types/jasmine": "~4.3.1", "@types/node": "^12.11.1", + "codelyzer": "^6.0.0", + "improved-yarn-audit": "^3.0.0", + "jasmine-core": "~3.8.0", "@typescript-eslint/eslint-plugin": "^5.36.2", "@typescript-eslint/parser": "^5.36.2", "eslint": "^8.23.0", diff --git a/yarn.lock b/yarn.lock index 8ccca1fd..4c4ff8b9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5351,6 +5351,11 @@ import-fresh@^3.0.0, import-fresh@^3.2.1: parent-module "^1.0.0" resolve-from "^4.0.0" +improved-yarn-audit@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/improved-yarn-audit/-/improved-yarn-audit-3.0.0.tgz#dfb09cea1a3a92c790ea2b4056431f6fb1b99bfa" + integrity sha512-b7CrBYYwMidtPciCBkW62C7vqGjAV10bxcAWHeJvGrltrcMSEnG5I9CQgi14nmAlUKUQiSvpz47Lo3d7Z3Vjcg== + imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"