Compare commits

..

No commits in common. "3b60243670c1e0ddad4d7314217592e7438d9c27" and "ac1849016d4fc1a2b6da9b2c0f4acf0eb7a050eb" have entirely different histories.

6 changed files with 19 additions and 72 deletions

View File

@ -1,42 +0,0 @@
name: Build Docker Image for Actions
on: [push]
if: github.ref == 'refs/heads/main'
jobs:
Check-If-Rebuild:
runs-on: ubuntu-22.04
env:
DEBIAN_FRONTEND: noninteractive
outputs:
last-time: ${{ steps.last-time.outputs.last-time }}
dockerfile-changed: ${{ steps.dockerfile-changed.outputs.dockerfile-changed }}
steps:
- name: Install jq
run: |
apt-get update -y
apt-get install -y jq
- name: Check last repository build time
id: last-time
run: curl -s https://hub.docker.com/v2/repositories/drunkendog/standard-build-actions/tags/latest
| jq '.last_updated'
| xargs -i date --date {} +%s
| xargs -i expr $(date +%s) - {}
| xargs -i echo last-time={} >> $GITHUB_OUTPUT
- name: Check if Dockerfile changed
id: dockerfile-changed
run: |
if ${{ github.event_name == 'pull_request' }}; then
echo dockerfile-changed=$(git diff --name-only -r HEAD^1 HEAD | grep -x actions/Dockerfile | wc -l) >> $GITHUB_OUTPUT
else
echo dockerfile-changed=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep -x actions/Dockerfile | wc -l) >> $GITHUB_OUTPUT
fi
Build-Image:
needs: [Check-If-Rebuild]
if: needs.Check-If-Rebuild.outputs.last-time > 86400 || needs.Check-If-Rebuild.outputs.dockerfile-changed == 1
runs-on: ubuntu-22.04
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Get Docker
run: curl -sL get.docker.io | bash
- name: Build and upload image
run: sh actions/build-docker-image.sh ${{ secrets.DOCKER_USERNAME }} ${{ secrets.DOCKER_TOKEN }}

View File

@ -0,0 +1,13 @@
name: Code Quality Test
on: [push, pull_request]
jobs:
Quality-Check:
runs-on: ubuntu-22.04
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Check for os.system (#2)
continue-on-error: true
run: |
git ls-files | xargs grep os.system
exit $(git ls-files | xargs grep os.system | wc -l)

View File

@ -1,18 +0,0 @@
name: Code Quality Test
on: [push, pull_request]
jobs:
Quality-Check:
runs-on: ubuntu-22.04
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Check for --prefix in Borg commands (\#1)
continue-on-error: true
run: |
git ls-files backup/ | xargs grep '\-\-prefix'
exit $(git ls-files backup/ | xargs grep '\-\-prefix' | wc -l)
- name: Check for os.system (\#2)
continue-on-error: true
run: |
git ls-files | xargs grep os.system
exit $(git ls-files | xargs grep os.system | wc -l)

View File

@ -11,8 +11,9 @@ jobs:
run: |
sh setup.sh
sh scripts/get-docker.sh
sh post-pull.sh
- name: Check if Docker was installed
run: docker run --rm --name hello-world hello-world
- name: Clean up network (see \#3)
run: docker run --name hello-world hello-world
- name: Clean up hello-world container
run: docker rm hello-world
- name: Clean up network (see #3)
run: docker network rm main_subnet

View File

@ -1,4 +1,4 @@
FROM ubuntu:22.04
FROM ubuntu-22.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && apt-get install -y ca-certificates curl gnupg lsb-release nano wget tmux htop python3 python3-pip git certbot borgbackup jq nodejs && rm -rf /var/lib/apt/lists/*
RUN apt-get update -y && apt-get upgrade -y && apt-get install -y ca-certificates curl gnupg lsb-release nano wget tmux htop python3 python3-pip git certbot borgbackup jq
CMD ["/bin/bash"]

View File

@ -1,7 +0,0 @@
#!/bin/bash
cd "${0%/*}"
docker login --username $1 --password $2
docker build -t drunkendog/standard-build-actions .
docker push drunkendog/standard-build-actions