-
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.
ci: adding GitHub Actions Workflows linting
- Loading branch information
1 parent
a07c5f6
commit 8d214e0
Showing
3 changed files
with
34 additions
and
64 deletions.
There are no files selected for viewing
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,19 @@ | ||
name: GitHub Actions Workflows | ||
|
||
on: pull_request | ||
|
||
env: | ||
# Forcing Earthly to use colours, to make reading output easier. | ||
FORCE_COLOR: 1 | ||
|
||
jobs: | ||
linting: | ||
name: Linting | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download Earthly v0.8.6. | ||
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.8.6/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'" | ||
- name: Checkout code. | ||
uses: actions/checkout@v3 | ||
- name: Check GitHub Actions workflows linting. | ||
run: earthly +check-github-actions-workflows-linting |
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,68 +1,13 @@ | ||
VERSION 0.6 | ||
VERSION 0.7 | ||
|
||
|
||
clean-git-history-checking: | ||
FROM rust | ||
RUN cargo install clean_git_history | ||
COPY ".git" "." | ||
ARG from="origin/HEAD" | ||
RUN /usr/local/cargo/bin/clean_git_history --from-reference "${from}" | ||
COPY_CI_DATA: | ||
COMMAND | ||
COPY --dir "ci/" ".github/" "./" | ||
|
||
|
||
conventional-commits-linting: | ||
FROM rust | ||
RUN cargo install conventional_commits_linter | ||
COPY ".git" "." | ||
ARG from="origin/HEAD" | ||
RUN /usr/local/cargo/bin/conventional_commits_linter --from-reference "${from}" --allow-angular-type-only | ||
|
||
|
||
clang-base: | ||
FROM archlinux:base | ||
RUN pacman -Sy --noconfirm | ||
RUN pacman -S clang cunit --noconfirm | ||
COPY "./src" "./src" | ||
COPY "./tests" "./tests" | ||
|
||
|
||
check-formatting: | ||
FROM +clang-base | ||
RUN find "./src" "./tests" -type f -name "*.c" | xargs -I {} clang-format --dry-run --Werror "{}" | ||
|
||
|
||
fix-formatting: | ||
FROM +clang-base | ||
RUN find "./src" "./tests" -type f -name "*.c" | xargs -I {} clang-format -i "{}" | ||
SAVE ARTIFACT "./src" AS LOCAL "./src" | ||
SAVE ARTIFACT "./tests" AS LOCAL "./tests" | ||
|
||
|
||
linting: | ||
FROM +clang-base | ||
RUN find "./src" "./tests" -type f -name "*.c" | xargs -I {} clang-tidy --checks="*,-llvmlibc-restrict-system-libc-headers,-altera-id-dependent-backward-branch,-altera-unroll-loops,-cert-err33-c" --warnings-as-errors="*" "{}" | ||
|
||
|
||
archlinux-base: | ||
FROM archlinux:base-devel | ||
RUN pacman -Sy --noconfirm | ||
RUN pacman -S lib32-gcc-libs lib32-glibc cunit --noconfirm | ||
COPY "./src" "./src" | ||
COPY "./tests" "./tests" | ||
|
||
|
||
compiling: | ||
FROM +archlinux-base | ||
RUN gcc -o "./shellcode-generator" "./src/shellcode-generator.c" | ||
|
||
|
||
unit-testing: | ||
FROM +archlinux-base | ||
RUN gcc -lcunit -o "./shellcode-generator-tests" "./tests/shellcode-generator-tests.c" | ||
RUN "./shellcode-generator-tests" | ||
|
||
|
||
payload-compiling: | ||
FROM +archlinux-base | ||
COPY "./output.c" "./output.c" | ||
RUN gcc -o "./output" "./output.c" -m32 -fno-stack-protector -z execstack | ||
RUN "./output" | ||
check-github-actions-workflows-linting: | ||
FROM golang:1.20.13 | ||
RUN go install github.com/rhysd/actionlint/cmd/[email protected] | ||
DO +COPY_CI_DATA | ||
RUN ./ci/check-github-actions-workflows-linting.sh |
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,6 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -o errexit | ||
set -o xtrace | ||
|
||
actionlint --verbose .github/workflows/* |