Skip to content

Commit

Permalink
Introduce more granular GitHub workflows according to the new structu…
Browse files Browse the repository at this point in the history
…re of npm scripts
  • Loading branch information
adamkudrna committed Aug 2, 2023
1 parent 54ef063 commit d425cf7
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 9 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build

on: [ pull_request ]

jobs:
build:
name: Build distribution CSS and JS
runs-on: ubuntu-20.04
strategy:
matrix:
# TODO: Add v18 back (#374) once the docs platform is migrated to a non-Gatsby solution (#373).
# node: [ 16, 18 ]
node: [ 16 ]
steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Set up Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: npm

- name: Print Node.js and npm version
run: node --version && npm --version

- name: Install
run: npm ci

- name: Build
run: npm run build
36 changes: 36 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Docs

on: [ pull_request ]

permissions:
contents: write

jobs:
build:
name: Build Docs
runs-on: ubuntu-20.04
steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x

- name: Get cache ID
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV

- name: Restore Cache
uses: actions/cache@v3
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- name: Install MkDocs
run: pip install 'mkdocs-material>=9.0.0,<10.0.0'

- name: Build MkDocs
run: mkdocs build
31 changes: 31 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Lint

on: [ pull_request ]

jobs:
lint:
name: Lint
runs-on: ubuntu-20.04
strategy:
matrix:
# TODO: Add v18 back (#374) once the docs platform is migrated to a non-Gatsby solution (#373).
# node: [ 16, 18 ]
node: [ 16 ]
steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Set up Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: npm

- name: Print Node.js and npm version
run: node --version && npm --version

- name: Install
run: npm ci

- name: Test
run: npm run lint
7 changes: 5 additions & 2 deletions .github/workflows/release-management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ jobs:
- name: Install
run: npm ci

- name: Build
run: docker compose run --rm node_build_site && docker compose run --rm mkdocs_build_site
- name: Lint
run: npm run lint

- name: Test
run: npm test

- name: Build
run: docker compose run --rm node_build_site && docker compose run --rm mkdocs_build_site

- name: Check package.json for version change
id: check_package_version
uses: EndBug/version-check@v2
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Build and Run Tests
name: Test

on: [ pull_request ]

jobs:
build_and_test:
name: Build and test
test:
name: Test
runs-on: ubuntu-20.04
strategy:
matrix:
Expand All @@ -27,8 +27,5 @@ jobs:
- name: Install
run: npm ci

- name: Build
run: npm run build

- name: Test
run: npm test
1 change: 0 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,3 @@ nav:
- Composition: 'docs/contribute/composition.md'
- CSS Guidelines: 'docs/contribute/css.md'
- Releasing: 'docs/contribute/releasing.md'

0 comments on commit d425cf7

Please sign in to comment.