Skip to content

Commit

Permalink
Initial tox and gitbub actions: avoid getting stale css
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarIthawi committed Apr 8, 2021
1 parent e0f3461 commit cf4fee1
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: customer themes

on:
push:
branches: ['juniper/tahoe']
pull_request:

jobs:
test:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [3.8]
tox-env:
- verify
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install tox
- name: Test with tox
run: tox -e ${{ matrix.tox-env }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
.tox
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Customer-specific theme
This repo has the customer themes.

## How to: Compile the `amc-specific.scss` file

On your devstack run:

```
$ tox -e compile
```

Commit the changes and make a pull request.
5 changes: 5 additions & 0 deletions scripts/compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -ex

# Run via `tox -e compile`
pysassc cms/static/sass/amc-specific.scss cms/static/css/amc-specific.css
15 changes: 15 additions & 0 deletions scripts/verify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -ex

# Run this script via `$ tox -e verify`
if git diff-index --quiet HEAD --; then
echo "Success: The CSS file is in sync with the SCSS file."
else
echo "Error: CSS is out of sync"
echo "=== Start: Git diff ==="
git --no-pager diff
echo "=== End: Git diff ==="
echo 'Error: The CSS file is out of sync with the SCSS file.'
echo 'The git diff above shows the difference.'
echo 'Please use "$ tox -e compile" locally to compile the SCSS file.'
fi
19 changes: 19 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[tox]
envlist = compile,verify
skipsdist = True

[testenv]
basepython=python3
deps = libsass==0.20.1
allowlist_externals =
bash

[testenv:compile]
commands =
bash {toxinidir}/scripts/compile.sh

[testenv:verify]
commands =
bash {toxinidir}/scripts/compile.sh
bash {toxinidir}/scripts/verify.sh

0 comments on commit cf4fee1

Please sign in to comment.