Skip to content

Commit

Permalink
ci: rework github actions for semantic-release
Browse files Browse the repository at this point in the history
* Run Dockerhub publish on GitHub release.
* Add commitlint job.
* Run `semantic-release` on push when tests pass. This will trigger a GitHub release accordingly.
  • Loading branch information
igboyes committed Oct 13, 2021
1 parent 673e535 commit 54ace68
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 24 deletions.
40 changes: 28 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
name: CI
name: ci

on:
pull_request:
branches:
- "*"

push:
branches:
- "master"
- "main"

jobs:
commitlint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v4
test:
runs-on: ubuntu-latest

runs-on: ubuntu-20.04
container:
image: python:3.9-buster

services:
redis:
image: redis:6.0
mongo:
image: mongo:4.4

steps:
- uses: actions/checkout@v2

- name: Install Poetry
run: pip install poetry

- name: Install Bowtie2
run: |
wget https://github.com/BenLangmead/bowtie2/releases/download/v2.3.2/bowtie2-2.3.2-legacy-linux-x86_64.zip
unzip bowtie2-2.3.2-legacy-linux-x86_64.zip
cp bowtie2-2.3.2-legacy/bowtie2* /usr/local/bin
- name: Install HMMER
run: |
wget http://eddylab.org/software/hmmer/hmmer-3.2.1.tar.gz
Expand All @@ -42,16 +42,32 @@ jobs:
./configure --prefix /hmmer
make
make install
- name: Install SPAdes
run: |
wget https://github.com/ablab/spades/releases/download/v3.11.0/SPAdes-3.11.0-Linux.tar.gz
tar -xvf SPAdes-3.11.0-Linux.tar.gz
mv SPAdes-3.11.0-Linux /spades
- name: Run tests
run: |
export PATH=$PATH:/hmmer/bin
export PATH=$PATH:/spades/bin
poetry install
poetry run pytest
release:
runs-on: ubuntu-20.04
needs: [test, commitlint]
if: github.event_name == 'push'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup NodeJS
uses: actions/setup-node@v1
with:
node-version: 14
- name: Install semantic-release
run: npm i semantic-release@v18.0.0 conventional-changelog-conventionalcommits@4.6.1
- name: Release
env:
GITHUB_USERNAME: ${{ secrets.GH_USERNAME }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: npx semantic-release
17 changes: 5 additions & 12 deletions .github/workflows/dockerhub.yml → .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
name: Release virtool/nuvs on DockerHub
name: publish

on:
workflow_dispatch:
inputs:
tag:
description: The docker image tag
required: true
default: 'latest'
release:
types: [published]

jobs:
dockerhub:
name: Push virtool/nuvs to DockerHub
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Push
uses: docker/build-push-action@v2
with:
push: true
tags: virtool/nuvs:${{ github.event.inputs.tag }}
tags: virtool/nuvs:${{ github.event.release.tag_name }}

0 comments on commit 54ace68

Please sign in to comment.