Update material_strength.ipynb (#30) #50
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
name: CI | |
on: push | |
jobs: | |
RunTests: | |
runs-on: ${{ matrix.os }} | |
# Don't run tests when merging PRs, they would have been run already and tests | |
# should have passed. The following checks that the committer's and author's username differ; | |
# if so, the event was probably triggered by github actions. | |
# NOTE: Directly editing code on GitHub on the main branch pybasses tests, and is | |
# discouraged. If editing code on GitHub, please submit a PR by creating a temporary branch. | |
if: | | |
github.ref_name != github.event.repository.default_branch || | |
github.event.head_commit.committer.username != | |
github.event.head_commit.author.username | |
continue-on-error: ${{ matrix.python-version == 3.6 || matrix.os == 'windows-latest' }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ['3.12'] | |
include: | |
- os: ubuntu-20.04 | |
python-version: 3.6 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install . | |
pip install pytest | |
- name: Run Pytest | |
run: pytest -s tests/ | |
CreateTag: | |
permissions: | |
contents: write | |
needs: RunTests | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
# Create tag only on master branch and tests pass or tests were skipped | |
# (i.e. skipped due to a PR merge; in that case tests should already have | |
# passed). | |
if: | | |
always() && | |
github.ref == 'refs/heads/master' && | |
(needs.RunTests.result == 'success' || needs.RunTests.result == 'skipped') | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Install setuptools | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools | |
- name: Get python package metadata | |
id: pkg_info | |
run: | | |
echo "version=v$(python setup.py --version)" >> "$GITHUB_OUTPUT" | |
- name: Get git info | |
id: git_info | |
run: | | |
git fetch --tags | |
echo "tag=$(git tag | sort -V | tail -n 1)" >> "$GITHUB_OUTPUT" | |
- name: Configure Git | |
run: | | |
git config user.name "github-actions" | |
git config user.email "[email protected]" | |
- name: Make tag if updated | |
if: ${{ (steps.pkg_info.outputs.version != steps.git_info.outputs.tag) }} | |
env: | |
pkg_version: ${{ steps.pkg_info.outputs.version }} | |
run: | | |
git tag "$pkg_version" | |
git push --tags | |