Skip to content

Commit

Permalink
Merge pull request #197 from freee/develop
Browse files Browse the repository at this point in the history
RELEASE Ver. 202403.0 (2024-03-04)
  • Loading branch information
ma10 authored Mar 4, 2024
2 parents 44baaa3 + e3d5672 commit 08d8feb
Show file tree
Hide file tree
Showing 584 changed files with 12,093 additions and 1,741 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ jobs:
BASE_URL: https://a11y-guidelines.freee.co.jp/
TZ: JST-9
run: |
make SPHINXOPTS="-W -D html_baseurl=${BASE_URL}" clean html
make sphinx_options="-W" clean html
- name: Check for unreferenced include files
run: make check-includes
- name: Run sphinx-lint
run: sphinx-lint ./source/**/*.rst
run: |
sphinx-lint ./ja/source/**/*.rst
sphinx-lint ./en/source/**/*.rst
76 changes: 46 additions & 30 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,38 +38,57 @@ jobs:
run: python -m pip install -r requirements.txt --upgrade

- name: Prepare file upload directory with the archive directory
run: mkdir -p ${GITHUB_WORKSPACE}/upload/archive
run: |
mkdir -p ${GITHUB_WORKSPACE}/upload/archive
mkdir -p ${GITHUB_WORKSPACE}/upload/en
- name: Download the existing archive files from S3
env:
AWS_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
run: aws s3 sync --delete s3://${AWS_BUCKET}/archive/ ${GITHUB_WORKSPACE}/upload/archive/ --quiet
# Disable this for the time being, until we have a proper archive
# - name: Download the existing archive files from S3
# env:
# AWS_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
# run: aws s3 sync --delete s3://${AWS_BUCKET}/archive/ ${GITHUB_WORKSPACE}/upload/archive/ --quiet

