Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor attempt while providing upstream downstream #262

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
67 changes: 67 additions & 0 deletions .github/workflows/bash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Bash

# Relevant to events - https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows
on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]
paths:
- '**.bash'
- "tools/dockerfreeze"

jobs:
# Linting
lint:
runs-on: ubuntu-latest
container: debian:stable
steps:
- name: Installing dependencies..
run: |
# Sync repos
# Check for git
if ! apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then
# Check if we can install git
if ! apt list | grep -qP "^git\/stable.*"; then
apt update
elif apt list | grep -qP "^git\/stable.*"; then
true
else
exit 255
fi
# Install git
apt install -y git
elif apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then
true
else
exit 255
fi
# Check for shellcheck
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to run the spellcheck twice.

if ! apt list --installed 2>/dev/null | grep -qP "^shellcheck\s{1}-.*"; then
# Check if we can install shellcheck
if ! apt list | grep -qP "^shellcheck\s{1}-.*"; then
apt update
elif apt list | grep -qP "^shellcheck\s{1}-.*"; then
true
else
exit 255
fi
# Install shellcheck
apt install -y shellcheck
elif apt list --installed 2>/dev/null | grep -qP "^shellcheck\s{1}-.*"; then
true
else
exit 255
fi
- name: Pulling git dir..
uses: actions/checkout@v2
- name: Processing files..
# Make sure that bash is used
shell: bash
run: |
cd "$GITHUB_WORKSPACE"

# Process files
## NOTICE: Do not use for loop to avoid pitfall https://mywiki.wooledge.org/BashPitfalls#pf1
git --git-dir="$GITHUB_WORKSPACE/.git" ls-files -z -- '*.bash' tools/dockerfreeze | while IFS= read -rd '' file; do
printf 'linting bash file %s\n' "$file"
shellcheck --external-sources --shell=bash "$file"
done
20 changes: 20 additions & 0 deletions .github/workflows/bootstrap-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: bootstrap-test

# Relevant to events - https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows
on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]
paths:
- 'bootstrap.sh'

jobs:
# Linting
lint:
runs-on: ubuntu-latest
container: debian:stable
steps:
- name: FIXME
# Make sure that bash is used
shell: bash
run: |
printf '%s\n' "FIXME"
Comment on lines +1 to +20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already included into travis, no need for this.

20 changes: 20 additions & 0 deletions .github/workflows/exherbo-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Exherbo

# Relevant to events - https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows
on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]
paths:
- 'dist/paludis/exherbo'

jobs:
# Linting
lint:
runs-on: ubuntu-latest
container: exherbo:exherbo-x86_64-pc-linux-gnu-base
steps:
- name: FIXME
# Make sure that bash is used
shell: bash
run: |
printf '%s\n' "FIXME"
Comment on lines +1 to +20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to downplay Exherbo - but before a CI for Exherbo is added, one might add Fedora or Arch first since they have a much bigger user and developer base, and thus are more representative if the CI would actually fail.

66 changes: 66 additions & 0 deletions .github/workflows/shell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Shell

# Relevant to events - https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows
on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]
paths:
- '**.sh'

jobs:
# Linting
lint:
runs-on: ubuntu-latest
container: debian:stable
steps:
- name: Installing dependencies..
run: |
# Sync repos
# Check for git
if ! apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then
# Check if we can install git
if ! apt list | grep -qP "^git\/stable.*"; then
apt update
elif apt list | grep -qP "^git\/stable.*"; then
true
else
exit 255
fi
# Install git
apt install -y git
elif apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then
true
else
exit 255
fi
# Check for shellcheck
if ! apt list --installed 2>/dev/null | grep -qP "^shellcheck\s{1}-.*"; then
# Check if we can install shellcheck
if ! apt list | grep -qP "^shellcheck\s{1}-.*"; then
apt update
elif apt list | grep -qP "^shellcheck\s{1}-.*"; then
true
else
exit 255
fi
# Install shellcheck
apt install -y shellcheck
elif apt list --installed 2>/dev/null | grep -qP "^shellcheck\s{1}-.*"; then
true
else
exit 255
fi
- name: Pulling git dir..
uses: actions/checkout@v2
- name: Processing files..
# Make sure that bash is used
shell: bash
run: |
cd "$GITHUB_WORKSPACE"

# Process files
## NOTICE: Do not use for loop to avoid pitfall https://mywiki.wooledge.org/BashPitfalls#pf1
git --git-dir="$GITHUB_WORKSPACE/.git" ls-files -z -- '*.sh' | while IFS= read -rd '' file; do
printf 'linting shell file %s\n' "$file"
shellcheck --external-sources --shell=sh "$file"
done
Comment on lines +1 to +66
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides a spellcheck being pretty much useless wasted computation time, this can be easily integrated into travis in like two lines.

25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
all:
# FIXME: Add nice message
@ exit 2

build:
@ bootstrap.sh build

exherbo-docker-test:
@ sudo docker run \
--interactive \
--tty \
--volume "$$(pwd)/dist/paludis/exherbo:/var/repositories/gamemode" \
exherbo/exherbo-x86_64-pc-linux-gnu-base \
bash -c "true \
&& chown root:tty /dev/tty \
&& usermod -a -G tty paludisbuild \
&& printf '%s\n' \
\"format = e\" \
\"location = \"\$$\{root\}/var/db/paludis/repositories/gamemode\"\" \
\"sync = file:///var/repositories/gamemode\" \
> /etc/paludis/repositories/gamemode.conf \
&& cat /etc/paludis/repositories/gamemode.conf \
&& cave sync \
&& cave resolve games-utils/gamemode \
"
Comment on lines +1 to +25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a second build system (Make) just for a test that could be run in a script is a bad idea, it ruins automatic build systems like debhelper on Debian.

Loading