Skip to content

Commit

Permalink
Separate testing from building in github actions and adding a keepali…
Browse files Browse the repository at this point in the history
…ve workflow (#111)

Co-authored-by: Jaquier Aurélien Tristan <aurelien.jaquier@epfl.ch>
  • Loading branch information
AurelienJaquier and Jaquier Aurélien Tristan committed Nov 23, 2022
1 parent 93fd036 commit 2c08dac
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 59 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build

on:
push:
branches:
- master
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
call-test-workflow:
uses: BlueBrain/BluePyEfe/.github/workflows/test.yml@master

build-n-publish:
name: Build and publish on PyPI
runs-on: ubuntu-latest
needs: call-test-workflow
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Build a source tarball and wheel
run: |
pip install wheel
python setup.py sdist bdist_wheel
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
34 changes: 34 additions & 0 deletions .github/workflows/keep-alive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Keep-alive

on:
schedule:
# Runs every sunday at 3 a.m.
- cron: '0 3 * * SUN'

jobs:
call-test-workflow:
uses: BlueBrain/BluePyEfe/.github/workflows/test.yml@master

keep-workflow-alive:
name: Keep workflow alive
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: master

- name: Get date from 50 days ago
run: |
datethen=`date -d "-50 days" --utc +%FT%TZ`
echo "datelimit=$datethen" >> $GITHUB_ENV
- name: setup git config
if: github.event.base.repo.updated_at <= env.datelimit
run: |
# setup the username and email.
git config user.name "Github Actions Keepalive Bot"
git config user.email "<>"
- name: commit IF last commit is older than 50 days
if: github.event.base.repo.updated_at <= env.datelimit
run: |
git commit -m "Empty commit to keep the gihub workflows alive" --allow-empty
git push origin master
59 changes: 0 additions & 59 deletions .github/workflows/main.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test

on:
pull_request:
# allows this workflow to be reusable (e.g. by the build workflow)
workflow_call:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
pip install tox tox-gh-actions
- name: Run tox
run: tox
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: false

0 comments on commit 2c08dac

Please sign in to comment.