Skip to content

Commit

Permalink
Refactor github action
Browse files Browse the repository at this point in the history
  • Loading branch information
aghozlane committed Mar 4, 2024
1 parent 64a39fc commit 4c77b13
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 315 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/check_conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: conda recipe

# Controls when the workflow will run
on:
# Triggers the workflow on schedule but only for the default branch (which is master)
schedule:
- cron: '0 7 * * 1-5'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
# This workflow contains a single job called "check_recipe"
check_recipe:
name: test conda recipes on ${{ matrix.os }} with ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest','macos-latest']
python-version: ["3.7", "3.11"]
steps:
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
channels: conda-forge,bioconda,aghozlane,defaults
- name: Set up test environment
shell: bash -l {0}
run: |
conda install -y meteor
- name: check installation
shell: bash -l {0}
run: |
python --version
meteor --version
- name: all workflow run
shell: bash -l {0}
run: |
meteor test
36 changes: 36 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: testing

on: [push, pull_request]

jobs:
pytest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.10, 3.11, 3.12]
include:
- python-version: 3.12
allow-failure: true
poetry-version: ["1.2.2", "1.7.1"]
os: [ubuntu-22.04, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
pip install numpy scipy cython
sudo apt install bowtie2
- name: Install Python
uses: actions/setup-python@v4
# see details (matrix, python-version, python-version-file, etc.)
# https://github.com/actions/setup-python
- name: Install poetry
uses: abatilo/actions-poetry@v2
- uses: actions/cache@v3
name: Define a cache for the virtual environment based on the dependencies lock file
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install the project dependencies
run: poetry install --only test -C meteor
- name: Run the automated tests (for example)
run: poetry run -C meteor pytest --cov=meteor --cov-report xml
147 changes: 0 additions & 147 deletions .github/workflows/meteor.yml

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/publish_meteor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Publish meteor

on:
release:
types: [created]

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: user/app:latest
- name: Update repo description
uses: aghozlane/meteor
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
repository: user/app

build_conda:
runs-on: ubuntu-latest
steps:
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
channels: conda-forge,bioconda,aghozlane,defaults
- name: Login to Anaconda
run: anaconda login --hostname ${{ secrets.DOCKER_HOST }} --username ${{ secrets.DOCKER_USER }} --password ${{ secrets.DOCKER_PASS }}
- name: Build Conda package
run: conda build conda_recipe
- name: Logout from Anaconda
run: anaconda logout


publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
# see details (matrix, python-version, python-version-file, etc.)
# https://github.com/actions/setup-python
- name: Install poetry
uses: abatilo/actions-poetry@v2
- name: Build and publish to PyPI
run: |
poetry build -C meteor
poetry publish -C meteor -u ${{ secrets.PYPI_USER }} -p ${{ secrets.PYPI_PASS }}
Loading

0 comments on commit 4c77b13

Please sign in to comment.