Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
first attempt to bump build (#1021)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattclarke authored Feb 24, 2023
1 parent b9cb030 commit 37e170d
Show file tree
Hide file tree
Showing 185 changed files with 459 additions and 975 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/macos-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: MacOs

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Lint with flake8
run: |
flake8 --exclude definitions,nx-class-documentation
- name: Run non-ui tests
run: |
pytest tests
- name: Run ui tests
run: |
pytest ui_tests
5 changes: 3 additions & 2 deletions .github/workflows/ubuntu-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Python application
name: Ubuntu latest

on:
push:
Expand All @@ -23,11 +23,12 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt install libegl-dev
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Lint with flake8
run: |
flake8 --exclude definitions,nx-class-documentation
- name: Test with pytest
run: |
pytest
pytest tests
155 changes: 37 additions & 118 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ container_build_nodes = [
'centos7': ContainerBuildNode.getDefaultContainerBuildNode('centos7-gcc11')
]

// JENKINS IS ONLY USED TO AUTOMATE THE FORMATTING AND UPDATING THE NEXUS DOCS
// THE ACTUALLY "BUILDING" IS DONE VIA GITHUB ACTIONS

pipeline_builder = new PipelineBuilder(this, container_build_nodes)

builders = pipeline_builder.createBuilders { container ->

pipeline_builder.stage("Checkout") {
dir(pipeline_builder.project) {
scm_vars = checkout scm
Expand All @@ -33,29 +34,23 @@ builders = pipeline_builder.createBuilders { container ->
container.copyTo(pipeline_builder.project, pipeline_builder.project)
} // stage

pipeline_builder.stage("Create virtualenv") {
pipeline_builder.stage("${container.key}: Dependencies") {
container.sh """
cd ${project}
python3.6 -m venv build_env
which python
python --version
python -m pip install --user -r ${pipeline_builder.project}/requirements-dev.txt
python -m pip install --user -r ${pipeline_builder.project}/requirements-jenkins.txt
"""
} // stage

pipeline_builder.stage("Install requirements") {
container.sh """
cd ${project}
build_env/bin/pip --proxy ${https_proxy} install --upgrade pip
build_env/bin/pip --proxy ${https_proxy} install -r requirements-jenkins.txt
"""
} // stage

if (env.CHANGE_ID) {
pipeline_builder.stage("Check formatting") {
pipeline_builder.stage("${container.key}: Formatting (black)") {
try {
container.sh """
cd ${project}
cd ${pipeline_builder.project}
export LC_ALL=en_US.utf-8
export LANG=en_US.utf-8
build_env/bin/python -m black .
python -m black .
git config user.email '[email protected]'
git config user.name 'cow-bot'
git status -s
Expand All @@ -69,59 +64,30 @@ builders = pipeline_builder.createBuilders { container ->
}
} // stage
}

pipeline_builder.stage("Run Linter") {
container.sh """
cd ${project}
build_env/bin/flake8 --exclude build_env,definitions,nx-class-documentation
"""
} // stage

pipeline_builder.stage("Static type check") {
container.sh """
cd ${project}
build_env/bin/python -m mypy --ignore-missing-imports ./nexus_constructor
"""
} // stage

/* pipeline_builder.stage("Run tests") {
def testsError = null
try {
container.sh """
cd ${project}
build_env/bin/python -m pytest -s ./tests --ignore=build_env --ignore=tests/ui_tests
"""
}
catch(err) {
testsError = err
currentBuild.result = 'FAILURE'
}
}*/ // stage

// Only run in pull request builds
if (env.CHANGE_ID) {
def diffError = false
pipeline_builder.stage("Verify NeXus HTML") {
container.sh """
python3.6 -m venv nexus_doc_venv
source nexus_doc_venv/bin/activate
pip --proxy ${https_proxy} install --upgrade pip
pip --proxy ${https_proxy} install -r ${project}/definitions/requirements.txt
python -m venv nexus_doc_venv
source nexus_doc_venv/bin/activate
pip --proxy ${https_proxy} install --upgrade pip
pip --proxy ${https_proxy} install -r ${project}/definitions/requirements.txt
mkdir nexus_doc
cd nexus_doc
export SOURCE_DIR=../${project}/definitions
python ../${project}/definitions/utils/build_preparation.py ../${project}/definitions
make
mkdir nexus_doc
cd nexus_doc
export SOURCE_DIR=../${project}/definitions
python ../${project}/definitions/utils/build_preparation.py ../${project}/definitions
make
"""

try {
container.sh """
diff \
--recursive \
${project}/nx-class-documentation/html \
nexus_doc/manual/build/html
diff \
--recursive \
${project}/nx-class-documentation/html \
nexus_doc/manual/build/html
"""
} catch (e) {
echo 'Caught exception after diff error, setting variable'
Expand All @@ -132,16 +98,16 @@ builders = pipeline_builder.createBuilders { container ->
if (diffError) {
pipeline_builder.stage("Update NeXus HTML") {
container.sh """
export LC_ALL=en_US.utf-8
export LANG=en_US.utf-8
cd ${project}
rm -rf nx-class-documentation/html
cp -r ../nexus_doc/manual/build/html nx-class-documentation/
git config user.email '[email protected]'
git config user.name 'cow-bot'
git status --ignored
git add --force nx-class-documentation
git commit -m 'Update NeXus HTML documentation'
export LC_ALL=en_US.utf-8
export LANG=en_US.utf-8
cd ${pipeline_builder.project}
rm -rf nx-class-documentation/html
cp -r ../nexus_doc/manual/build/html nx-class-documentation/
git config user.email '[email protected]'
git config user.name 'cow-bot'
git status --ignored
git add --ignore-removal --force nx-class-documentation
git commit -m 'Update NeXus HTML documentation'
"""

// Push any changes resulting from formatting
Expand All @@ -153,64 +119,18 @@ builders = pipeline_builder.createBuilders { container ->
)
]) {
withEnv(["PROJECT=${pipeline_builder.project}"]) {
container.sh '''
cd $PROJECT
git push https://$USERNAME:[email protected]/ess-dmsc/$PROJECT.git HEAD:$CHANGE_BRANCH
'''
container.sh """
cd ${pipeline_builder.project}
git push https://$USERNAME:$PASSWORD@github.com/ess-dmsc/${pipeline_builder.project}.git HEAD:$CHANGE_BRANCH
"""
} // withEnv
} // withCredentials

error 'Updating NeXus HTML documentation'
} // stage
} // if

/* pipeline_builder.stage('Build Executable'){
container.sh "cd ${project} && build_env/bin/pyinstaller --noconfirm nexus-constructor.spec"
}
pipeline_builder.stage('Archive Executable') {
def git_commit_short = scm_vars.GIT_COMMIT.take(7)
container.copyFrom("${project}/dist/", './build')
sh "tar czvf nexus-constructor_linux_${git_commit_short}.tar.gz ./build "
archiveArtifacts artifacts: 'nexus-constructor*.tar.gz', fingerprint: true
}*/ // stage
} // if


}

def get_macos_pipeline() {
return {
node('macos') {
cleanWs()
dir("${project}") {
stage('Checkout') {
try {
checkout scm
} catch (e) {
failure_function(e, 'MacOSX / Checkout failed')
} // catch
} // stage
stage('Setup') {
sh """
mkdir -p ~/virtualenvs
/opt/local/bin/python3.6 -m venv ~/virtualenvs/${pipeline_builder.project}-${pipeline_builder.branch}
source ~/virtualenvs/${pipeline_builder.project}-${pipeline_builder.branch}/bin/activate
pip --proxy=${https_proxy} install --upgrade pip
pip --proxy=${https_proxy} install -r requirements-dev.txt
"""
} // stage
stage('Run tests') {
sh """
source ~/virtualenvs/${pipeline_builder.project}-${pipeline_builder.branch}/bin/activate
python -m pytest . -s --ignore=definitions/ --ignore=tests/ui_tests/
"""
} // stage
} // dir
} // node
} // return
} // def

node("docker") {
cleanWs()

Expand All @@ -224,6 +144,5 @@ node("docker") {
}
}

builders['macOS'] = get_macos_pipeline()
parallel builders
}
2 changes: 1 addition & 1 deletion nx-class-documentation/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 112dbb441b93bd9b1a1a2759dcbe6796
config: 62889735085e14bf6b77587483073aad
tags: 645f666f9bcd5a90fca523b33c5a78b7
5 changes: 4 additions & 1 deletion nx-class-documentation/html/_static/basic.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
Expand Down Expand Up @@ -324,13 +324,15 @@ aside.sidebar {
p.sidebar-title {
font-weight: bold;
}

nav.contents,
aside.topic,
div.admonition, div.topic, blockquote {
clear: left;
}

/* -- topics ---------------------------------------------------------------- */

nav.contents,
aside.topic,
div.topic {
Expand Down Expand Up @@ -606,6 +608,7 @@ ol.simple p,
ul.simple p {
margin-bottom: 0;
}

aside.footnote > span,
div.citation > span {
float: left;
Expand Down
2 changes: 1 addition & 1 deletion nx-class-documentation/html/_static/doctools.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Base JavaScript utilities for all Sphinx HTML documentation.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
Expand Down
2 changes: 1 addition & 1 deletion nx-class-documentation/html/_static/language_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* This script contains the language-specific data used by searchtools.js,
* namely the list of stopwords, stemmer, scorer and splitter.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
Expand Down
2 changes: 1 addition & 1 deletion nx-class-documentation/html/_static/searchtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Sphinx JavaScript utilities for the full-text search.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
Expand Down
4 changes: 2 additions & 2 deletions nx-class-documentation/html/_static/sphinxdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Sphinx stylesheet -- sphinxdoc theme. Originally created by
* Armin Ronacher for Werkzeug.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
Expand Down Expand Up @@ -265,9 +265,9 @@ div.quotebar {
padding: 2px 7px;
border: 1px solid #ccc;
}

nav.contents,
aside.topic,

div.topic {
background-color: #f8f8f8;
}
Expand Down
7 changes: 2 additions & 5 deletions nx-class-documentation/html/applying-nexus.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

<title>1.3. Constructing NeXus Files and Application Definitions &#8212; nexus v2020.10 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/sphinxdoc.css" />
<link rel="stylesheet" href="_static/blockquote.css" type="text/css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<script async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
Expand Down Expand Up @@ -793,7 +790,7 @@ <h3>Navigation</h3>
</div>
<div class="footer" role="contentinfo">
&#169; <a href="copyright.html">Copyright</a> 1996-2023, NIAC, https://www.nexusformat.org.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.3.0.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 6.1.3.
</div>
</body>
</html>
Loading

0 comments on commit 37e170d

Please sign in to comment.