1
0
Fork 1
mirror of https://github.com/heyhusen/archlinux-package-action.git synced 2025-04-01 17:15:01 +02:00

feat: add basic CI

This commit is contained in:
Ahmad Husen 2021-05-18 16:49:00 +07:00
parent 8be53f39c7
commit f95f613205
6 changed files with 118 additions and 13 deletions

15
.editorconfig Normal file
View file

@ -0,0 +1,15 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml,toml,js}]
indent_size = 2

7
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

28
.github/workflows/main.yml vendored Normal file
View file

@ -0,0 +1,28 @@
name: CI
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Get sample PKGBUILD
run: wget https://github.com/official-human/nonicons-font/raw/main/PKGBUILD
- name: Test actions
uses: ./
with:
updpkgsums: true
srcinfo: true

View file

@ -1,7 +1,17 @@
FROM alpine:3.10
# Base image
FROM docker.io/library/archlinux:base-devel
# Install dependencies
RUN pacman -Syu --needed --noconfirm pacman-contrib namcap
# Setup user
RUN useradd -m builder \
usermod -aG wheel builder \
echo 'wheel ALL=(ALL:ALL) ALL' >> /etc/sudoers
# Copy files
COPY LICENSE README.md /
COPY entrypoint.sh /entrypoint.sh
# Set entrypoint
ENTRYPOINT ["/entrypoint.sh"]

View file

@ -1,12 +1,37 @@
name: 'Container Action Template'
description: 'Get started with Container actions'
author: 'GitHub'
inputs:
myInput:
description: 'Input to use'
default: 'world'
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
name: "Arch Linux's package action"
description: "GitHub Action to run Arch Linux's package tools"
author: "datakrama"
branding:
icon: "package"
color: "green"
inputs:
path:
description: "Location for this action to run"
default: $GITHUB_WORKSPACE
required: false
updpkgsums:
description: "Update checksums on PKGBUILD"
default: "false"
required: false
srcinfo:
description: "Generate new .SRCINFO"
default: "false"
required: false
flags:
description: "Extra flags for makepkg"
default: "-cfs --noconfirm"
required: false
namcap:
description: "Validate package with namcap"
default: "true"
required: false
runs:
using: 'docker'
image: 'Dockerfile'
using: "docker"
image: "Dockerfile"
args:
- ${{ inputs.myInput }}
- ${{ inputs.updpkgsums }}
- ${{ inputs.flags }}
- ${{ inputs.namcap }}

View file

@ -1,3 +1,23 @@
#!/bin/sh -l
echo "hello $1"
cd $INPUT_PATH
if [[ $INPUT_UPDPKGSUMS == true ]]; then
echo "Update checksums on PKGBUILD"
updpkgsums
git diff PKGBUILD
fi
if [[ $INPUT_SRCINFO == true ]]; then
echo "Generate new .SRCINFO based on PKGBUILD"
sudo -u builder makepkg --printsrcinfo > .SRCINFO
git diff .SRCINFO
fi
echo "Run makepkg with flags"
sudo -u builder makepkg $INPUT_FLAGS
if [[ $INPUT_NAMCAP == true ]]; then
echo "Validate PKGBUILD with namcap"
namcap -i PKGBUILD
fi