Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 0805bc3

Browse files
authored
Merge pull request #401 from AurelienJaquier/keepalive-workflow
Refactor workflows and keep workflows alive
2 parents c91aae8 + 84b75dd commit 0805bc3

File tree

4 files changed

+108
-61
lines changed

4 files changed

+108
-61
lines changed

.github/workflows/build.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- '[0-9]+.[0-9]+.[0-9]+'
9+
10+
jobs:
11+
call-test-workflow:
12+
uses: BlueBrain/BluePyOpt/.github/workflows/test.yml@master
13+
14+
build-n-publish:
15+
name: Build and publish on PyPI
16+
runs-on: ubuntu-latest
17+
needs: call-test-workflow
18+
steps:
19+
- uses: actions/checkout@v2
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Set up Python 3.6
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: 3.6
27+
28+
- name: Build a source tarball and wheel
29+
run: |
30+
pip install wheel
31+
python setup.py sdist bdist_wheel
32+
33+
- name: Publish package to PyPI
34+
uses: pypa/gh-action-pypi-publish@master
35+
with:
36+
user: __token__
37+
password: ${{ secrets.PYPI_PASSWORD }}

.github/workflows/keep-alive.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Keep-alive
2+
3+
on:
4+
schedule:
5+
# Runs every sunday at 3 a.m.
6+
- cron: '0 3 * * SUN'
7+
8+
jobs:
9+
call-test-workflow:
10+
uses: BlueBrain/BluePyOpt/.github/workflows/test.yml@master
11+
12+
keep-workflow-alive:
13+
name: Keep workflow alive
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
with:
18+
ref: master
19+
20+
- name: Get date from 50 days ago
21+
run: |
22+
datethen=`date -d "-50 days" --utc +%FT%TZ`
23+
echo "datelimit=$datethen" >> $GITHUB_ENV
24+
25+
- name: setup git config
26+
if: github.event.base.repo.updated_at <= env.datelimit
27+
run: |
28+
# setup the username and email.
29+
git config user.name "Github Actions Keepalive Bot"
30+
git config user.email "<>"
31+
32+
- name: commit IF last commit is older than 50 days
33+
if: github.event.base.repo.updated_at <= env.datelimit
34+
run: |
35+
git commit -m "Empty commit to keep the gihub workflows alive" --allow-empty
36+
git push origin master

.github/workflows/main.yml

Lines changed: 0 additions & 61 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
# allows this workflow to be reusable (e.g. by the build workflow)
6+
workflow_call:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip setuptools
26+
pip install tox tox-gh-actions
27+
28+
- name: Run tox
29+
run: tox
30+
31+
- name: "Upload coverage to Codecov"
32+
uses: codecov/codecov-action@v2
33+
with:
34+
token: ${{ secrets.CODECOV_TOKEN }}
35+
fail_ci_if_error: false

0 commit comments

Comments
 (0)