Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure pipelines #2

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
## Generated if empty string is given at "Please type another file name for output:"
.idea/
## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
#*.bbl
*.bcf
*.blg
#*.blg
*-blx.aux
*-blx.bib
*.run.xml
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

LaTeX шаблон на русском, который включает в себя базовую настройку CI/CD и шаблоны программ на языке Wolfram.

- https://dev.azure.com/PetroKolosovProjects/latex-russian-template

## Последовательность действий для сборки документа

- Установить `MikTeX`: https://miktex.org/download
Expand Down
89 changes: 89 additions & 0 deletions azure-pipelines/azure-pipelines-linux-mshosted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
trigger:
- master
- main
- develop

variables:
- name: 'vmImageName'
value: 'ubuntu-latest'

- name: 'System.Debug'
value: 'true'

- name: StageName
value: 'LaTeX_Build_Ubuntu_Latest'

- name: LatexFileName
value: 'LatexRussianTemplate'

- name: LatexFilePath
value: '$(System.DefaultWorkingDirectory)/src/$(LatexFileName).tex'

- name: OutputDirectory
value: '$(System.DefaultWorkingDirectory)/out'

stages:
- stage: ${{ variables.StageName }}
displayName: ${{ variables.StageName }}
jobs:
- job: ${{ variables.StageName }}
displayName: ${{ variables.StageName }}
pool:
vmImage: ${{ variables.vmImageName }}

steps:
- checkout: self
fetchDepth: 0

- task: gitversion/setup@0
displayName: 'GitVersion Setup'
inputs:
versionSpec: '5.9.x'

- task: gitversion/execute@0
displayName: 'GitVersion Execute'

- bash: echo $Action$BuildVersion
displayName: 'Set Build Version'
env:
Action: '##vso[build.updatebuildnumber]'
BuildVersion: '$(GitVersion.SemVer)'

- bash: |
sudo apt-get install texlive-latex-extra
sudo apt-get install texlive-lang-cyrillic
displayName: 'Install TeXLive'

- bash: |
sudo mkdir -p $(OutputDirectory)
sudo chmod -R 775 $(OutputDirectory)
workingDirectory: '$(System.DefaultWorkingDirectory)'
displayName: 'Create Output Directory'

- bash: |
newVersion="$(GitVersion.SemVer)+$(GitVersion.BranchName).$(GitVersion.ShortSha)"
sed -i "s|Local-0.1.0|$newVersion|" "src/sections/version.tex"
displayName: 'Update version.tex'
workingDirectory: '$(System.DefaultWorkingDirectory)'

- bash: |
sudo fmtutil-sys --all
displayName: 'Update TeXLive Formats'

- bash: |
echo "Compiling LaTeX document first time ..."
pdflatex -file-line-error -interaction=nonstopmode -synctex=1 -output-format=pdf \
-output-directory=$(OutputDirectory) \
-aux-directory=$(OutputDirectory) $(LatexFileName).tex
echo "Compiling LaTeX document second time ..."
pdflatex -file-line-error -interaction=nonstopmode -synctex=1 -output-format=pdf \
-output-directory=$(OutputDirectory) \
-aux-directory=$(OutputDirectory) $(LatexFileName).tex
workingDirectory: '$(System.DefaultWorkingDirectory)/src'
displayName: 'Build Document'

- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(OutputDirectory)'
artifact: '$(LatexFileName)_$(GitVersion.SemVer)'
publishLocation: 'pipeline'
27 changes: 27 additions & 0 deletions out/LatexRussianTemplate.bbl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
\begin{thebibliography}{1}

\bibitem{kolmogorov1950osnovnye}
А.~Н. Колмогоров.
\newblock {\em Основные понятия теории
вероятностей. 2 изд}.
\newblock М.: наука, 1950.

