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

👷 🎨 split workflows into multiple files #409

Merged
merged 4 commits into from
Jan 31, 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
21 changes: 21 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build
on:
workflow_call:
jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build
21 changes: 21 additions & 0 deletions .github/workflows/build_storybook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build storybook
on:
workflow_call:
jobs:
build-storybook:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build-storybook
21 changes: 21 additions & 0 deletions .github/workflows/code_coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Test
on:
workflow_call:
jobs:
code-coverage:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3

- name: Install dependencies
run: npm ci

- name: Unit tests
run: npm run test:coverage
21 changes: 21 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Lint
on:
workflow_call:
jobs:
lint:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3

- name: Install dependencies
run: npm ci

- name: Linting
run: npm run lint
100 changes: 0 additions & 100 deletions .github/workflows/pr_actions.yaml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Pull request

on:
pull_request:
branches: [main]
paths:
- "**"
- ".github/workflows/**"
workflow_dispatch:
jobs:
lint:
name: Lint
uses: ./.github/workflows/lint.yaml
Copy link
Contributor

Choose a reason for hiding this comment

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

Didn't know you could reference other yaml files, cool!


test:
name: Test
uses: ./.github/workflows/test.yaml

code-coverage:
name: Code coverage
uses: ./.github/workflows/code_coverage.yaml

build:
name: Build
uses: ./.github/workflows/build.yaml

build-storybook:
name: Build storybook
uses: ./.github/workflows/build_storybook.yaml
21 changes: 21 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Test
on:
workflow_call:
jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3

- name: Install dependencies
run: npm ci

- name: Unit tests
run: npm run test:ci
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ wget -q -O - https://raw.githubusercontent.com/equinor/amplify-components/main/c
```


This should have downloaded the `.eslintrc.cjs`, `.prettierignore`, `.prettierrc.jr`, `tsconfig.json`, `env.sh`, `Dockerfile`, `proxy/nginx.conf`, `proxy/securityheaders.conf` and `client.yaml` files
This should have downloaded the `.eslintrc.cjs`, `.prettierignore`, `.prettierrc.jr`, `tsconfig.json`, `env.sh`, `Dockerfile`, `proxy/nginx.conf`, `proxy/securityheaders.conf` and github actions workflow files

## Notes

Expand Down
23 changes: 23 additions & 0 deletions config/config_files/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build
on:
workflow_call:
jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3

- name: Install dependencies
working-directory: client
run: npm ci

- name: Build
working-directory: client
run: npm run build
12 changes: 12 additions & 0 deletions config/config_files/workflows/build_docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Build docker image
on:
workflow_call:
jobs:
build-docker:
name: Build client docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the docker image
working-directory: client
run: docker build . --file Dockerfile
Original file line number Diff line number Diff line change
@@ -1,82 +1,7 @@
name: Client actions

name: Check Config files
on:
pull_request:
branches: [main, master, develop, development, staging]
paths:
- 'client/**'
- '.github/workflows/client.yaml'

workflow_call:
jobs:
lint:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3

- name: Install dependencies
working-directory: client
run: npm ci

- name: Linting
working-directory: client
run: npm run lint

test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3

- name: Install dependencies
working-directory: client
run: npm ci

- name: Unit tests
working-directory: client
run: npm run test:ci --passWithNoTests

build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3

- name: Install dependencies
working-directory: client
run: npm ci

- name: Build
working-directory: client
run: npm run build

build-docker:
name: Build client docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the docker image
working-directory: client
run: docker build . --file Dockerfile

check_configs:
name: Compare local to remote config files
runs-on: ubuntu-latest
Expand Down
23 changes: 23 additions & 0 deletions config/config_files/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint
on:
workflow_call:
jobs:
lint:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3

- name: Install dependencies
working-directory: client
run: npm ci

- name: Linting
working-directory: client
run: npm run lint
Loading
Loading