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

ci: setup GitHub actions #4514

Merged
merged 3 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
107 changes: 107 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: CI

on:
pull_request: {}

permissions:
actions: read
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- run: yarn --frozen-lockfile --non-interactive

lint-affected:
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- run: yarn --frozen-lockfile --non-interactive
- uses: nrwl/nx-set-shas@v4
- run: yarn nx affected -t lint

test-affected:
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- run: yarn --frozen-lockfile --non-interactive
- uses: nrwl/nx-set-shas@v4
- run: yarn nx affected -t test

e2e-affected:
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- run: yarn --frozen-lockfile --non-interactive
- uses: nrwl/nx-set-shas@v4
- run: yarn nx affected -t e2e --exclude=docs-app

build-affected:
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- run: yarn --frozen-lockfile --non-interactive
- uses: nrwl/nx-set-shas@v4
- run: yarn nx affected -t build

schematics-core-check:
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- run: yarn --frozen-lockfile --non-interactive
- uses: nrwl/nx-set-shas@v4
- run: yarn copy:schematics
- run: yarn schematics:check
109 changes: 109 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: main
Copy link
Member Author

@timdeschryver timdeschryver Sep 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I enabled this pipeline on PRs to test it out and then disabled it once the build was successful, here's one that's successful :

https://github.com/ngrx/platform/actions/runs/10742124522


on:
push:
branches:
- main

permissions:
actions: read
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- run: yarn --frozen-lockfile --non-interactive

lint:
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- run: yarn --frozen-lockfile --non-interactive
- uses: nrwl/nx-set-shas@v4
- run: yarn nx run-many -t lint

test:
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- run: yarn --frozen-lockfile --non-interactive
- uses: nrwl/nx-set-shas@v4
- run: yarn nx run-many -t test

e2e:
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- run: yarn --frozen-lockfile --non-interactive
- uses: nrwl/nx-set-shas@v4
- run: yarn nx run-many -t e2e --exclude=docs-app

build:
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- run: yarn --frozen-lockfile --non-interactive
- uses: nrwl/nx-set-shas@v4
- run: yarn build

schematics-core-check:
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- run: yarn --frozen-lockfile --non-interactive
- uses: nrwl/nx-set-shas@v4
- run: yarn copy:schematics
- run: yarn schematics:check
10 changes: 2 additions & 8 deletions projects/ngrx.io/src/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,8 @@ module.exports = function (config) {
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['CustomChrome'],
browsers: ['ChromeHeadless'],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required, otherwise the CI needs to install chromium (which we did in CircleCI via an orb)

browserNoActivityTimeout: 60000,
singleRun: false,
customLaunchers: {
CustomChrome: {
base: 'Chrome',
flags: process.env.TRAVIS && ['--no-sandbox']
}
}
singleRun: false
});
};