\bibitem{kolmogorov83kobminatorniye}
Андрей~Николаевич Колмогоров.
\newblock Комбинаторные основания теории
информации и исчисления вероятностей.
\newblock {\em Успехи математических наук}, 38(4
(232):27--36, 1983.

\bibitem{GithubSource_2022}
Petro Kolosov.
\newblock Latex russian template source files.
\newblock Available electronically at \url
{https://github.com/kolosovpetro/latex-russian-template}, 2022.

\bibitem{Sloane_theencyclopedia}
N.~J.~A. Sloane.
\newblock The on-line encyclopedia of integer sequences.
\newblock published electronically at \url {https://oeis.org}, 1964.

\end{thebibliography}
48 changes: 48 additions & 0 deletions out/LatexRussianTemplate.blg
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
This is BibTeX, Version 0.99d
Capacity: max_strings=200000, hash_size=200000, hash_prime=170003
The top-level auxiliary file: LatexRussianTemplate.aux
Reallocating 'name_of_file' (item size: 1) to 6 items.
The style file: unsrt.bst
Reallocating 'name_of_file' (item size: 1) to 21 items.
Database file #1: LatexRussianTemplate.bib
You've used 4 entries,
1791 wiz_defined-function locations,
470 strings with 4444 characters,
and the built_in function-call counts, 628 in all, are:
= -- 55
> -- 16
< -- 0
+ -- 8
- -- 4
* -- 22
:= -- 104
add.period$ -- 12
call.type$ -- 4
change.case$ -- 3
chr.to.int$ -- 0
cite$ -- 4
duplicate$ -- 29
empty$ -- 78
format.name$ -- 4
if$ -- 142
int.to.chr$ -- 0
int.to.str$ -- 4
missing$ -- 3
newline$ -- 23
num.names$ -- 4
pop$ -- 20
preamble$ -- 1
purify$ -- 0
quote$ -- 0
skip$ -- 11
stack$ -- 0
substring$ -- 19
swap$ -- 4
text.length$ -- 0
text.prefix$ -- 0
top$ -- 0
type$ -- 0
warning$ -- 0
while$ -- 6
width$ -- 5
write$ -- 43
Binary file modified out/LatexRussianTemplate.pdf
Binary file not shown.
71 changes: 71 additions & 0 deletions scripts/verify-encoding.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<#
.SYNOPSIS
This script will verify that there's no UTF-8 BOM or CRLF line endings in the files inside of the project.
#>
param (
# Path to the repository root. All text files under the root will be checked for UTF-8 BOM and CRLF.
$SourceRoot = "$PSScriptRoot/..",

# Makes the script to perform file modifications to bring them to the standard.
[switch] $Autofix
)

Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'

# For PowerShell to properly process the UTF-8 output from git ls-tree we need to set up the output encoding:
[Console]::OutputEncoding = [Text.Encoding]::UTF8

$allFiles = git -c core.quotepath=off ls-tree -r HEAD --name-only
Write-Output "Total files in the repository: $($allFiles.Length)"

# https://stackoverflow.com/questions/6119956/how-to-determine-if-git-handles-a-file-as-binary-or-as-text#comment15281840_6134127
$nullHash = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'
$textFiles = git -c core.quotepath=off diff --numstat $nullHash HEAD -- @allFiles |
Where-Object { -not $_.StartsWith('-') } |
ForEach-Object { [Regex]::Unescape($_.Split("`t", 3)[2]) }
Write-Output "Text files in the repository: $($textFiles.Length)"

$bom = @(0xEF, 0xBB, 0xBF)
$bomErrors = @()
$lineEndingErrors = @()

try {
Push-Location $SourceRoot
foreach ($file in $textFiles) {
if ([IO.Path]::GetExtension($file) -eq '.DotSettings' -or $file.EndsWith('.verified.cs')) {
continue
}

$fullPath = Resolve-Path -LiteralPath $file
$bytes = [IO.File]::ReadAllBytes($fullPath) | Select-Object -First $bom.Length
$bytesEqualsBom = @(Compare-Object $bytes $bom -SyncWindow 0).Length -eq 0
if ($bytesEqualsBom -and $Autofix) {
$fullContent = [IO.File]::ReadAllBytes($fullPath)
$newContent = $fullContent | Select-Object -Skip $bom.Length
[IO.File]::WriteAllBytes($fullPath, $newContent)
Write-Output "Removed UTF-8 BOM from file $file"
} elseif ($bytesEqualsBom) {
$bomErrors += @($file)
}

$text = [IO.File]::ReadAllText($fullPath)
$hasWrongLineEndings = $text.Contains("`r`n")
if ($hasWrongLineEndings -and $Autofix) {
$newText = $text -replace "`r`n", "`n"
[IO.File]::WriteAllText($fullPath, $newText)
Write-Output "Fixed the line endings for file $file"
} elseif ($hasWrongLineEndings) {
$lineEndingErrors += @($file)
}
}

if ($bomErrors.Length) {
throw "The following $($bomErrors.Length) files have UTF-8 BOM:`n" + ($bomErrors -join "`n")
}
if ($lineEndingErrors.Length) {
throw "The following $($lineEndingErrors.Length) files have CRLF instead of LF:`n" + ($lineEndingErrors -join "`n")
}
} finally {
Pop-Location
}
4 changes: 2 additions & 2 deletions src/LatexRussianTemplate.bib
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@book{колмогоров1950основные,
@book{kolmogorov1950osnovnye,
title={Основные понятия теории вероятностей. 2 изд},
author={Колмогоров, А. Н.},
year={1950},
publisher={М.: наука}
}

@article{колмогоров1983комбинаторные,
@article{kolmogorov83kobminatorniye,
title={Комбинаторные основания теории информации и исчисления вероятностей},
author={Колмогоров, Андрей Николаевич},
journal={Успехи математических наук},
Expand Down
11 changes: 6 additions & 5 deletions src/LatexRussianTemplate.tex
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}
\usepackage[T1,T2A]{fontenc}
\usepackage[english,russian]{babel}
\usepackage{amscd}
\usepackage[dvips]{graphicx}
\usepackage{longtable,wrapfig}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
Expand Down Expand Up @@ -57,7 +58,7 @@
\maketitle

\begin{abstract}
\input{sections/abstract.tex}
\input{sections/abstract}
\end{abstract}

\keywords{2010 \emph{Mathematics Subject Classification.} Primary ..; Secondary \dots}
Expand All @@ -66,11 +67,11 @@


\section{Введение} \label{sec:introduction}
\input{sections/introduction.tex}
\input{sections/introduction}


\section{Заключение}\label{sec:conclusions}
\input{sections/conclusions.tex}
\input{sections/conclusions}

\bibliographystyle{unsrt}
\bibliography{LatexRussianTemplate}
Expand Down
6 changes: 5 additions & 1 deletion src/sections/introduction.tex
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
\begin{equation}
\frac{1}{2\pi i}\oint_{\gamma} \frac{f(z)}{z-z_0} \,dz = \sum_{n=0}^{\infty} \frac{f^{(n)}(z_0)}{n!}(z-z_0)^n\label{eq:equation}
\end{equation}

Текст статьи.
Пример цитирования~\cite{колмогоров1950основные, колмогоров1983комбинаторные, GithubSource_2022, Sloane_theencyclopedia}.
Пример цитирования~\cite{kolmogorov1950osnovnye, kolmogorov83kobminatorniye, GithubSource_2022, Sloane_theencyclopedia}.
Lorem ipsum – псевдо-латинский текст, который используется для веб дизайна, типографии, оборудования,
и распечатки вместо английского текста для того, чтобы сделать ударение не на содержание,
а на элементы дизайна.
Expand Down