Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,16 @@ jobs:
uses: actions/checkout@v3
- name: Check formatting.
run: earthly --ci +check-${{ matrix.language }}-formatting
linting:
name: Linting
runs-on: ubuntu-latest
strategy:
matrix:
language: [rust, shell]
steps:
- name: Download Earthly v0.8.12.
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.8.12/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 +check-${{ matrix.language }}-linting
44 changes: 32 additions & 12 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ check-clean-git-history:
RUN ./ci/check-clean-git-history.sh --from-reference "${from_reference}"


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


COPY_SOURCECODE:
COMMAND
DO +COPY_CI_DATA
Expand Down Expand Up @@ -72,13 +80,6 @@ check-formatting:
BUILD +check-yaml-formatting


fix-rust-formatting:
FROM +rust-base
DO +COPY_SOURCECODE
RUN ./ci/fix-rust-formatting.sh
SAVE ARTIFACT "src/" AS LOCAL "./"


fix-shell-formatting:
FROM +shell-formatting-base
RUN ./ci/fix-shell-formatting.sh
Expand All @@ -97,16 +98,35 @@ fix-formatting:
BUILD +fix-yaml-formatting


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


ubuntu-base:
FROM ubuntu:22.04
# https://askubuntu.com/questions/462690/what-does-apt-get-fix-missing-do-and-when-is-it-useful
RUN apt-get update --fix-missing
WORKDIR /tmp/starling-bank-technical-challenge


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


check-github-actions-workflows-linting:
FROM +golang-base
RUN go install github.com/rhysd/actionlint/cmd/[email protected]
DO +COPY_CI_DATA
RUN ./ci/check-github-actions-workflows-linting.sh


check-linting:
BUILD +check-rust-linting
BUILD +check-shell-linting
BUILD +check-github-actions-workflows-linting
8 changes: 8 additions & 0 deletions ci/check-rust-linting.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env sh

set -o errexit
set -o xtrace

cargo clippy --verbose --workspace --all-targets -- -D warnings
cargo clippy --verbose --workspace --all-targets --all-features -- -D warnings
cargo clippy --verbose --workspace --all-targets --no-default-features -- -D warnings
6 changes: 6 additions & 0 deletions ci/check-shell-linting.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh

set -o errexit
set -o xtrace

shellcheck ci/*