Skip to content

Commit

Permalink
Initialize pip-compile-requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
mitradranirban authored Oct 7, 2024
0 parents commit 14ad878
Show file tree
Hide file tree
Showing 26 changed files with 178,620 additions and 0 deletions.
116 changes: 116 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Build font and specimen

on: push

jobs:
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install sys tools/deps
run: |
sudo apt-get update
sudo apt-get install ttfautohint
sudo snap install yq
- uses: actions/cache@v4
with:
path: ./venv/
key: ${{ runner.os }}-venv-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-venv-
- name: gen zip file name
id: zip-name
shell: bash
# Set the archive name to repo name + "-assets" e.g "MavenPro-assets"
run: echo "ZIP_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')-fonts" >> $GITHUB_ENV

# If a new release is cut, use the release tag to auto-bump the source files
# - name: Bump release
# if: github.event_name == 'release'
# run: |
# . venv/bin/activate
# SRCS=$(yq e ".sources[]" sources/config.yaml)
# TAG_NAME=${GITHUB_REF/refs\/tags\//}
# echo "Bumping $SRCS to $TAG_NAME"
# for src in $SRCS
# do
# bumpfontversion sources/$src --new-version $TAG_NAME;
# done

- name: Build font
run: make build
- name: Check with fontbakery
run: make test
continue-on-error: true
- name: proof
run: make proof
- name: setup site
run: cp scripts/index.html out/index.html
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./out
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.ZIP_NAME }}
path: |
fonts
out
outputs:
zip_name: ${{ env.ZIP_NAME }}

# There are two ways a release can be created: either by pushing a tag, or by
# creating a release from the GitHub UI. Pushing a tag does not automatically
# create a release, so we have to do that ourselves. However, creating a
# release from the GitHub UI *does* push a tag, and we don't want to create
# a new release in that case because one already exists!

release:
name: Create and populate release
needs: build
runs-on: ubuntu-latest
if: contains(github.ref, 'refs/tags/')
env:
ZIP_NAME: ${{ needs.build.outputs.zip_name }}
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- name: Download font artefact files
uses: actions/download-artifact@v4
with:
name: ${{ env.ZIP_NAME }}
path: ${{ env.ZIP_NAME }}
- name: Copy DESCRIPTION.en_us.html to artefact directory
run: cp documentation/DESCRIPTION.en_us.html ${{ env.ZIP_NAME }}/DESCRIPTION.en_us.html
- name: Copy ARTICLE.en_us.html to artefact directory
run: cp documentation/ARTICLE.en_us.html ${{ env.ZIP_NAME }}/ARTICLE.en_us.html
continue-on-error: true
- name: Copy OFL.txt to artefact directory
run: cp OFL.txt ${{ env.ZIP_NAME }}/OFL.txt
- name: Remove proof/fontbakery stuff from release
run: rm -rf ${{ env.ZIP_NAME }}/out
- name: gen release file name
shell: bash
run: echo "RELEASE_ZIP_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')-${{github.ref_name}}" >> $GITHUB_ENV
- name: Create release bundle
run: mv ${{ env.ZIP_NAME }} ${{ env.RELEASE_ZIP_NAME }}; zip -r ${{ env.RELEASE_ZIP_NAME }}.zip ${{ env.RELEASE_ZIP_NAME }}
- name: Check for release
id: create_release
run: |
if ! gh release view ${{ github.ref_name }}; then
git show -s --format=%B ${{ github.ref_name }} | tail -n +4 | gh release create ${{ github.ref_name }} -t ${{ github.ref_name }} -F -
fi
- name: Populate release
run: |
gh release upload ${{ github.ref_name }} ${{ env.RELEASE_ZIP_NAME }}.zip --clobber
- name: Set release live
run: |
gh release edit ${{ github.ref_name }} --draft=false
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
*~
venv
venv-test
build.stamp
proof
fonts
node_modules
package-lock.json
package.json
master_ufo
instance_ufo

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Autosaved by application when editing
######################
*(تم الحفظ تلقائيًا).*
*(automaticky uloženo).*
*(Automatisch gesichert).*
*(Autosaved).*
*(guardado automáticamente).*
*(enregistré automatiquement).*
*(salvato automaticamente).*
*(自動保存).*
*(자동 저장됨).*
*(Salvo Automaticamente).*
*(Автосохранение).*
*(Otomatik Kaydedildi).*
*(自动存储).*
*(已自動儲存).*
3 changes: 3 additions & 0 deletions .templaterc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"files": [".github/**/*", "Makefile", "scripts/**/*", "requirements.txt"]
}
7 changes: 7 additions & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This is the official list of project authors for copyright purposes. The first name in the list (if there are several authors), will appear as "Principal design" in the "about" section of the font specimen on Google Fonts.
# This file is distinct from the CONTRIBUTORS.txt file.
# See the latter for an explanation.
#
# Names should be added to this file as:
# Name or Organization <email address>

