From 2257afb398af8c7c3db6203d7fa157ae07db69ff Mon Sep 17 00:00:00 2001 From: Shane Maloney Date: Tue, 20 Feb 2024 16:18:47 +0000 Subject: [PATCH] Move GI to GitHub actions (#138) * Move CI to GitHub Actions * Get tests running * Add change log. --- .github/workflows/ci.yml | 41 ++++++++++ azure-pipelines.yml | 108 ------------------------- changelog/138.trivial.rst | 1 + pyproject.toml | 2 +- setup.cfg | 16 ++++ sunkit_spex/sunxspex_fitting/fitter.py | 6 +- 6 files changed, 62 insertions(+), 112 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 azure-pipelines.yml create mode 100644 changelog/138.trivial.rst diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..c3ac1406 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +name: CI + +on: + push: + pull_request: + workflow_dispatch: + + +jobs: + core: + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main + with: + submodules: false + coverage: codecov + envs: | + - linux: py39 + + test: + needs: [core] + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main + with: + submodules: false + coverage: codecov + envs: | + - windows: py39 + - macos: py39 + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + docs: + needs: [test] + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main + with: + default_python: '3.9' + submodules: false + pytest: false + libraries: | + apt: + - graphviz + envs: | + - linux: build_docs diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 06229fa3..00000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: $(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.rr) -variables: - CI_NAME: Azure Pipelines - CI_BUILD_ID: $(Build.BuildId) - CI_BUILD_URL: "https://dev.azure.com/sunpy/sunxspex/_build/results?buildId=$(Build.BuildId)" - CIBW_BUILD: cp39-* cp310-* cp311-* - CIBW_SKIP: "*-win32 *-manylinux1_i686" - -resources: - repositories: - - repository: OpenAstronomy - type: github - endpoint: sunpy - name: OpenAstronomy/azure-pipelines-templates - ref: master - -trigger: - branches: - include: - - '*' - exclude: - - '*backport*' - tags: - include: - - 'v*' - exclude: - - '*dev*' - - '*pre*' - - '*post*' - -jobs: -- template: run-tox-env.yml@OpenAstronomy - parameters: - submodules: false - coverage: codecov - envs: - - linux: codestyle - name: codestyle - - - linux: py39 - name: py39_linux_test - - - linux: py310 - name: py310_linux_test - - - linux: py311 - name: py311_linux_test - -# - linux: py312 -# name: py312_linux_test - - - macos: py39 - name: py39_mac_test - coverage: false - - - macos: py310 - name: py310_mac_test - coverage: false - - - macos: py311 - name: py311_mac_test - coverage: false - -# - macos: py312 -# name: py312_mac_test -# coverage: false - - - windows: py39 - name: py39_win_test - - - windows: py310 - name: py310_win_test - - - windows: py311 - name: py311_win_test - -# - windows: py312 -# name: py312_win_test - -# On branches which aren't master, and not Pull Requests, build the wheels but only upload them on tags -- ${{ if and(ne(variables['Build.Reason'], 'PullRequest'), not(contains(variables['Build.SourceBranch'], 'master'))) }}: - - template: publish.yml@OpenAstronomy - parameters: - # Only Upload to PyPI on tags - ${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/') }}: - pypi_connection_name : 'PyPI' - - test_extras: 'test' - test_command: 'pytest -p no:warnings --doctest-rst -m "not figure" --pyargs sunkit_spex' - submodules: false - targets: - - wheels_linux - - wheels_macos - - sdist - dependsOn: - - codestyle - - py39_linux_test - - py310_linux_test - - py311_linux_test -# - py312_linux_test - - py39_mac_test - - py310_mac_test - - py311_mac_test -# - py312_mac_test - - py39_win_test - - py310_win_test - - py311_win_test -# - py312_win_test diff --git a/changelog/138.trivial.rst b/changelog/138.trivial.rst new file mode 100644 index 00000000..b6c3de38 --- /dev/null +++ b/changelog/138.trivial.rst @@ -0,0 +1 @@ +Move CI to GitHub actions. diff --git a/pyproject.toml b/pyproject.toml index e8d185b8..771849e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ build-backend = 'setuptools.build_meta' package = "sunkit_spex" filename = "CHANGELOG.rst" directory = "changelog/" - issue_format = "`#{issue} `__" + issue_format = "`#{issue} `__" title_format = "{version} ({project_date})" [[tool.towncrier.type]] diff --git a/setup.cfg b/setup.cfg index 7a064509..bdd53dd5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -62,6 +62,22 @@ remote_data_strict = False # Pin junit behaviour; we might want to update this to xunit2 at some point junit_family=xunit1 filterwarnings = + error + # https://github.com/pytest-dev/pytest-cov/issues/557 + # It was fixed and released but it does not seem to be fixed + ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated.:DeprecationWarning + # Raised by sunpy.coordinates.transformations and will be removed in sunpy 6.1 + ignore:.*module is deprecated, as it was designed for internal use + # https://github.com/pandas-dev/pandas/issues/54466 + # Should stop when pandas 3.0.0 is released + ignore:(?s).*Pyarrow will become a required dependency of pandas:DeprecationWarning + # TODO review and fix just getting test running + ignore:numpy.ndarray size changed.*:RuntimeWarning + ignore:Some input energy values outside valid range.*:UserWarning + ignore:invalid value encountered in.*:RuntimeWarning + ignore:divide by zero encountered in.*:RuntimeWarning + ignore:The truth value of an empty array is ambiguous..*:DeprecationWarning + ignore:LinAlgError when calculating the hessian. Errors may not be calculated.:UserWarning [pycodestyle] max_line_length = 100 diff --git a/sunkit_spex/sunxspex_fitting/fitter.py b/sunkit_spex/sunxspex_fitting/fitter.py index 22c76c8f..1922e14a 100644 --- a/sunkit_spex/sunxspex_fitting/fitter.py +++ b/sunkit_spex/sunxspex_fitting/fitter.py @@ -650,7 +650,7 @@ def complicated_model(T1, EM1, C, something_complicated, energies=None): self.rParams["Status"], self.rParams["Value"], self.rParams["Bounds"], self.rParams["Error"] = list(_rps.param_status), list(_rps.param_value), list(_rps.param_bounds), list(_rps.param_error) def add_photon_model(self, function, overwrite=False): - """ Add user photon model to fitting namespace. + r"""Add user photon model to fitting namespace. Takes a user defined function intended to be used as a model or model component when giving a @@ -3277,7 +3277,7 @@ def _plot_1spec(self, res.axhline(0, linestyle=':', color='k') res.set_ylim(self.res_ylim) # res.set_ylabel('(y$_{Data}$ - y$_{Model}$)/$\sigma_{Error}$') - res.set_ylabel('($D - M$)/$\sigma$') + res.set_ylabel(r'($D - M$)/$\sigma$') res.set_xlim(self.plot_xlims) res.set_xlabel("Energy [keV]") @@ -3458,7 +3458,7 @@ def _plot_from_dict(self, subplot_axes_grid): res.axhline(0, linestyle=':', color='k') res.set_ylim(self.res_ylim) # res.set_ylabel('(y$_{Data}$ - y$_{Model}$)/$\sigma_{Error}$') - res.set_ylabel('($D - M$)/$\sigma$') + res.set_ylabel(r'($D - M$)/$\sigma$') res.set_xlim(self.plot_xlims) res.set_xlabel("Energy [keV]")