Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
8613ae6
Removes hard-coded reference to theme directory in PHP
matt-bernhardt Oct 30, 2019
34a7415
Implements mitlib.themeUrl for paths in loaded javascript
matt-bernhardt Oct 30, 2019
2647660
Updates file paths in SCSS
matt-bernhardt Nov 1, 2019
11a4b25
Bumps theme version to 2.0.0
matt-bernhardt Jul 23, 2020
e57f826
Merge pull request #2 from matt-bernhardt/nti-563-agnostic
matt-bernhardt Feb 17, 2022
f3b0373
Adds basic composer.json
matt-bernhardt Feb 17, 2022
1650375
More renaming of project files, and easy npm updates
matt-bernhardt Feb 17, 2022
535a9af
Merge pull request #1 from matt-bernhardt/build-step
matt-bernhardt Feb 17, 2022
7f8d323
Create php.yml
matt-bernhardt Feb 17, 2022
c07c8ce
Fix license in composer.json
matt-bernhardt Feb 17, 2022
05ec9f6
Extend PHP workflow with real build
matt-bernhardt Feb 17, 2022
0f90d4f
Forcing empty build directories
matt-bernhardt Feb 17, 2022
96246b8
Skip sass under Grunt
matt-bernhardt Feb 17, 2022
7e6794a
Adds development release workflow
matt-bernhardt Feb 17, 2022
918884a
Merge pull request #4 from matt-bernhardt/engx-117-actions-rebuild
matt-bernhardt Mar 16, 2022
92c864a
Update build workflows based on lessons learned in other projects
matt-bernhardt Mar 16, 2022
9edfaf0
Merge pull request #5 from matt-bernhardt/build-tweaks
matt-bernhardt Mar 17, 2022
2354b8b
Adds settings form for loading alert messages
matt-bernhardt Mar 18, 2022
a027faa
Merge pull request #6 from matt-bernhardt/engx-147-alert-support
matt-bernhardt Mar 18, 2022
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
125 changes: 125 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: PHP Composer

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-

- name: Install Composer dependencies
run: composer install --prefer-dist --no-progress

- name: Install NPM packages
run: npm install

- name: Compile global # 2a. The actual build - the next three steps are Sass compiling...
uses: gha-utilities/sass-build@v0.2.2
with:
source: css/global.scss
destination: css/build/global.css
- name: Compile forms
uses: gha-utilities/sass-build@v0.2.2
with:
source: css/forms.scss
destination: css/build/forms.css
- name: Compile hours
uses: gha-utilities/sass-build@v0.2.2
with:
source: css/hours.scss
destination: css/build/hours.css
- name: Run Grunt steps # 2b. The rest of the build after Sass happens through Grunt (see
# Gruntfile.js)
run: grunt default

- name: DEBUG inspect build output # At this point, the build is complete. We just need to get the
# output into a state that can be distributed.
# The next few steps confirm that we've built what we expect (the
# stylesheet should have branch information, and there should be built
# css and js files)
run: git status
- name: DEBUG confirm git branch/commit in stylesheet
run: head style.css
- name: DEBUG confirm CSS build output
run: ls -lR ./css/build/
- name: DEBUG confirm JS build output
run: ls -lR ./js/build/

- name: Store build result as an artifact # At the end of the build process, we store those files needed for
# use (templates, stylesheets, scripts, images, etc) as an artifact.
# That artifact will be retrieved and committed to the release
# branch below.
uses: actions/upload-artifact@v2
with:
name: build-artifact
path: |
css
!css/**/*.scss
fonts
images
inc
js
languages
lib
libs
composer.json
*.css
*.php
*.png
*.html

