-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'bugfix/deploy_commit_sha1' into 'master'
deploy: fix symlinking failing if git commit ID differed in number of digits See merge request espressif/esp-docs!36
- Loading branch information
Showing
9 changed files
with
100 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[metadata] | ||
name = esp-docs | ||
version = 1.2.0 | ||
version = 1.2.1 | ||
author = Espressif | ||
author_email = [email protected] | ||
description = Documentation building package used at Espressif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import unittest | ||
import tempfile | ||
import tarfile | ||
|
||
from distutils.dir_util import copy_tree | ||
from string import Template | ||
from esp_docs.deploy_docs import build_doc_tarball | ||
|
||
|
||
class TestBuildTarball(unittest.TestCase): | ||
BUILD_DIR_TEMPLATE_PATH = '_build_deploy' | ||
PDF_NAME_TEMPLATE = Template('esp-idf-$lang-$ver-esp32.pdf') | ||
VERSION = 'v5.1-dev-50-g790aa40c38' | ||
|
||
LANGUAGES = ['en', 'zh_CN'] | ||
|
||
def setUp(self): | ||
self.temp_dir = tempfile.TemporaryDirectory() | ||
|
||
copy_tree(self.BUILD_DIR_TEMPLATE_PATH, self.temp_dir.name) | ||
|
||
def tearDown(self): | ||
self.temp_dir.cleanup() | ||
|
||
def check_file_exists(self, tarball_path, file_names): | ||
with tarfile.open(tarball_path) as f: | ||
output = f.getnames() | ||
for name in file_names: | ||
self.assertTrue(any(name in o for o in output)) | ||
|
||
def test_build_tarball_tag(self): | ||
version_pdfs = [self.PDF_NAME_TEMPLATE.substitute(ver=self.VERSION, lang=lang) for lang in self.LANGUAGES] | ||
tarball_path, _ = build_doc_tarball('v4.1.0', None, self.temp_dir.name) | ||
|
||
self.check_file_exists(tarball_path, version_pdfs) | ||
|
||
def test_build_tarball_latest(self): | ||
latest_pdfs = [self.PDF_NAME_TEMPLATE.substitute(ver='latest', lang=lang) for lang in self.LANGUAGES] | ||
version_pdfs = [self.PDF_NAME_TEMPLATE.substitute(ver=self.VERSION, lang=lang) for lang in self.LANGUAGES] | ||
tarball_path, _ = build_doc_tarball('latest', self.VERSION, self.temp_dir.name) | ||
|
||
self.check_file_exists(tarball_path, version_pdfs) | ||
self.check_file_exists(tarball_path, latest_pdfs) | ||
|
||
def test_build_tarball_stable(self): | ||
stable_pdfs = [self.PDF_NAME_TEMPLATE.substitute(ver='stable', lang=lang) for lang in self.LANGUAGES] | ||
version_pdfs = [self.PDF_NAME_TEMPLATE.substitute(ver=self.VERSION, lang=lang) for lang in self.LANGUAGES] | ||
tarball_path, _ = build_doc_tarball('stable', self.VERSION, self.temp_dir.name) | ||
|
||
self.check_file_exists(tarball_path, version_pdfs) | ||
self.check_file_exists(tarball_path, stable_pdfs) | ||
|
||
# Different git repos using different numbers of digits for a commit ID | ||
# depending on how many is needed for a unique description | ||
# Check symlink succeeds even if they dont fully match | ||
def test_build_tarball_latest_short_sha1(self): | ||
latest_pdfs = [self.PDF_NAME_TEMPLATE.substitute(ver='latest', lang=lang) for lang in self.LANGUAGES] | ||
version_pdfs = [self.PDF_NAME_TEMPLATE.substitute(ver=self.VERSION, lang=lang) for lang in self.LANGUAGES] | ||
|
||
version_short_sha1 = self.VERSION[:-1] | ||
tarball_path, _ = build_doc_tarball('latest', version_short_sha1, self.temp_dir.name) | ||
|
||
self.check_file_exists(tarball_path, version_pdfs) | ||
self.check_file_exists(tarball_path, latest_pdfs) | ||
|
||
def test_build_tarball_latest_long_sha1(self): | ||
latest_pdfs = [self.PDF_NAME_TEMPLATE.substitute(ver='latest', lang=lang) for lang in self.LANGUAGES] | ||
version_pdfs = [self.PDF_NAME_TEMPLATE.substitute(ver=self.VERSION, lang=lang) for lang in self.LANGUAGES] | ||
|
||
version_long_sha1 = self.VERSION + '5' | ||
tarball_path, _ = build_doc_tarball('latest', version_long_sha1, self.temp_dir.name) | ||
|
||
self.check_file_exists(tarball_path, version_pdfs) | ||
self.check_file_exists(tarball_path, latest_pdfs) | ||
|
||
def test_build_tarball_latest_random_sha(self): | ||
latest_pdfs = [self.PDF_NAME_TEMPLATE.substitute(ver='latest', lang=lang) for lang in self.LANGUAGES] | ||
version_pdfs = [self.PDF_NAME_TEMPLATE.substitute(ver=self.VERSION, lang=lang) for lang in self.LANGUAGES] | ||
|
||
version_long_sha1 = 'ra1n-dom-ID' | ||
tarball_path, _ = build_doc_tarball('latest', version_long_sha1, self.temp_dir.name) | ||
|
||
self.check_file_exists(tarball_path, version_pdfs) | ||
self.check_file_exists(tarball_path, latest_pdfs) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |