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

Update continuous integration #173

Closed
wants to merge 56 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
2597b05
Update runner
marcosfelt Apr 22, 2022
d9be56b
Add back toml
marcosfelt Apr 22, 2022
05d7841
Rework GH workflows into separate steps
marcosfelt Apr 24, 2022
04c758c
Correct yaml syntax
marcosfelt Apr 24, 2022
5df42fc
Simplify workflows for testing
marcosfelt Apr 24, 2022
e1fb0f9
Back to one workflow
marcosfelt Apr 24, 2022
6368d7b
Separate build and test
marcosfelt Apr 24, 2022
ae3cd35
Test depends on build
marcosfelt Apr 24, 2022
39de18a
Cache based on poetry
marcosfelt Apr 24, 2022
ef6a539
What's happening
marcosfelt Apr 24, 2022
48c7412
List files
marcosfelt Apr 24, 2022
5b9bf39
Fix path to built package
marcosfelt Apr 24, 2022
dc72b0d
Remove get_version
marcosfelt Apr 24, 2022
4d86fd3
Add a run_tests script
marcosfelt Apr 24, 2022
b280429
Somehow missed things
marcosfelt Apr 24, 2022
ea7f2bf
Cache dependencies
marcosfelt Apr 24, 2022
434560e
Actually run tests
marcosfelt Apr 24, 2022
fe26fd1
Get path
marcosfelt Apr 24, 2022
91106d5
Correct script path
marcosfelt Apr 24, 2022
40e8925
Updates
marcosfelt Apr 24, 2022
87d536a
Updates
marcosfelt Apr 24, 2022
919ff2e
Make sure to chmod run_tests
marcosfelt Apr 24, 2022
3f15f38
Inline tests
marcosfelt Apr 24, 2022
6050443
Use console script to run tests
marcosfelt Apr 24, 2022
5416302
Add publish step
marcosfelt Apr 25, 2022
eef8619
Correct version matching
marcosfelt Apr 25, 2022
7d9eb92
Fix syntax error
marcosfelt Apr 25, 2022
4737350
Fix syntax error
marcosfelt Apr 25, 2022
0b9562d
Fix syntax error
marcosfelt Apr 25, 2022
25059b3
Conditionals
marcosfelt Apr 25, 2022
e7c972c
Conditionals
marcosfelt Apr 25, 2022
d4cfad8
Autonull
marcosfelt Apr 25, 2022
be94fec
Try bumping version
marcosfelt Apr 25, 2022
784ec50
Fix path to builds
marcosfelt Apr 25, 2022
a0b1045
Check path
marcosfelt Apr 25, 2022
9d680d5
Wrong syntax
marcosfelt Apr 25, 2022
a21c8c0
Wildcard
marcosfelt Apr 25, 2022
8f9fc2a
More fixes
marcosfelt Apr 25, 2022
e4852e7
Syntax
marcosfelt Apr 25, 2022
567157e
Syntax
marcosfelt Apr 25, 2022
7f673e3
I give up
marcosfelt Apr 25, 2022
2a5cad8
Got the variable names wrong
marcosfelt Apr 25, 2022
2b6419e
fix if/then
marcosfelt Apr 25, 2022
5cdacfb
Use bash
marcosfelt Apr 25, 2022
27f12ef
Bash is annoying
marcosfelt Apr 25, 2022
f99be99
Last corrections
marcosfelt Apr 25, 2022
f6c710c
Forget multiline
marcosfelt Apr 25, 2022
ed427e3
More fixes
marcosfelt Apr 25, 2022
d592670
tag name
marcosfelt Apr 25, 2022
86bdfa8
Matrix of os and python versions
marcosfelt Apr 25, 2022
e0d046a
Correct python v names
marcosfelt Apr 25, 2022
0ccea27
Try using bash
marcosfelt Apr 25, 2022
6b722a5
Update packages due to issue with python 3.10
marcosfelt Apr 25, 2022
babe2ba
Add back docs option
marcosfelt Apr 25, 2022
75dd1ec
Update pytest
marcosfelt Apr 25, 2022
a5168da
End on exit code
marcosfelt Apr 25, 2022
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
176 changes: 123 additions & 53 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test & Publish
name: Test and Publish
on:
push:
pull_request:
Expand All @@ -10,8 +10,8 @@ on:
- '**:**'

jobs:
#Run pytest and build package
test_build:
# Build the package
build:
runs-on: ubuntu-latest

steps:
Expand All @@ -21,62 +21,132 @@ jobs:
- name: Install python
uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.9'

