Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/GitHub actions #28

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ad473f6
create angular github action
thomasengels Oct 2, 2024
366e745
github action: first build then test
thomasengels Oct 3, 2024
dd98c22
github action: run headless chrome
thomasengels Oct 3, 2024
4fd9b90
github action: enable headless chrome
thomasengels Oct 3, 2024
fdc81fc
github action: dont run tests for now, same as current release script
thomasengels Oct 3, 2024
315f4bc
github action: dependabot config to auto change version
thomasengels Oct 3, 2024
9413674
github action: filename equals action
thomasengels Oct 3, 2024
96d46b5
github action: install semantic release package
thomasengels Oct 3, 2024
0f7076d
publish
thomasengels Oct 3, 2024
2a62777
other token
thomasengels Oct 10, 2024
fa64500
merge without using PR
thomasengels Oct 10, 2024
25be08a
wrong branch
thomasengels Oct 10, 2024
a09b959
no PR just merge when succesful build
thomasengels Oct 10, 2024
abefec5
no PR just merge when succesful build
thomasengels Oct 10, 2024
1ef75be
run build for every branch or PR
thomasengels Nov 5, 2024
5b672eb
release of new version is done manually
thomasengels Nov 5, 2024
a8203cf
remind developers to set label on their PR's
thomasengels Nov 13, 2024
4e05e0a
remind developers to set label on their PR's
thomasengels Nov 13, 2024
697d963
succesful publish
thomasengels Nov 14, 2024
317e6ba
remove broken action
thomasengels Nov 14, 2024
4a611d4
trigger from github site
thomasengels Nov 15, 2024
254e6eb
use same version as local
thomasengels Nov 15, 2024
5f49d41
deprecated when upgrading to angular 14 and above
thomasengels Nov 25, 2024
cced254
run tests as part of github action
thomasengels Nov 25, 2024
8fe46e9
ng is not a tool installed within the action
thomasengels Nov 25, 2024
4a0425e
specify generic type on test class
thomasengels Nov 28, 2024
6bf3888
Disable GPU Acceleration
thomasengels Nov 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"@typescript-eslint/no-unused-vars": "off" // Disables the rule for unused variables and imports
}
}
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
commit-message:
prefix: fix
prefix-development: chore
include: scope
33 changes: 33 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Build + Test

on:
push:
branches:
- '**' # This triggers on push for every branch
pull_request:
branches:
- '**' # This triggers on pull request for every branch

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.17.0]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: package-lock.json
- run: npm ci
- run: npm test
- run: npm run build --if-present

22 changes: 22 additions & 0 deletions .github/workflows/label-reminder-existing-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: label-reminder-existing-pr.yml
on:
pull_request:
branches:
- main
types:
- reopened
- labeled
- unlabeled
jobs:
check_labels:
name: 'Check PR Labels'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mheap/github-action-required-labels@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
mode: exactly
count: 1
labels: 'major, minor, patch'
16 changes: 16 additions & 0 deletions .github/workflows/label-reminder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: label-reminder.yml
on:
pull_request:
branches:
- main
types:
- opened
jobs:
add_comment:
name: 'Add Comment'
runs-on: ubuntu-latest
steps:
- uses: mshick/add-pr-comment@v2
with:
message: Please set a versioning label of either `major`, `minor`, or `patch` to the pull request.
repo-token: ${{ secrets.GITHUB_TOKEN }}
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build and Publish Angular Library with Semantic Versioning

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'projects/ng-inbo/**' # Trigger on changes in the library folder

jobs:
build-and-publish:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 18.17.0 ]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18.17.0

- name: Cache Node.js modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Install dependencies
run: npm ci # Use npm ci for faster, deterministic installs

- name: Install Angular CLI
run: npm install -g @angular/cli@17.3.6

- name: Build Angular library
run: ng build ng-inbo --configuration production

- name: run unit tests
run: ng test ng-inbo --no-watch --code-coverage

- name: Set up semantic-release
run: npm install --save-dev semantic-release @semantic-release/changelog @semantic-release/git @semantic-release/npm

- name: Set up .npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

- name: Run semantic-release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub token for releasing
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # NPM token for publishing
run: npx semantic-release
- name: Publish to npm
run: npm publish --verbose
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
25 changes: 25 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"release": {
"branches": "main",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
["@semantic-release/npm", {
"npmPublish": false,
}],
"@semantic-release/github",
["@semantic-release/exec", {
"prepare": "npm run package"
}],
[
"@semantic-release/git",
{
"assets": [
"dist",
"package.json",
"package-lock.json"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
9 changes: 7 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"sourceRoot": "projects/ng-inbo/src",
"prefix": "inbo",
"architect": {
"lint": {},
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
Expand All @@ -27,7 +28,10 @@
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/ng-inbo/src/test.ts",
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "projects/ng-inbo/tsconfig.spec.json",
"karmaConfig": "projects/ng-inbo/karma.conf.js"
}
Expand All @@ -36,6 +40,7 @@
}
},
"cli": {
"analytics": false
"analytics": false,
"schematicCollections": ["@angular-eslint/schematics"]
}
}
Loading
Loading