Skip to content

Commit

Permalink
ci: update CI to the latest standards
Browse files Browse the repository at this point in the history
  • Loading branch information
tagoro9 committed May 8, 2024
1 parent 46c8897 commit d6fa8dc
Show file tree
Hide file tree
Showing 10 changed files with 142 additions and 195 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @open-turo/github-actions
6 changes: 0 additions & 6 deletions .github/dependabot.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["github>open-turo/renovate-config#v1"]
}
99 changes: 5 additions & 94 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,103 +10,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: open-turo/actions-gha/lint@v1

test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: open-turo/actions-gha/test@v1

integration-test:
name: Integration test
runs-on: ubuntu-latest
steps:
- name: Checkout this repo
uses: actions/checkout@v3
- name: Search for comment within PR
id: before-add-fc
uses: peter-evans/find-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: open-turo-bot
body-includes:
${{ format('auto-gen for PR {0}',
github.event.pull_request.number)}}
token: ${{ secrets.OPEN_TURO_GITHUB_TOKEN }}
- name: Verify comment is not already present on the PR
if: steps.before-add-fc.outputs.comment-id != ''
run: |
echo "::error title=Unexpected PR state::Comment already exists on PR"
exit 1
- name: Add comment when not already present on the PR
if: steps.before-add-fc.outputs.comment-id == ''
uses: ./
with:
comment: Lorem ipsum dolor sit amet.
text-detector:
${{ format('auto-gen for PR {0}',
github.event.pull_request.number)}}
workflow: ADD
github-token: ${{ secrets.OPEN_TURO_GITHUB_TOKEN }}
- name: Search for comment that should now be present on the PR
id: after-add-fc
uses: peter-evans/find-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: open-turo-bot
body-includes: ipsum dolor
token: ${{ secrets.OPEN_TURO_GITHUB_TOKEN }}
- name: Verify comment is now present on the PR
if: steps.after-add-fc.outputs.comment-id == ''
run: |
echo "::error title=Unexpected PR state::Comment should exist on PR but is not found"
exit 1
- name: Update comment that is already present on the PR
if: success() && steps.after-add-fc.outputs.comment-id != ''
uses: ./
with:
comment: Lorem ipsum donor sit amet.
text-detector:
${{ format('auto-gen for PR {0}',
github.event.pull_request.number)}}
workflow: ADD
github-token: ${{ secrets.OPEN_TURO_GITHUB_TOKEN }}
- name: Search for updated comment that should be present on the PR
id: after-update-fc
uses: peter-evans/find-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: open-turo-bot
body-includes: ipsum donor
token: ${{ secrets.OPEN_TURO_GITHUB_TOKEN }}
- name: Verify updated comment is present on the PR
if: steps.after-update-fc.outputs.comment-id == ''
run: |
echo "::error title=Unexpected PR state::Updated comment should exist on PR but is not found"
exit 1
- name: Now delete the comment if present
if: success() && steps.after-update-fc.outputs.comment-id != ''
uses: ./
- name: Checkout
uses: actions/checkout@v4
- uses: ./
with:
text-detector:
${{ format('auto-gen for PR {0}',
github.event.pull_request.number)}}
workflow: REMOVE
checkout-repo: false
dry-run: true
github-token: ${{ secrets.OPEN_TURO_GITHUB_TOKEN }}
- name: Search for comment that should now have been deleted
id: after-delete-fc
if: success()
uses: peter-evans/find-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: open-turo-bot
body-includes: ipsum dolor
token: ${{ secrets.OPEN_TURO_GITHUB_TOKEN }}
- name: Verify comment is no longer present on the PR
if: steps.after-delete-fc.outputs.comment-id != ''
run: |
echo "::error title=Unexpected PR state::Comment should no longer exist on PR but is still present"
exit 1
- name: Test status
if: success() && steps.after-delete-fc.outputs.comment-id == ''
run: echo "Test success"
10 changes: 4 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,21 @@ jobs:
steps:
- uses: open-turo/actions-gha/lint@v1
with:
github-token: ${{ secrets.OPEN_TURO_GITHUB_TOKEN }}

github-token: ${{ secrets.GITHUB_TOKEN }}
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: open-turo/actions-gha/test@v1
with:
github-token: ${{ secrets.OPEN_TURO_GITHUB_TOKEN }}

github-token: ${{ secrets.GITHUB_TOKEN }}
release:
needs:
- lint
- test
name: Release
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.OPEN_TURO_GITHUB_TOKEN }}
steps:
- uses: open-turo/actions-gha/release@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/update-dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Update dependencies
concurrency: update-dependencies

on:
schedule:
# Every day at midnight
- cron: "0 0 * * *"
workflow_dispatch:
issue_comment:
types:
- edited
pull_request:
types:
- edited

jobs:
update-dependencies:
runs-on: ubuntu-latest
name: Update dependencies
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: open-turo/action-renovate@v1
with:
github-token: ${{ secrets.OPEN_TURO_GITHUB_TOKEN }}
22 changes: 13 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
exclude: dist/.*
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0 # Use the ref you want to point at
rev: v4.6.0 # Use the ref you want to point at
hooks:
- id: check-json
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.9.0
hooks:
- id: eslint
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.5.1
rev: v3.1.0
hooks:
- id: prettier
stages: [commit]
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v8.0.0
rev: v9.16.0
hooks:
- id: commitlint
stages: [commit-msg]
additional_dependencies: ["@open-turo/commitlint-config-conventional"]
- repo: https://github.com/rhysd/actionlint
rev: v1.6.8
rev: v1.6.27
hooks:
- id: actionlint
# actionlint doesn't like the uses: ./
exclude: ci.yaml
- repo: local
hooks:
- id: update-action-readme
name: update-action-readme
entry: ./script/update-action-readme
language: script
files: '.*action\.yaml$'
14 changes: 1 addition & 13 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
{
"branches": [
"main",
{
"channel": "next",
"name": "(f|b|c)/*",
"prerelease": "beta-<%= (/^\\w+-\\d+/.exec(name.substr(2)) || [])[0] %>"
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github"
]
"extends": "@open-turo/semantic-release-config"
}
Loading

0 comments on commit d6fa8dc

Please sign in to comment.