- name: Install poetry
uses: Gr1N/setup-poetry@v4
uses: Gr1N/setup-poetry@v7

- name: Cache poetry dependencies
uses: actions/cache@v2
- name: Build package
run: poetry build

- name: Upload built package
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
retention-days: 1

# Run pytest using built package
test:
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python: ["3.8", "3.9", "3.10"]

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
cache: 'pip'
cache-dependency-path: "poetry.lock"

- name: Download built package
uses: actions/download-artifact@v3
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
name: dist

- name: Install dependencies
run: poetry install -E experiments -E entmoot
- name: Install summit and pytest
shell: bash
run: pip install summit-*.tar.gz pytest

- name: Run pytest
run: poetry run pytest --doctest-modules --ignore=experiments --disable-warnings
- name: Run tests
shell: bash
run: summit-tests

# Check that the build process works correctly
- name: Build package
run: poetry build

# Publish to pypi on version change
# This is based on https://github.com/coveooss/pypi-publish-with-poetry
publish:
needs: test_build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
# Make sure to fetch the last two commits
# Needed forthe version bump and tag
fetch-depth: 2

- name: Install python
uses: actions/setup-python@v2
with:
python-version: '3.7'

- name: Install poetry
uses: Gr1N/setup-poetry@v4

- name: Install toml
run: pip install toml

- name: Check for version bump and tag
id: version_check
uses: salsify/action-detect-and-tag-new-version@v2
with:
tag-template: "{VERSION}"
create-tag: ${{ github.ref == 'refs/heads/master' }} # only create new tag on master
version-command: |
python get_version.py

- name: Publish
# Only publish if there is a new tag
if: ${{ steps.version_check.tag }}
run: poetry publish --build -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }}
needs: test
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install python
uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Download built package
uses: actions/download-artifact@v3
with:
name: dist
path: dist/

- name: Install poetry
uses: Gr1N/setup-poetry@v7

- name: Install coveo-pypi-cli
run: pip install coveo-pypi-cli

- name: Determine the version for this release from the build
id: current
run: |
BUILD_VER="$(ls dist/summit-*.tar.gz)"
echo "Path: $BUILD_VER"
if [[ $BUILD_VER =~ (summit-)([^,][0-9.]{4}) ]]; then
echo "::set-output name=version::${BASH_REMATCH[2]}"
echo "Version of build: ${BASH_REMATCH[2]}"
else
echo "No version found found"
fi

- name: Get latest published version
id: published
run: |
PUB_VER="$(pypi current-version summit)"
echo "::set-output name=version::$PUB_VER"
echo "Latest published version: $PUB_VER"


- name: Publish to pypi if new version
if: (steps.current.outputs.version != steps.published.outputs.version)
shell: bash
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
if [[ '${{ github.ref_name }}' == 'master' ]]; then
poetry publish
else
echo "Dry run of publishing the package"
poetry publish --dry-run
fi

- name: Tag repository
shell: bash
id: get-next-tag
if: (steps.current.outputs.version != steps.published.outputs.version)
run: |
TAG_NAME=${{ steps.current.outputs.version }}
echo "::set-output name=tag-name::$TAG_NAME"
echo "This release will be tagged as $TAG_NAME"
git config user.name "github-actions"
git config user.email "actions@users.noreply.github.com"
git tag --annotate --message="Automated tagging system" $TAG_NAME ${{ github.sha }}

- name: Push the tag
if: (steps.current.outputs.version != steps.published.outputs.version)
env:
TAG_NAME: ${{ steps.current.outputs.version }}
run: |
if [[ ${{ github.ref_name }} == 'master' ]]; then
git push origin $TAG_NAME
else
echo "If this was the master branch, I would push a new tag named $TAG_NAME"
fi
2 changes: 2 additions & 0 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ You might run into some issues when installing scientific python packages such a
brew install hdf5
HDF5_DIR=/opt/homebrew/opt/hdf5 PIP_NO_BINARY="h5py" LLVM_CONFIG="/opt/homebrew/Cellar/llvm@11/11.1.0_3/bin/llvm-config" arch -arm64 poetry install

If this commnad fails, make sure to check the version of LLVM that was actually installed (i.e., run `ls /opt/homebrew/Cellar/llvm@11/` and replace 11.1.0_3 wit the correct version in the third line above.

More resources

* [LLVM isssue](https://github.com/numba/llvmlite/issues/693#issuecomment-909501195)
Expand Down
8 changes: 0 additions & 8 deletions get_version.py

This file was deleted.

Loading