- name: Build HTML of all releases, with gtag.js, and OGP tags
env:
GTM_ID: ${{ secrets.GTM_ID }}
BASE_URL: https://a11y-guidelines.freee.co.jp/
run: |
make SPHINXOPTS="-A gtm_id=${GTM_ID} -D html_baseurl=${BASE_URL}" clean html
cp -r ./data/json/schemas ./build/html
cp -r ./build/html/* ${GITHUB_WORKSPACE}/upload
make SPHINXOPTS="-A gtm_id=${GTM_ID} -D html_baseurl=${BASE_URL}/current/" clean html
cp -r ./data/json/schemas ./build/html
cp -r ./build/html/* ${GITHUB_WORKSPACE}/upload
mkdir -p ${GITHUB_WORKSPACE}/upload/current
cp -r ./build/html/* ${GITHUB_WORKSPACE}/upload/current
make BASE_URL=https://a11y-guidelines.freee.co.jp/ sphinx_options="-A gtm_id=${GTM_ID}" clean html
cp -r ./ja/build/html/* ${GITHUB_WORKSPACE}/upload
cp -r ./en/build/html/* ${GITHUB_WORKSPACE}/upload/en
cp -r ./data/json/schemas ${GITHUB_WORKSPACE}/upload
make BASE_URL=https://a11y-guidelines.freee.co.jp/current/ sphinx_options="-A gtm_id=${GTM_ID}" clean html
mkdir -p ${GITHUB_WORKSPACE}/upload/current/en
cp -r ./ja/build/html/* ${GITHUB_WORKSPACE}/upload/current
cp -r ./en/build/html/* ${GITHUB_WORKSPACE}/upload/current/en
cp -r ./data/json/schemas ${GITHUB_WORKSPACE}/upload/current
make clean
current_commit=$(git rev-parse HEAD)
rm -rf ${GITHUB_WORKSPACE}/upload/archive/${TAG}
for _tag in `git tag` ; do \
echo "Processing ${_tag}..." ; \
if [ ! -d ${GITHUB_WORKSPACE}/upload/archive/${_tag} ] ; then \
git checkout ${_tag} ; \
make SPHINXOPTS="-A gtm_id=${GTM_ID} -D html_baseurl=${BASE_URL}/${_tag}" html ; \
if [ -d ./data/json/schemas ]; then \
cp -r ./data/json/schemas ./build/html ; \
if [ ! -f ./build.mk ]; then
build_procedure=0 ; \
else \
build_procedure=`make build-procedure-version` ; \
fi ; \
if [ ${build_procedure} -eq 0 ]; then
make SPHINXOPTS="-A gtm_id=${GTM_ID} -D html_baseurl=https://a11y-guidelines.freee.co.jp/archive/${_tag}/" html ; \
if [ -d ./data/json/schemas ]; then \
cp -r ./data/json/schemas ./build/html ; \
fi ; \
cp -r ./build/html ${GITHUB_WORKSPACE}/upload/archive/${_tag} ; \
elif [ ${build_procedure} -eq 1 ]; then \
make BASE_URL=https://a11y-guidelines.freee.co.jp/archive/${_tag}/ sphinx_options="-A gtm_id=${GTM_ID}" clean html ; \
mkdir -p ${GITHUB_WORKSPACE}/upload/archive/${_tag}/en ; \
cp -r ./ja/build/html/* ${GITHUB_WORKSPACE}/upload/archive/${_tag} ; \
cp -r ./en/build/html/* ${GITHUB_WORKSPACE}/upload/archive/${_tag}/en
cp -r ./data/json/schemas ${GITHUB_WORKSPACE}/upload/archive/${_tag} ; \
else \
echo "Unknown build procedure version: ${build_procedure}" ; \
exit 1 ; \
fi ; \
cp -r ./build/html ${GITHUB_WORKSPACE}/upload/archive/${_tag} ; \
make clean ; \
git checkout ${current_commit} ; \
fi ; \
Expand All @@ -82,9 +101,10 @@ jobs:

- name: Prepare the HTML Archive
run: |
make clean html
cp -r ./data/json/schemas ./build/html
mv ./build/html ./freee-a11y-guidelines-${TAG}
make BASE_URL=/ clean html
mv ./ja/build/html ./freee-a11y-guidelines-${TAG}
cp -r ./data/json/schemas ./freee-a11y-guidelines-${TAG}
cp -r ./en/build/html ./freee-a11y-guidelines-${TAG}/en
zip -r ${GITHUB_WORKSPACE}/freee-a11y-guidelines-${TAG}-html.zip ./freee-a11y-guidelines-${TAG}
- name: Create Release
Expand Down Expand Up @@ -128,21 +148,17 @@ jobs:
run: python -m pip install -r requirements.txt --upgrade

- name: Prepare file upload directory with the archive directory
run: mkdir -p ${GITHUB_WORKSPACE}/upload/current

- name: Download the existing archive files from S3
env:
AWS_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
run: aws s3 sync --delete s3://${AWS_BUCKET}/current/ ${GITHUB_WORKSPACE}/upload/current/ --quiet
run: mkdir -p ${GITHUB_WORKSPACE}/upload/current/en

- name: Build HTML with gtag.js, and OGP tags
env:
GTM_ID: ${{ secrets.GTM_ID }}
BASE_URL: https://a11y-guidelines.freee.co.jp/current/
run: |
make SPHINXOPTS="-A gtm_id=${GTM_ID} -D html_baseurl=${BASE_URL} -t current" clean html
cp -r ./data/json/schemas ./build/html
cp -r ./build/html/* ${GITHUB_WORKSPACE}/upload/current/
make sphinx_options="-A gtm_id=${GTM_ID} -t current" clean html
cp -r ./data/json/schemas ./ja/build/html
cp -r ./ja/build/html/* ${GITHUB_WORKSPACE}/upload/current/
cp -r ./en/build/html/* ${GITHUB_WORKSPACE}/upload/current/en
- name: Publish to S3
env:
Expand Down
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
html/*
node_modules/*
.vscode/*
build/*
source/__pycache__/*
source/inc/*
source/faq/*
*/build/*
*/source/inc/*
*/source/faq/*
.DS_Store
/incfiles.mk
*/incfiles.mk
__pycache__/
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
77 changes: 28 additions & 49 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,54 +1,33 @@
PYTHON?= python
YAML2RST= $(PYTHON) tools/yaml2rst/yaml2rst.py
BUILD_PROCEDURE_VERSION = 1
SUBDIRS = ja en

# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build
SPHINX_PREDEFINED_TARGETS := $(shell $(SPHINXBUILD) -M help . .|sed -r '/^\S+/d;s/^\s+(\S+).+/\1/;/^clean/d')
PREDEFINED_TARGETS = $(SPHINX_PREDEFINED_TARGETS) check-includes
INCLUDED_FILES := $(shell grep -ohRE '^\.\. include:: +.+' $(SOURCEDIR) | sed -r "s%^\.\. include:: +%$(SOURCEDIR)%")
export ROOTDIR = $(CURDIR)
export SPHINXBUILD ?= sphinx-build
export SPHINX_PREDEFINED_TARGETS := $(shell $(SPHINXBUILD) -M help . .|sed -r '/^\S+/d;s/^\s+(\S+).+/\1/;/^clean/d')
export PREDEFINED_TARGETS = check-includes clean
export ALL_PREDEFINED_TARGETS = $(SPHINX_PREDEFINED_TARGETS) $(PREDEFINED_TARGETS)

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: all $(SUBDIRS) $(ALL_PREDEFINED_TARGETS) build-procedure-version

.PHONY: help incfiles clean Makefile
all: html

incfiles.mk: $(wildcard data/yaml/gl/*/*.yaml data/yaml/checks/*/*.yaml data/yaml/faq/**/*.yaml)
@if [ ! -f incfiles.mk ]; then \
${YAML2RST}; \
else \
${YAML2RST} incfiles.mk; \
fi

