Skip to content
This repository has been archived by the owner on Aug 10, 2024. It is now read-only.

Commit

Permalink
Update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
rmenai committed Feb 28, 2022
1 parent 5af1711 commit 296ae3a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 22 deletions.
31 changes: 26 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
name: Build

on:
workflow_run:
workflows: [ "Test" ]
pull_request:
types:
- closed
branches:
- main
types:
- completed

workflow_dispatch:
inputs:
tag:
description: The tag name of the release.
required: false
type: string

jobs:
build:
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push'
# Make sure the pull request is merged or if the input is not empty.
if: ${{ github.event.pull_request.merged }} || ${{ github.event.inputs.tag }}
name: Build & Push
runs-on: ubuntu-latest

Expand All @@ -22,6 +28,7 @@ jobs:
run: |
tag=$(cut -c 1-7 <<< $GITHUB_SHA)
echo "::set-output name=tag::$tag"
- name: Checkout code
uses: actions/checkout@v2

Expand All @@ -47,3 +54,17 @@ jobs:
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.sha_tag.outputs.tag }}
# Parse the tag using the regex `v[0-9].*`.
- name: Parse the release tag
id: release
run: |
echo "::set-output name=tag::$(grep 'v[0-9].*' <<< \
'${{ github.head_ref }} ${{ github.event.inputs.tag }}')"
- name: Create the release
uses: softprops/action-gh-release@v1
if: ${{ steps.release.outputs.tag }}
with:
tag_name: ${{ steps.release.outputs.tag }}
generate_release_notes: true
30 changes: 13 additions & 17 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
name: Test

on:
push:
branches:
- main
paths-ignore:
- 'README.md'
- 'SECURITY.md'
- 'LICENSE'
- 'CONTRIBUTING.md'
- 'CODE_OF_CONDUCT.md'
- '.gitignore'
- '.github/pull_request_template.md'
- '.github/ISSUE_TEMPLATE/**'
on: [push, workflow_dispatch]

pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
Expand Down Expand Up @@ -77,5 +66,12 @@ jobs:
- name: Run pre-commit hooks
run: export PIP_USER=0; poetry run task lint

- name: Run tests with pytest
run: poetry run task test
- name: Run tests with pytest and generate coverage report
run: |
poetry run task test
coverage xml
- name: Upload coverage reports to CodeCov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }} # Only needed for private repositories.

0 comments on commit 296ae3a

Please sign in to comment.