From a7afc522211037c6bb2ee7fcce30fb752d77a819 Mon Sep 17 00:00:00 2001 From: Adam Kudrna Date: Wed, 2 Aug 2023 22:53:03 +0200 Subject: [PATCH] Introduce more granular GitHub workflows according to the new structure of npm scripts --- .github/workflows/build.yml | 31 ++++++++++++++++++++ .github/workflows/docs.yml | 36 ++++++++++++++++++++++++ .github/workflows/lint.yml | 31 ++++++++++++++++++++ .github/workflows/release-management.yml | 7 +++-- .github/workflows/test.yml | 9 ++---- mkdocs.yml | 1 - 6 files changed, 106 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/docs.yml create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..5113b204 --- /dev/null +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..fac4e72a --- /dev/null +++ b/.github/workflows/docs.yml @@ -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 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..9eea8081 --- /dev/null +++ b/.github/workflows/lint.yml @@ -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 diff --git a/.github/workflows/release-management.yml b/.github/workflows/release-management.yml index 2c3763ff..a7e80ed2 100644 --- a/.github/workflows/release-management.yml +++ b/.github/workflows/release-management.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 59cfcbb4..c48013be 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: @@ -27,8 +27,5 @@ jobs: - name: Install run: npm ci - - name: Build - run: npm run build - - name: Test run: npm test diff --git a/mkdocs.yml b/mkdocs.yml index 2ce80dfc..efcbe2bd 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -122,4 +122,3 @@ nav: - Composition: 'docs/contribute/composition.md' - CSS Guidelines: 'docs/contribute/css.md' - Releasing: 'docs/contribute/releasing.md' -