Skip to content

Commit

Permalink
💚 Adds gh-action tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rickstaa committed Jan 7, 2021
1 parent e48c0f8 commit f495708
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: [rickstaa]
13 changes: 13 additions & 0 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Docker Image CI
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . --file Dockerfile --tag ${{ github.repository }}:$(date +%s)
59 changes: 59 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: release
on:
push:
branches:
- main
tags:
- 'v*.*.*'
pull_request:
types:
- labeled

jobs:
release:
if: github.event.action != 'labeled'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# Bump version on merging Pull Requests with specific labels.
# (bump:major,bump:minor,bump:patch)
- id: bumpr
if: "!startsWith(github.ref, 'refs/tags/')"
uses: haya14busa/action-bumpr@v1

# Update corresponding major and minor tag.
# e.g. Update v1 and v1.2 when releasing v1.2.3
- uses: haya14busa/action-update-semver@v1
if: "!steps.bumpr.outputs.skip"
with:
tag: ${{ steps.bumpr.outputs.next_version }}

# Get tag name.
- id: tag
uses: haya14busa/action-cond@v1
with:
cond: "${{ startsWith(github.ref, 'refs/tags/') }}"
if_true: ${{ github.ref }}
if_false: ${{ steps.bumpr.outputs.next_version }}

# Create release.
- uses: actions/create-release@v1
if: "steps.tag.outputs.value != ''"
env:
# This token is provided by Actions, you do not need to create your own token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.value }}
release_name: Release ${{ steps.tag.outputs.value }}
body: ${{ steps.bumpr.outputs.message }}
draft: false
prerelease: false

release-check:
if: github.event.action == 'labeled'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Post bumpr status comment
uses: haya14busa/action-bumpr@v1
63 changes: 63 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Test
on:
push:
branches:
- main
pull_request:
jobs:
test-check:
name: runner / remark-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./
id: remark_lint_format
with:
fail_on_error: "false"
- name: Check if code is left untouched (not formatted)
run: |
changed_files=$(git status --porcelain | wc -l)
if [[ ${changed_files} -eq 0 ]]; then
echo "No changes detected!"
else
echo "Changes detected!"
exit 1
fi
- name: Check 'is_formatted' output value
run: |
formatted=${{ steps.remark_lint_format.outputs.is_formatted }}
if [[ ${formatted} != "false" ]]; then
echo "'is_formatted' output invalid!"
exit 1
else
echo "'is_formatted' output valid."
fi
test-format:
name: runner / remark-lint-format (format)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./
id: remark_lint_format
with:
remark_args: ". -o"
fail_on_error: "false"
- name: Check if formatting was successful
run: |
changed_files=$(git status --porcelain | wc -l)
if [[ ${changed_files} -eq 0 ]]; then
echo "No changes detected!"
exit 1
else
echo "Changes detected!"
fi
- name: Check 'is_formatted' output value
run: |
formatted=${{ steps.remark_lint_format.outputs.is_formatted }}
if [[ ${formatted} == "false" ]]; then
echo "'is_formatted' output invalid!"
exit 1
else
echo "'is_formatted' output valid."
fi

0 comments on commit f495708

Please sign in to comment.