Skip to content

Commit

Permalink
Become a golang command line tool (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeReaper authored Jul 3, 2024
1 parent c4bd60a commit 7b01ec6
Show file tree
Hide file tree
Showing 92 changed files with 2,280 additions and 1,743 deletions.
8 changes: 0 additions & 8 deletions .devcontainer/Dockerfile

This file was deleted.

26 changes: 0 additions & 26 deletions .devcontainer/devcontainer.json

This file was deleted.

17 changes: 6 additions & 11 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,23 @@ root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[.*]
indent_size = 2
indent_style = space

[*.sh,dotrc]
[*.yml]
indent_size = 2
indent_style = space

[*.{yml,yaml}]
[*.yaml]
indent_size = 2
indent_style = space

[lane]
indent_size = 2
indent_style = space

[version]
insert_final_newline = false

[*.md]
indent_size = unset
indent_style = unset

[Makefile]
indent_style = tab
indent_size = 4
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ updates:
patterns:
- "actions/*pages*"
- "actions/*-artifact"
- package-ecosystem: docker
directory: /.devcontainer/
- package-ecosystem: gomod
directory: /
schedule:
interval: weekly
2 changes: 0 additions & 2 deletions .github/test-mocks/.editorconfig

This file was deleted.

19 changes: 0 additions & 19 deletions .github/test-mocks/curl/curl

This file was deleted.

This file was deleted.

Empty file.
Empty file.

This file was deleted.

29 changes: 0 additions & 29 deletions .github/test-resources/shell-run-github-workflow-tests/test.yaml

This file was deleted.

61 changes: 26 additions & 35 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,58 +24,49 @@ jobs:
name: Create Artifacts
needs: version
runs-on: ubuntu-latest
strategy:
matrix:
include:
- {GOOS: linux, GOARCH: amd64}
- {GOOS: linux, GOARCH: arm, GOARM: 6}
- {GOOS: linux, GOARCH: arm64}
- {GOOS: darwin, GOARCH: amd64}
- {GOOS: darwin, GOARCH: arm64}
- {GOOS: freebsd, GOARCH: amd64}
steps:
- uses: actions/checkout@v4

- name: Bundle source files
run: |
mkdir bundle
cp -r lane.d bundle/
cp LICENSE bundle/LICENSE.txt
- name: Bundle version-injected-lane
run: |
VERSION='${{ needs.version.outputs.version }}'
printf '#!/bin/sh\nVERSION=''%s''\n' "$VERSION" > bundle/lane
tail +2 lane >> bundle/lane
chmod +x bundle/lane
- name: Verify version-injected-lane
run: |
sh bundle/lane -v | grep -iv unreleased
[ $? -eq 0 ] || exit 1
- name: Package files
run: |
cd bundle
tar -cJf "../lane-${{ needs.version.outputs.version }}.tar.xz" *
- name: Calculate checksums
run: |
for file in ./lane-*.tar.xz; do
[ -f "$file" ] || continue
sha512sum "$file" > "$file.sha512sum"
done
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: make package VERSION='${{ needs.version.outputs.version }}' SUFFIX='-${{ matrix.GOOS }}-${{ matrix.GOARCH }}'
shell: bash
env:
GOOS: ${{ matrix.GOOS }}
GOARCH: ${{ matrix.GOARCH }}
GOARM: ${{ matrix.GOARM }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-artifacts
path: lane-*.tar.*
name: release-artifacts-${{ matrix.GOOS }}-${{ matrix.GOARCH }}
path: build/lane-*.tar.*
if-no-files-found: error

create-release:
name: Create Release
needs: [version, create-artifacts]
needs:
- version
- create-artifacts
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: release-artifacts
merge-multiple: true
path: artifacts

- name: Display structure of files
run: ls -Rl
run: ls -Rlah

- name: Attach files
if: github.event_name == 'release'
Expand Down
66 changes: 31 additions & 35 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,43 @@ on:

jobs:
unit-tests:
uses: ./.github/workflows/unit-tests.yaml

editorconfig-check:
name: Editorconfig check
name: Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: editorconfig-checker/action-editorconfig-checker@main
- run: editorconfig-checker
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: make test
shell: bash
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: coverage-artifacts
path: build/coverage.*
if-no-files-found: error

shellcheck:
name: Shellcheck
documentation-tests:
name: Documentation tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Make files executable for shellcheck action to check them
run: |
chmod +x lane
find lane.d -name "run.sh" -type f -exec chmod +x {} \;
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
- uses: actions/setup-go@v5
with:
scandir: "./lane.d"
additional_files: "lane"
go-version-file: go.mod
- run: make update-docs
shell: bash
- run: git diff --quiet --exit-code
shell: bash

editorconfig-check:
name: Editorconfig check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: editorconfig-checker/action-editorconfig-checker@main
- run: editorconfig-checker
shell: bash

dependabot-validate:
name: Validate dependabot
Expand All @@ -55,12 +66,13 @@ jobs:
action-validator 0.6.0
- name: Lint workflows
run: find .github/workflows -type f \( -iname \*.yaml -o -iname \*.yml \) | xargs -I {} action-validator --verbose {}
shell: bash

tests-succeeded:
name: Tests Succeeded
needs:
- unit-tests
- shellcheck
- documentation-tests
- editorconfig-check
- dependabot-validate
- workflow-validate
Expand All @@ -69,19 +81,3 @@ jobs:
steps:
- name: All clear
run: exit 0

auto-merge-dependabot:
name: Automerge Dependabot PR
needs:
- tests-succeeded
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }}
permissions:
pull-requests: write
contents: write
steps:
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ github.token }}
Loading

0 comments on commit 7b01ec6

Please sign in to comment.