Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

build: changing modules targets to 'verb-noun' style #73

Closed
wants to merge 11 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 33 additions & 14 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@ env:
FORCE_COLOR: 1

jobs:
clean-git-history-checking:
clean-git-history:
name: Clean Git History
runs-on: ubuntu-latest
steps:
- name: Download Earthly v0.7.17.
@@ -17,9 +18,10 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Check history.
run: earthly --ci +clean-git-history-checking --from_reference "origin/${{ github.base_ref }}"
- name: Check clean Git history.
run: earthly --ci +check-clean-git-history --from_reference "origin/${{ github.base_ref }}"
go-formatting:
name: Go Formatting
runs-on: ubuntu-latest
steps:
- name: Download Earthly v0.7.17.
@@ -29,6 +31,7 @@ jobs:
- name: Check formatting.
run: earthly --ci +check-go-formatting
sh-formatting:
name: Sh Formatting
runs-on: ubuntu-latest
steps:
- name: Download Earthly v0.7.17.
@@ -38,6 +41,7 @@ jobs:
- name: Check formatting.
run: earthly --ci +check-sh-formatting
yaml-formatting:
name: YAML Formatting
runs-on: ubuntu-latest
steps:
- name: Download Earthly v0.7.17.
@@ -47,47 +51,62 @@ jobs:
- name: Check formatting.
run: earthly --ci +check-yaml-formatting
go-linting:
name: Go Linting
runs-on: ubuntu-latest
steps:
- name: Download Earthly v0.7.17.
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.7.17/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
- name: Checkout code.
uses: actions/checkout@v3
- name: Check linting.
run: earthly --ci +go-linting
run: earthly --ci +check-go-linting
sh-linting:
name: Sh Linting
runs-on: ubuntu-latest
steps:
- name: Download Earthly v0.7.17.
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.7.17/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
- name: Checkout code.
uses: actions/checkout@v3
- name: Check linting.
run: earthly --ci +sh-linting
module-tidying:
run: earthly --ci +check-sh-linting
modules:
name: Modules
runs-on: ubuntu-latest
steps:
- name: Download Earthly v0.7.17.
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.7.17/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
- name: Checkout code.
uses: actions/checkout@v3
- name: Check module.
run: earthly --ci +check-module-tidying
compiling:
- name: Check modules.
run: earthly --ci +check-modules
compile-darwin-amd64:
name: Compile Darwin AMD64
runs-on: ubuntu-latest
steps:
- name: Download Earthly v0.7.17.
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.7.17/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
- name: Checkout code.
uses: actions/checkout@v3
- name: Check compiling.
run: earthly --ci +compiling-linux-amd64
unit-testing:
- name: Compile Darwin AMD64.
run: earthly --ci +compile-darwin-amd64
compile-linux-amd64:
name: Compile Linux AMD64
runs-on: ubuntu-latest
steps:
- name: Download Earthly v0.7.17.
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.7.17/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
- name: Checkout code.
uses: actions/checkout@v3
- name: Check unit testing.
run: earthly --ci +unit-testing
- name: Compile Linux AMD64.
run: earthly --ci +compile-linux-amd64
unit-test:
name: Unit Test
runs-on: ubuntu-latest
steps:
- name: Download Earthly v0.7.17.
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.7.17/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
- name: Checkout code.
uses: actions/checkout@v3
- name: Unit test.
run: earthly --ci +unit-test
13 changes: 7 additions & 6 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@ env:
FORCE_COLOR: 1

jobs:
Linting:
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- name: Download Earthly v0.7.17.
@@ -17,9 +18,9 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Linting commits.
run: earthly --ci +conventional-commits-linting --from_reference "origin/${{ github.base_ref }}"
Next-Version:
- name: Check commits Linting.
run: earthly --ci +check-conventional-commits-linting --from_reference "origin/${{ github.base_ref }}"
next-version:
name: Next Version
runs-on: ubuntu-latest
steps:
@@ -30,5 +31,5 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Checking expected vs current version.
run: earthly --ci +conventional-commits-next-version-checking --from_reference "origin/${{ github.base_ref }}"
- name: Check expected vs current version.
run: earthly --ci +check-conventional-commits-next-version --from_reference "origin/${{ github.base_ref }}"
7 changes: 4 additions & 3 deletions .github/workflows/github-actions-workflows.yml
Original file line number Diff line number Diff line change
@@ -7,12 +7,13 @@ env:
FORCE_COLOR: 1

jobs:
Linting:
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- name: Download Earthly v0.7.17.
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.7.17/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
- name: Checkout code.
uses: actions/checkout@v3
- name: Lint GitHub Actions Workflows.
run: earthly +github-actions-workflows-linting
- name: Check GitHub Actions workflows linting.
run: earthly +check-github-actions-workflows-linting
52 changes: 26 additions & 26 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -18,28 +18,28 @@ rust-base:
FROM rust:1.70.0


clean-git-history-checking:
check-clean-git-history:
FROM +rust-base
RUN cargo install clean_git_history --version 0.1.2
DO +COPY_METADATA
ARG from_reference="origin/HEAD"
RUN ./ci/clean-git-history-checking.sh --from-reference "${from_reference}"
RUN ./ci/check-clean-git-history.sh --from-reference "${from_reference}"


