Skip to content

Commit

Permalink
chore: clearly separate out GitHub and Heroku build tools (hedyorg#934)
Browse files Browse the repository at this point in the history
We have build tools that run in 2 different environments: GitHub
workflows and Heroku buildpacks.

Between them, the dependencies are different and they are installed
differently. Make the distinction very clear, otherwise it's going to
get confusing.

Move Tailwind into the build-tools, as contributors never need to see
this directory any more.
  • Loading branch information
rix0rrr authored Oct 9, 2021
1 parent 5cc977c commit 2a8d544
Show file tree
Hide file tree
Showing 18 changed files with 23 additions and 24 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,5 @@ jobs:
run: |
python3 -m pip install --upgrade pip
pip3 install -r requirements.txt
- name: Test Python for errors
run: build-tools/validate-python
- name: Test with unittest
run: build-tools/validate-tests
- name: Validate YAML
run: build-tools/validate-yaml
- name: Run end-to-end tests
run: build-tools/validate-e2e
- name: Run validations
run: build-tools/github/validate
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions build-tools/validate → build-tools/github/validate
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/bash
# Run all validation scripts
# Run all validation scripts.
# This script runs on GitHub in the PR build, NOT ON HEROKU. It can therefore not
# rely on the dependencies of the top-level package.json having been installed.
set -eu
scriptdir=$(cd $(dirname $0) && pwd)


$scriptdir/validate-python
$scriptdir/validate-tests
$scriptdir/validate-yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -eu
scriptdir=$(cd $(dirname $0) && pwd)

# This is expected to run from the repo root
cd $scriptdir/..
cd $scriptdir/../..

pids=""
trap 'kill $pids' EXIT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Run pylint against all Python code
set -eu
scriptdir=$(cd $(dirname $0) && pwd)
cd $scriptdir/..
cd $scriptdir/../..

# There are MANY pep8 style violations in the code base currently.
# Let's just check for definite errors.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Helper script to run unit tests
set -eu
scriptdir=$(cd $(dirname $0) && pwd)
cd $scriptdir/..
cd $scriptdir/../..

# This is expected to run from the repo root
python -m unittest discover -s tests
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const yaml = require ('yaml');

const ajv = new (require ('ajv'));

const path = require ('path').join (process.argv [2], '../coursedata/texts') + '/';
const path = require ('path').join (process.argv [2], '../../coursedata/texts') + '/';

// The English translation is our reference
const texts = yaml.parse (fs.readFileSync(path + 'en.yaml', 'utf8'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ npm ci --silent
# If we ever care enough to do something about this, we should be interpreting
# the JSON error outputs of this tool and re-interpreting them with useful
# error messages.
cd ../coursedata/adventures/
cd ../../coursedata/adventures/
$scriptdir/node_modules/.bin/pajv validate \
--errors=text \
-s "adventures.schema.json" \
Expand Down
2 changes: 2 additions & 0 deletions build-tools/on-deploy.sh → build-tools/heroku/on-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#
#----------------------------------------------------------------------
set -eu
scriptdir=$(cd $(dirname $0) && pwd)
cd $scriptdir

# Do a minimizing build of Tailwind. Generates the tailwind css, and strip
# all CSS classes that aren't used in our application (determined by searching
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions build-tools/heroku/tailwind/generate-css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -eu
scriptdir=$(cd $(dirname $0) && pwd)
cd $scriptdir

staticdir=../../../static

npx tailwindcss build styles.css -o $staticdir/css/generated.css
npx minify $staticdir/css/generated.css > $staticdir/css/generated.css.min
mv $staticdir/css/generated.css{.min,}
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"url": "git+https://github.com/Felienne/hedy.git"
},
"scripts": {
"build": "build-tools/on-deploy.sh"
"build": "build-tools/heroku/on-deploy.sh"
},
"devDependencies": {
"minify": "^7.0.1",
Expand Down
8 changes: 0 additions & 8 deletions tailwind/generate-css

This file was deleted.

0 comments on commit 2a8d544

Please sign in to comment.