-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
106 additions
and
5 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @tateexon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: 'Update Internal Mirrors Action' | ||
inputs: | ||
version: | ||
description: The go-change-delta version you wish to use | ||
required: false | ||
default: latest | ||
install: | ||
description: Should we install go-change-delta | ||
required: false | ||
default: 'true' | ||
use-nix: | ||
description: Should nix be used under the hood, requires this projects load-nix action | ||
required: false | ||
default: 'false' | ||
base-ref: | ||
description: The base ref to compare results against, typically this is main | ||
required: false | ||
default: ${{ github.base_ref }} | ||
depth: | ||
description: The depth of recursion to check, 0 is default and infinite and will get all packages at any depth | ||
required: false | ||
default: '0' | ||
path: | ||
description: The path to the root of the go module, if this is a a go module not at the root this is helpful | ||
required: false | ||
default: "" | ||
exclude: | ||
description: A comma separated list of paths to exclude from the checks | ||
required: false | ||
default: "" | ||
include-test: | ||
description: Should include test only package changes | ||
required: false | ||
default: true | ||
outputs: | ||
packages: | ||
description: Affected Packages | ||
value: ${{ steps.delta.outputs.packages || '' }} | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Install go-change-delta | ||
if: inputs.install == 'true' | ||
shell: bash | ||
run: | | ||
if [ "${{ inputs.use-nix }}" == "false" ]; then | ||
go install github.com/tateexon/go-change-delta@${{ inputs.version }} | ||
else | ||
nix develop -c sh -c "go install github.com/tateexon/go-change-delta@${{ inputs.version }}" | ||
fi | ||
- name: Get Packages Delta | ||
id: delta | ||
shell: bash | ||
run: | | ||
packages="" | ||
if [ "${{ inputs.use-nix }}" == "false" ]; then | ||
packages=$(go-change-delta -b=${{inputs.base-ref}} -l=${{inputs.depth}} -p=${{inputs.path}} -e=${{inputs.exclude}} -t=${{inputs.include-test}}) | ||
else | ||
packages=$(nix develop -c -sh "go-change-delta -b=${{inputs.base-ref}} -l=${{inputs.depth}} -p=${{inputs.path}} -e=${{inputs.exclude}} -t=${{inputs.include-test}}") | ||
fi | ||
echo "packages=${packages}" >> $GITHUB_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Load Nix | ||
description: Load nix and setup a cleaner alias on `n` to run bash from within nix | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Install Nix | ||
uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b # v27 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
- name: Pre-Load Nix | ||
shell: bash | ||
run: | | ||
nix develop -c sh -c "echo \"load\"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Test | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
pre-commit: | ||
name: Run Go Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the Repo | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
with: | ||
fetch-depth: 0 # needed for pre-commit to work correctly | ||
- name: Load Nix | ||
uses: ./.github/actions/load-nix | ||
- name: Get Affected Packages | ||
uses: ./.github/actions/go-change-delta | ||
id: delta | ||
with: | ||
use-nix: 'true' | ||
- name: Run Tests | ||
run: nix develop -c sh -c "go test -timeout 5m -cover -covermode=count ${{ steps.delta.outputs.packages }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
go-change-delta | ||
/go-change-delta | ||
unit-test-coverage.out |