conventional-commits-linting:
check-conventional-commits-linting:
FROM +rust-base
RUN cargo install conventional_commits_linter --version 0.12.3
DO +COPY_METADATA
ARG from_reference="origin/HEAD"
RUN ./ci/conventional-commits-linting.sh --from-reference "${from_reference}"
RUN ./ci/check-conventional-commits-linting.sh --from-reference "${from_reference}"


conventional-commits-next-version-checking:
check-conventional-commits-next-version:
FROM +rust-base
RUN cargo install conventional_commits_next_version --version 6.0.0
DO +COPY_METADATA
ARG from_reference="origin/HEAD"
RUN ./ci/conventional-commits-next-version-checking.sh --from-reference "${from_reference}"
RUN ./ci/check-conventional-commits-next-version.sh --from-reference "${from_reference}"


INSTALL_DEPENDENCIES:
@@ -133,12 +133,12 @@ fix-formatting:
BUILD +fix-yaml-formatting


go-linting:
check-go-linting:
FROM +golang-base
RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.0
DO +INSTALL_DEPENDENCIES
DO +COPY_SOURCECODE
RUN ./ci/go-linting.sh
RUN ./ci/check-go-linting.sh


ubuntu-base:
@@ -147,64 +147,64 @@ ubuntu-base:
RUN apt-get update --fix-missing


sh-linting:
check-sh-linting:
FROM +ubuntu-base
RUN apt-get install shellcheck -y
DO +COPY_CI_DATA
RUN ./ci/sh-linting.sh
RUN ./ci/check-sh-linting.sh


github-actions-workflows-linting:
check-github-actions-workflows-linting:
FROM +golang-base
RUN go install github.com/rhysd/actionlint/cmd/actionlint@v1.6.24
DO +COPY_METADATA
RUN ./ci/github-actions-workflows-linting.sh
RUN ./ci/check-github-actions-workflows-linting.sh


linting:
BUILD +go-linting
BUILD +sh-linting
BUILD +github-actions-workflows-linting
check-linting:
BUILD +check-go-linting
BUILD +check-sh-linting
BUILD +check-github-actions-workflows-linting


check-module-tidying:
check-modules:
FROM +golang-base
DO +INSTALL_DEPENDENCIES
DO +COPY_SOURCECODE
RUN ./ci/check-module-tidying.sh
RUN ./ci/check-modules.sh


fix-module-tidying:
fix-modules:
FROM +golang-base
DO +INSTALL_DEPENDENCIES
DO +COPY_SOURCECODE
RUN ./ci/fix-module-tidying.sh
RUN ./ci/fix-modules.sh
SAVE ARTIFACT "go.mod" AS LOCAL "go.mod"
SAVE ARTIFACT "go.sum" AS LOCAL "go.sum"


compiling-linux-amd64:
compile-linux-amd64:
FROM +golang-base
DO +INSTALL_DEPENDENCIES
DO +COPY_SOURCECODE
RUN ./ci/compiling.sh
RUN ./ci/compile.sh
DO +SAVE_OUTPUT


compiling-darwin-amd64:
compile-darwin-amd64:
FROM +golang-base
ENV GOOS=darwin
DO +INSTALL_DEPENDENCIES
DO +COPY_SOURCECODE
RUN ./ci/compiling.sh
RUN ./ci/compile.sh
DO +SAVE_OUTPUT


unit-testing:
unit-test:
FROM +golang-base
DO +INSTALL_DEPENDENCIES
DO +COPY_SOURCECODE
RUN ./ci/unit-testing.sh
RUN ./ci/unit-test.sh


releasing:
43 changes: 22 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -31,12 +31,11 @@ This amount should then be transferred into a savings goal, helping the customer
* [Commands](#commands)
* [Check Formatting](#check-formatting)
* [Fix Formatting](#fix-formatting)
* [Linting](#linting)
* [Linting](#linting)
* [Check Module Tidying](#check-module-tidying)
* [Fix Module Tidying](#fix-module-tidying)
* [Compiling](#compiling)
* [Unit Testing](#unit-testing)
* [Check Linting](#check-linting)
* [Check Modules](#check-modules)
* [Fix Modules](#fix-modules)
* [Compile](#compile)
* [Unit Test](#unit-test)

## Usage
To use this tool you first of all want to compile Go source code to a binary, see [setup](#setup) and [compiling](#compiling) on details to compile the binary.
@@ -157,43 +156,45 @@ You can fix the formatting of the source code by running the command.
earthly +fix-formatting
```

#### Linting
You can lint the source code by running the command.
#### Check Linting
You can check the source code passes all linting by running the command.

```sh
earthly +linting
earthly +check-linting
```

#### Check Module Tidying
You can check there are no missing or redundant module requirements by running the command.
#### Check Modules
You can check there are no missing or redundant modules by running the command.

```sh
earthly +check-module-tidying
earthly +check-modules
```

#### Fix Module Tidying
#### Fix Modules
You can fix missing or redundant module requirements by running the command.

```sh
earthly +fix-module-tidying
earthly +fix-modules
```

#### Compiling
You can compile the source code into a binary by running the command.
#### Compile
You can compile the source code into a binary for an architecture by running the command.

```sh
earthly +compiling-linux-amd64
earthly +compile-${architecture}
```

or
The available architectures are `linux-amd64` and `darwin-amd64`.

*E.g.*

```sh
earthly +compiling-darwin-amd64
earthly +compile-linux-amd64
```

#### Unit Testing
#### Unit Test
You can run all the unit tests by running the command.

```sh
earthly +unit-testing
earthly +unit-test
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.