development_release:
needs: build # This takes the build output from the build-artifact, commits it on a
# separate `tesseract` branch, and pushes that back to GitHub. That
# new commit can then be tagged - manually - to create the release
# which Composer looks for during site deploys.
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: tesseract
- name: DEBUG confirm our place in git tree
run: git log --oneline --decorate --graph --all
- name: Retrieve build artifacts
uses: actions/download-artifact@v2
with:
name: build-artifact
- name: Stage changed files for commit
run: |
git config --local user.email 'action@github.com'
git config --local user.name 'GitHub Action'
git add .
- name: Force-add built content (stylesheets and javascript) - necessary because of .gitignore
run: |
git add -f css/build/*
git add -f js/build/*
- name: DEBUG Confirm scope of changes to be committed
run: git status
- name: Commit changes # TODO - could we get a better commit message?
run: |
git commit -m 'Updates theme including compiled assets'
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: tesseract
41 changes: 41 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Supported PHP
on: push
defaults:
run:
shell: bash

jobs:
composer_validate:
runs-on: ubuntu-latest

strategy:
matrix:
php-versions: ['7.2', '7.4']

env:
WPCS_PATH: "$GITHUB_WORKSPACE/vendor/wp-coding-standards/wpcs"

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}

- uses: actions/checkout@v2

- name: Syntax check PHP before dependencies
run: find . -path ./libs -prune -o \( -name '*.php' \) -exec php -lf {} \;

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Install Composer dependencies
run: composer install --prefer-dist --no-progress

- name: Install WordPress coding standards
run: ./vendor/bin/phpcs --config-set installed_paths ${{env.WPCS_PATH}}

# We only apply the security-focused tests using GitHub Actions. To run the full set of tests, use `composer lint`
# on the command line.
- name: Check code against WordPress security standards
run: ./vendor/bin/phpcs -psvn . --standard=./codesniffer.security.xml --extensions=php
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ node_modules/
css/build/**
js/build/**
/style.css

/vendor/
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = function(grunt) {
// 1) Javascript preparation (concatenating and uglifying scripts)
grunt.registerTask('javascript', ['concat', 'uglify']);
// 2) Stylesheet preparation (SASS, autoprefixing, and minification)
grunt.registerTask('styles', ['sass', 'autoprefixer', 'cssmin']);
grunt.registerTask('styles', ['autoprefixer', 'cssmin']);
// 3) Appending the most recent git commit to the theme version
grunt.registerTask('release', ['gitinfo', 'replace']);
// The default task performs all three phases.
Expand Down
3 changes: 2 additions & 1 deletion codesniffer.local.xml → codesniffer.full.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
<exclude-pattern>/libs/*</exclude-pattern>
<exclude-pattern>/navwalker.php</exclude-pattern>
<exclude-pattern>/node_modules/*</exclude-pattern>
<exclude-pattern>/vendor/*</exclude-pattern>

<!-- Include the WordPress ruleset, with exclusions. -->
<rule ref="WordPress"></rule>
</ruleset>
</ruleset>
3 changes: 2 additions & 1 deletion codesniffer.mitlib.xml → codesniffer.security.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<exclude-pattern>/libs/*</exclude-pattern>
<exclude-pattern>/navwalker.php</exclude-pattern>
<exclude-pattern>/node_modules/*</exclude-pattern>
<exclude-pattern>/vendor/*</exclude-pattern>

<!-- Include the WordPress ruleset, with exclusions. -->
<rule ref="WordPress">
Expand All @@ -29,4 +30,4 @@
<exclude name="WordPress.WP" />
<exclude name="WordPress.WhiteSpace" />
</rule>
</ruleset>
</ruleset>
24 changes: 24 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "mjbernha/mitlib-tesseract",
"description": "A parent theme for the Pentagram-designed branding of the MIT Libraries",
"type": "wordpress-theme",
"license": "GPL-3.0-only",
"authors": [
{
"name": "Matt Bernhardt",
"email": "mjbernha@mit.edu"
}
],
"require": {},
"require-dev": {
"wp-coding-standards/wpcs": "^2.3",
"squizlabs/php_codesniffer": "^3.6"
},
"scripts": {
"lint": [
"composer validate --no-check-publish --strict",
"./vendor/bin/phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs",
"./vendor/bin/phpcs -psvn . --standard=codesniffer.full.xml"
]
}
}
126 changes: 126 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added css/build/.gitkeep
Empty file.
4 changes: 2 additions & 2 deletions css/modules/_paths.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
$imagesPath: /wp-content/themes/libraries/images;
$libsPath: "/wp-content/themes/libraries/libs";
$imagesPath: '../../../images';
$libsPath: '../../../libs';
14 changes: 14 additions & 0 deletions css/partials/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,20 @@
font-size: 1em;
}
}
.callout.widget {
background: #e4e4e4 ;
border-top: 2px solid #c63 ;
padding-left: 20px ;
padding-right: 20px ;
padding-top: 15px ;
padding-bottom: 15px ;
margin-bottom: 20px;
}
.hide-title {
.widget-title {
display: none;
}
}
.no-top-border {
border-top: none;
}
Expand Down
Loading