Skip to content

Commit

Permalink
ci: add sanity check and action.yml
Browse files Browse the repository at this point in the history
Signed-off-by: tison <[email protected]>
  • Loading branch information
tisonkun committed Mar 23, 2024
1 parent 46213b4 commit 009df3c
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,52 @@ jobs:
- name: Run benches
run: cargo bench --workspace -- --test

docker:
if: (github.event_name != 'schedule') || (github.repository == 'korandoru/hawkeye')
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, buildjet-4vcpu-ubuntu-2204-arm ]
runs-on: ${{matrix.os}}
name: Build and test ${{matrix.name}} ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Build and load
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
tags: hawkeye:ci
outputs: type=docker
- name: Save image
run: docker save hawkeye:ci -o /tmp/hawkeye-${{matrix.os}}.tar
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: hawkeye-${{matrix.os}}
path: /tmp/hawkeye-${{matrix.os}}.tar
- name: Sanity check
run: |
cp action.yml action.yml.bak
docker image inspect hawkeye:ci --format='{{.Size}}'
docker run --rm -v $(pwd):/github/workspace hawkeye:ci -V
docker run --rm -v $(pwd):/github/workspace hawkeye:ci check
required:
name: Required
runs-on: ubuntu-latest
if: ${{ always() }}
needs:
- check
- docker
- test
steps:
- name: Guardian
run: |
if [[ ! ( \
"${{ needs.check.result }}" == "success" \
&& "${{ needs.test.result }}" == "success" \
&& "${{ needs.docker.result }}" == "success" \
) ]]; then
echo "Required jobs haven't been completed successfully."
exit -1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target
*.bak
40 changes: 40 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2024 tison <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: HawkEye Action
description: 'Check, format, or remove license headers.'
author: 'tison <[email protected]>'
branding:
icon: 'code'
color: 'blue'

inputs:
config:
description: The configuration file
required: false
default: licenserc.toml
mode:
description: |
Which mode License Eye should be run in. Choices are `check` or `fix`. The
default value is `check`.
required: false
default: check

runs:
using: docker
image: docker://ghcr.io/korandoru/hawkeye-native:latest
args:
- ${{ inputs.mode }}
- --config
- ${{ inputs.config }}
4 changes: 4 additions & 0 deletions licenserc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

headerPath = "Apache-2.0.txt"

excludes = [
"*.txt",
]

[properties]
inceptionYear = 2024
copyrightOwner = "tison <[email protected]>"

0 comments on commit 009df3c

Please sign in to comment.