Skip to content

Commit

Permalink
fix(actions): add datascience package to makefile and CI (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
vascoalramos authored Mar 27, 2023
1 parent 0990b5b commit ea1cdb9
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/merge_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ jobs:

- name: Count number or releases for tag
id: build_number
run: echo "::set-output name=value::$(($(git tag | grep -c ${{ steps.semantic.outputs.new_release_version }}) + 1))"
run: echo "value=$(($(git tag | grep -c ${{ steps.semantic.outputs.new_release_version }}) + 1))" >> $GITHUB_OUTPUT

- name: Compute version
id: version
run: echo "::set-output name=value::${{ steps.semantic.outputs.new_release_version }}.rc${{ steps.build_number.outputs.value }}"
run: echo "value=${{ steps.semantic.outputs.new_release_version }}.rc${{ steps.build_number.outputs.value }}" >> $GITHUB_OUTPUT


prerelease:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup Python 3.8
- name: Setup Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.10'

- name: Install dependencies
run: |
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,37 @@ jobs:
steps:
- name: Version
id: version
run: echo ::set-output name=value::${GITHUB_REF#refs/*/}
run: echo "value=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT


build-upload:
name: Build and Upload
build-packages:
name: Build ${{ matrix.package }} package
runs-on: ubuntu-20.04

strategy:
matrix:
package: [core, datascience]

needs:
- prepare

env:
ROOT_DIR: src/core
ROOT_DIR: src/${{ matrix.package }}

steps:
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.10'

- name: Install build dependencies
run: python -m pip install --upgrade pip wheel

- name: Build
run: |
echo "${{ needs.prepare.outputs.version }}" > VERSION
cd $ROOT_DIR && python setup.py bdist_wheel
make build-${{ matrix.package }} version=${{ needs.prepare.outputs.version }} PYTHON=python
- name: Upload release assets
uses: AButler/[email protected]
Expand All @@ -63,7 +66,6 @@ jobs:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: '${{ env.ROOT_DIR }}/dist/'


# update-dockerfiles:
# name: Create pull request to update dockerfiles
# runs-on: ubuntu-20.04
Expand Down
30 changes: 26 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ clean-pyc: ### Removes python compiled bytecode files


define BUILD
echo $(version) > VERSION && \
cd src/$1/ && rm -rf dist/ && $(PYTHON) setup.py bdist_wheel
endef

Expand All @@ -47,15 +48,30 @@ define UPLOAD
cd src/$1/ && $(PYTHON) -m twine upload -r ydata dist/*
endef

build: ### Build package
build-core:
$(call BUILD,core)

upload: ### Upload build package into pypi
build-datascience:
$(call BUILD,datascience)

build-all: build-core build-datascience ### Build all packages

upload-core:
$(call UPLOAD,core)

lint: ### Run prospector
upload-datascience:
$(call UPLOAD,datascience)

upload-all: upload-core upload-datascience ### Upload all packages to pypi

lint-core: ### Run prospector
$(PYTHON) -m prospector src/core

lint-datascience: ### Run prospector
$(PYTHON) -m prospector src/datascience

lint: lint-core lint-datascience ### Run prospector on all packages

define LINK_LOCAL
$(PIP) install -e src/$1
endef
Expand All @@ -64,5 +80,11 @@ link-core:
echo "0.0.0" > src/core/VERSION
$(call LINK_LOCAL,core)

test: link-core ### Runs the tests
link-datascience:
echo "0.0.0" > src/datascience/VERSION
$(call LINK_LOCAL,datascience)

link-all: link-core link-datascience ### Link all packages

test: link-all ### Runs the tests
$(PYTHON) -m pytest src/core
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.0
0.3.0

0 comments on commit ea1cdb9

Please sign in to comment.