Skip to content

Commit 6b99361

Browse files
authored
Added CI/CD pipelines
1 parent a712348 commit 6b99361

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed

.github/workflows/build.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build plugin on Pull Request
2+
on:
3+
pull_request:
4+
branches: [master]
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Free Disk Space (Ubuntu only)
12+
uses: jlumbroso/free-disk-space@main
13+
14+
- name: Set up MPI
15+
uses: mpi4py/setup-mpi@master
16+
17+
- name: Install dependencies
18+
run: |
19+
sudo apt-get update
20+
sudo apt-get install -y wget gcc-10 g++-10 make
21+
22+
- name: Install Miniconda
23+
uses: conda-incubator/setup-miniconda@main
24+
with:
25+
miniconda-version: "latest"
26+
auto-update-conda: true
27+
auto-activate-base: true
28+
activate-environment: scipion3
29+
python-version: "3.8"
30+
31+
- name: Install Scipion
32+
working-directory: ${{ github.workspace }}/../
33+
run: |
34+
pip cache purge
35+
pip install --user scipion-installer
36+
python3 -m scipioninstaller -conda -noXmipp -noAsk scipion
37+
38+
- name: Checkout repository
39+
uses: actions/checkout@main
40+
with:
41+
ref: ${{ github.head_ref }}
42+
43+
- name: Install plugin from pull request
44+
working-directory: ${{ github.workspace }}
45+
run: |
46+
pip cache purge
47+
../scipion/scipion3 installp -p . --devel

.github/workflows/release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Generate release (Pypi, tag, & GitHub Release)
2+
on: workflow_dispatch
3+
4+
jobs:
5+
deploy:
6+
runs-on: ubuntu-latest
7+
8+
steps:
9+
- name: Checkout repository
10+
uses: actions/checkout@main
11+
12+
- name: Set up MPI
13+
uses: mpi4py/setup-mpi@master
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@main
17+
with:
18+
python-version: '3.10'
19+
20+
- name: Install dependencies
21+
run: |
22+
pip install setuptools wheel twine
23+
pip install -r requirements.txt
24+
25+
- name: Get tag name
26+
id: variables
27+
env:
28+
FOLDER_WITH_VERSION: ${{ vars.FOLDER_WITH_VERSION }}
29+
run: |
30+
VERSION=$(python -c "import $FOLDER_WITH_VERSION; print('VERSION', 'v'+$FOLDER_WITH_VERSION.__version__)" | grep VERSION | sed "s/VERSION //g") || (echo "Could not import version, check that variables are correctly set!" && exit 1)
31+
echo "TAG_NAME=${VERSION#v}" >> $GITHUB_OUTPUT
32+
echo "TAG NAME (must not contain version prefix): ${VERSION#v}"
33+
34+
- name: Build and publish
35+
env:
36+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
37+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
38+
run: |
39+
python setup.py sdist
40+
twine upload dist/* -c "${{ secrets.PYPI_COMMENT }}"
41+
42+
- name: Generate tag
43+
id: tag_version
44+
uses: mathieudutour/github-tag-action@v6.2
45+
with:
46+
github_token: ${{ secrets.GITHUB_TOKEN }}
47+
custom_tag: ${{ steps.variables.outputs.TAG_NAME }}
48+
49+
- name: Create a GitHub release
50+
uses: ncipollo/release-action@main
51+
with:
52+
tag: ${{ steps.tag_version.outputs.new_tag }}
53+
name: ${{ steps.variables.outputs.TAG_NAME }}

0 commit comments

Comments
 (0)