10 changes: 10 additions & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This is the list of people who have contributed to this project,
# and includes those not listed in AUTHORS.txt because they are not
# copyright authors. For example, company employees may be listed
# here because their company holds the copyright and is listed there.
#
# When adding J Random Contributor's name to this file, either J's
# name or J's organization's name should be added to AUTHORS.txt
#
# Names should be added to this file as:
# Name <email address>
70 changes: 70 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
SOURCES=$(shell python3 scripts/read-config.py --sources )
FAMILY=$(shell python3 scripts/read-config.py --family )
DRAWBOT_SCRIPTS=$(shell ls documentation/*.py)
DRAWBOT_OUTPUT=$(shell ls documentation/*.py | sed 's/\.py/.png/g')

help:
@echo "###"
@echo "# Build targets for $(FAMILY)"
@echo "###"
@echo
@echo " make build: Builds the fonts and places them in the fonts/ directory"
@echo " make test: Tests the fonts with fontbakery"
@echo " make proof: Creates HTML proof documents in the proof/ directory"
@echo " make images: Creates PNG specimen images in the documentation/ directory"
@echo

build: build.stamp

venv: venv/touchfile

venv-test: venv-test/touchfile

customize: venv
. venv/bin/activate; python3 scripts/customize.py

build.stamp: venv sources/config.yaml $(SOURCES)
rm -rf fonts
(for config in sources/config*.yaml; do . venv/bin/activate; gftools builder $$config; done) && touch build.stamp

venv/touchfile: requirements.txt
test -d venv || python3 -m venv venv
. venv/bin/activate; pip install -Ur requirements.txt
touch venv/touchfile

venv-test/touchfile: requirements-test.txt
test -d venv-test || python3 -m venv venv-test
. venv-test/bin/activate; pip install -Ur requirements-test.txt
touch venv-test/touchfile

test: venv-test build.stamp
TOCHECK=$$(find fonts/variable -type f 2>/dev/null); if [ -z "$$TOCHECK" ]; then TOCHECK=$$(find fonts/ttf -type f 2>/dev/null); fi ; . venv-test/bin/activate; mkdir -p out/ out/fontbakery; fontbakery check-googlefonts -l WARN --full-lists --succinct --badges out/badges --html out/fontbakery/fontbakery-report.html --ghmarkdown out/fontbakery/fontbakery-report.md $$TOCHECK || echo '::warning file=sources/config.yaml,title=Fontbakery failures::The fontbakery QA check reported errors in your font. Please check the generated report.'

proof: venv build.stamp
. venv/bin/activate; mkdir -p out/ out/proof; diffenator2 proof $(shell find fonts/ttf -type f) -o out/proof

images: venv $(DRAWBOT_OUTPUT)

%.png: %.py build.stamp
. venv/bin/activate; python3 $< --output $@

clean:
rm -rf venv
find . -name "*.pyc" -delete

update-project-template:
npx update-template https://github.com/googlefonts/googlefonts-project-template/

update: venv venv-test
venv/bin/pip install --upgrade pip-tools
# See https://pip-tools.readthedocs.io/en/latest/#a-note-on-resolvers for
# the `--resolver` flag below.
venv/bin/pip-compile --upgrade --verbose --resolver=backtracking requirements.in
venv/bin/pip-sync requirements.txt

venv-test/bin/pip install --upgrade pip-tools
venv-test/bin/pip-compile --upgrade --verbose --resolver=backtracking requirements-test.in
venv-test/bin/pip-sync requirements-test.txt

git commit -m "Update requirements" requirements.txt requirements-test.txt
git push
93 changes: 93 additions & 0 deletions OFL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright 20** The My Font Project Authors (https://github.com/googlefonts/googlefonts-project-template)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Loading

0 comments on commit 14ad878

Please sign in to comment.