incfiles:| $(SOURCEDIR)/inc

ifneq ($(filter $(MAKECMDGOALS),$(PREDEFINED_TARGETS)),)
include incfiles.mk
endif

#
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
$(SPHINX_PREDEFINED_TARGETS): incfiles.mk incfiles Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

clean:
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@$(RM) -rf $(SOURCEDIR)/inc $(SOURCEDIR)/faq incfiles.mk

$(SOURCEDIR)/inc:
@$(YAML2RST)

check-includes:
@for file in $(ALL_INC_FILES); do \
if ! echo $(INCLUDED_FILES) | grep -q $$file; then \
echo "Error: File $$file is not referenced"; \
exit 1; \
fi; \
$(ALL_PREDEFINED_TARGETS):
@for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir $@ || exit 1; \
done

# $(SUBDIRS):
# @target="$(MAKECMDGOALS)"; \
# for subdir_target in $(ALL_PREDEFINED_TARGETS); do \
# if [ "$$target" = "$$subdir_target" ]; then \
# echo "Running make $$target in subdirectory $@"; \
# $(MAKE) -C $@ $$target || exit 1; \
# break; \
# fi; \
# done

# %: $(SUBDIRS)
# @:

build-procedure-version:
@echo $(BUILD_PROCEDURE_VERSION)
57 changes: 57 additions & 0 deletions build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
rootdir = $(ROOTDIR)
PYTHON?= python
YAML2RST= $(PYTHON) $(rootdir)/tools/yaml2rst/yaml2rst.py -b $(rootdir) -l $(lang)

ifneq ($(BASE_URL),)
html_baseurl = $(BASE_URL)
else
html_baseurl =
endif
baseurl_ja = $(html_baseurl)
baseurl_en = $(html_baseurl)en/
base_url_options=-D html_baseurl=$(html_baseurl)$(base_url_suffix) -A baseurl_ja=$(baseurl_ja) -A baseurl_en=$(baseurl_en)

SPHINXOPTS= $(sphinx_options) $(base_url_options)
SOURCEDIR = source
BUILDDIR = build
INCLUDED_FILES := $(shell grep -ohRE '^\.\. include:: +.+' $(SOURCEDIR) | sed -r "s%^\.\. include:: +%$(CURDIR)/$(SOURCEDIR)%")

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help incfiles clean Makefile $(SPHINX_PREDEFINED_TARGETS)

incfiles.mk: $(wildcard $(rootdir)/data/yaml/gl/*/*.yaml $(rootdir)/data/yaml/checks/*/*.yaml $(rootdir)/data/yaml/faq/**/*.yaml)
@if [ ! -f incfiles.mk ]; then \
${YAML2RST}; \
else \
${YAML2RST} incfiles.mk; \
fi

incfiles:| $(SOURCEDIR)/inc

ifneq ($(filter $(MAKECMDGOALS),$(ALL_PREDEFINED_TARGETS)),)
include incfiles.mk
endif

#
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
$(SPHINX_PREDEFINED_TARGETS): incfiles.mk incfiles Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

clean:
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@$(RM) -rf $(SOURCEDIR)/inc $(SOURCEDIR)/faq incfiles.mk

$(SOURCEDIR)/inc:
@$(YAML2RST)

check-includes:
@for file in $(ALL_INC_FILES); do \
if ! echo $(INCLUDED_FILES) | grep -q $$file; then \
echo "Error: File $$file is not referenced"; \
exit 1; \
fi; \
done
4 changes: 2 additions & 2 deletions data/json/schemas/check.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"properties": {
"title": {
"description": "purpose of the implementation",
"type": "string"
"$ref": "common.json#/definitions/i18nString"
},
"methods": {
"description": "one or more methods of the implementation, set of target platform and the specific implementation method",
Expand All @@ -124,7 +124,7 @@
},
"method": {
"description": "an example of how to implement",
"type": "string"
"$ref": "common.json#/definitions/i18nString"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion data/json/schemas/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
},
"additionalProperties": false,
"required": ["ja"]
"required": ["ja", "en"]
}
}

Expand Down
4 changes: 2 additions & 2 deletions data/json/schemas/guideline.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
},
"guideline": {
"description": "main text of the guideline",
"type": "string"
"$ref": "common.json#/definitions/i18nString"
},
"sc": {
"description": "WCAG SC the guideline corresponds to",
Expand All @@ -63,7 +63,7 @@
},
"intent": {
"description": "who benefits and how from the guideline",
"type": "string"
"$ref": "common.json#/definitions/i18nString"
},
"checks": {
"description": "IDs of the checks for conformance to the guideline",
Expand Down
Loading

0 comments on commit 08d8feb

Please sign in to comment.