Skip to content

Commit

Permalink
CI: Build GitHub Pages bundle on-the-fly
Browse files Browse the repository at this point in the history
Builds all the JS and CSS files required for the demo pages in `gh-pages.yml` via GitHub Actions. Removes the necessity of having the JS bundles at `/docs/demos/dist`, as they will be compiled on every commit to `main`.

Please confirm that, under Settings > Pages > Build and deployment (https://github.com/fiduswriter/simple-datatables/settings/pages), the "Source" field is set to "GitHub Actions".

I have checked out `package-lock.json` to make builds deterministic - building the library now or building it in ten months should generate the same code and dependency tree.
  • Loading branch information
SandroHc committed Nov 20, 2023
1 parent 6d3d6da commit e893fa9
Show file tree
Hide file tree
Showing 11 changed files with 6,710 additions and 5,874 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Update docs
on:
push:
branches: ["main"]
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Build JS bundle
run: npm ci
- name: Build site
uses: actions/jekyll-build-pages@v1
with:
source: ./docs
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v2

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
22 changes: 12 additions & 10 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
name: simple-datatables CI
name: Check lints

on: [push]
on: [pull_request, push]

jobs:
build:

lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- run: npm install
- run: npm run lint
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lints
run: npm run lint
25 changes: 14 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
name: simple-datatables CI
name: Check tests

on: [push]
on: [pull_request, push]

jobs:
build:

test:
runs-on: ubuntu-latest

steps:
- run: sudo apt update && sudo apt install -y google-chrome-stable
- name: Checkout
uses: actions/checkout@v3
- name: Setup Chrome
run: sudo apt update && sudo apt install -y google-chrome-stable
- run: /usr/bin/google-chrome-stable --version
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- run: npm install
cache: 'npm'
- name: Install dependencies
run: npm ci
- uses: jamesmortensen/chromedriver-matcher-action@v1
- run: npm test
- name: Tests
run: npm test
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/dist/
/docs/demos/dist/
node_modules/
tests/qunit.css
package-lock.json
.DS_Store
.idea/
.python-version
Expand Down
30 changes: 0 additions & 30 deletions docs/demos/dist/css/column_filter.css

This file was deleted.

206 changes: 0 additions & 206 deletions docs/demos/dist/css/editing.css

This file was deleted.

Loading

0 comments on commit e893fa9

Please sign in to comment.