mirror of
https://github.com/friendica/docker
synced 2025-01-21 10:23:16 +01:00
Merge pull request #123 from friendica/task/github_actions
Replace Travis CI with Github actions
This commit is contained in:
commit
fff02c89cf
5 changed files with 73 additions and 100 deletions
48
.github/workflows/images.yml
vendored
Normal file
48
.github/workflows/images.yml
vendored
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
name: GitHub CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
schedule:
|
||||||
|
- cron: 0 0 * * 0
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: 'bash -Eeuo pipefail -x {0}'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
generate-jobs:
|
||||||
|
name: Generate Jobs
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
strategy: ${{ steps.generate-jobs.outputs.strategy }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- id: generate-jobs
|
||||||
|
name: Generate Jobs
|
||||||
|
run: |
|
||||||
|
git clone --depth 1 https://github.com/docker-library/bashbrew.git -b master ~/bashbrew
|
||||||
|
strategy="$(GITHUB_REPOSITORY=friendica ~/bashbrew/scripts/github-actions/generate.sh)"
|
||||||
|
strategy="$(~/bashbrew/scripts/github-actions/munge-i386.sh -c <<<"$strategy")"
|
||||||
|
jq . <<<"$strategy" # sanity check / debugging aid
|
||||||
|
echo "::set-output name=strategy::$strategy"
|
||||||
|
test:
|
||||||
|
needs: generate-jobs
|
||||||
|
strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }}
|
||||||
|
name: ${{ matrix.name }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Prepare Environment
|
||||||
|
run: ${{ matrix.runs.prepare }}
|
||||||
|
- name: Pull Dependencies
|
||||||
|
run: ${{ matrix.runs.pull }}
|
||||||
|
- name: Build ${{ matrix.name }}
|
||||||
|
run: ${{ matrix.runs.build }}
|
||||||
|
- name: History ${{ matrix.name }}
|
||||||
|
run: ${{ matrix.runs.history }}
|
||||||
|
- name: Test ${{ matrix.name }}
|
||||||
|
run: ${{ matrix.runs.test }}
|
||||||
|
- name: '"docker images"'
|
||||||
|
run: ${{ matrix.runs.images }}
|
22
.github/workflows/update-sh.yml
vendored
Normal file
22
.github/workflows/update-sh.yml
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
name: update.sh
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: 'bash -Eeuo pipefail -x {0}'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
check-changes:
|
||||||
|
name: Check for Changes
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Check for Changes
|
||||||
|
run: |
|
||||||
|
hash_before="$(git write-tree)"
|
||||||
|
./update.sh
|
||||||
|
git add -A
|
||||||
|
[[ "$hash_before" = "$(git write-tree)" ]]
|
77
.travis.yml
77
.travis.yml
|
@ -1,77 +0,0 @@
|
||||||
language: bash
|
|
||||||
services: docker
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- test scripts
|
|
||||||
# small tests for PRs
|
|
||||||
- name: test images (amd64)
|
|
||||||
if: branch != master
|
|
||||||
# full test for master
|
|
||||||
- name: test images (full)
|
|
||||||
if: branch = master
|
|
||||||
|
|
||||||
install:
|
|
||||||
- git clone https://github.com/docker-library/official-images.git ~/official-images
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- env | sort
|
|
||||||
- image="friendica/server:${VERSION}${VARIANT:+-$VARIANT}"
|
|
||||||
- if [[ "$ARCH" == 'i386' ]]; then sed -i -e 's/FROM php/FROM i386\/php/g' "${VERSION}/${VARIANT}/Dockerfile"; fi
|
|
||||||
|
|
||||||
script:
|
|
||||||
- travis_retry docker build -t "$image" "${VERSION}/${VARIANT}"
|
|
||||||
- ~/official-images/test/run.sh "$image"
|
|
||||||
- .travis/test-example-dockerfiles.sh "$image"
|
|
||||||
|
|
||||||
after_script:
|
|
||||||
- docker images
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
include:
|
|
||||||
- &test-scripts
|
|
||||||
stage: test scripts
|
|
||||||
env: SCRIPT=update.sh
|
|
||||||
sudo: false
|
|
||||||
services: []
|
|
||||||
install: skip
|
|
||||||
before_script: skip
|
|
||||||
script:
|
|
||||||
- hash_before=$(git write-tree)
|
|
||||||
- ./update.sh
|
|
||||||
- bash -c "[[ $hash_before = $(git add -A && git write-tree) ]]"
|
|
||||||
after_script: skip
|
|
||||||
|
|
||||||
- <<: *test-scripts
|
|
||||||
env: SCRIPT=generate-stackbrew-library.sh
|
|
||||||
install:
|
|
||||||
- wget -O "$HOME/bin/bashbrew" https://doi-janky.infosiftr.net/job/bashbrew/job/master/lastSuccessfulBuild/artifact/bashbrew-amd64
|
|
||||||
- chmod +x "$HOME/bin/bashbrew"
|
|
||||||
script:
|
|
||||||
- ./generate-stackbrew-library.sh
|
|
||||||
|
|
||||||
- <<: *test-scripts
|
|
||||||
env: SCRIPT=test-entrypoint.sh
|
|
||||||
script:
|
|
||||||
- ./.travis/test-entrypoint.sh
|
|
||||||
|
|
||||||
- stage: test images (amd64)
|
|
||||||
env: VERSION=2020.09-dev VARIANT=fpm-alpine ARCH=amd64
|
|
||||||
- env: VERSION=2020.09-dev VARIANT=fpm ARCH=amd64
|
|
||||||
- env: VERSION=2020.09-dev VARIANT=apache ARCH=amd64
|
|
||||||
- env: VERSION=2020.07 VARIANT=fpm-alpine ARCH=amd64
|
|
||||||
- env: VERSION=2020.07 VARIANT=fpm ARCH=amd64
|
|
||||||
- env: VERSION=2020.07 VARIANT=apache ARCH=amd64
|
|
||||||
|
|
||||||
- stage: test images (full)
|
|
||||||
env: VERSION=2020.09-dev VARIANT=fpm-alpine ARCH=amd64
|
|
||||||
- env: VERSION=2020.09-dev VARIANT=fpm-alpine ARCH=i386
|
|
||||||
- env: VERSION=2020.09-dev VARIANT=fpm ARCH=amd64
|
|
||||||
- env: VERSION=2020.09-dev VARIANT=fpm ARCH=i386
|
|
||||||
- env: VERSION=2020.09-dev VARIANT=apache ARCH=amd64
|
|
||||||
- env: VERSION=2020.09-dev VARIANT=apache ARCH=i386
|
|
||||||
- env: VERSION=2020.07 VARIANT=fpm-alpine ARCH=amd64
|
|
||||||
- env: VERSION=2020.07 VARIANT=fpm-alpine ARCH=i386
|
|
||||||
- env: VERSION=2020.07 VARIANT=fpm ARCH=amd64
|
|
||||||
- env: VERSION=2020.07 VARIANT=fpm ARCH=i386
|
|
||||||
- env: VERSION=2020.07 VARIANT=apache ARCH=amd64
|
|
||||||
- env: VERSION=2020.07 VARIANT=apache ARCH=i386
|
|
|
@ -27,12 +27,12 @@ dockerfileCommit() {
|
||||||
(
|
(
|
||||||
cd "$dir";
|
cd "$dir";
|
||||||
fileCommit Dockerfile \
|
fileCommit Dockerfile \
|
||||||
"$(awk '
|
$(awk '
|
||||||
toupper($1) == "COPY" {
|
toupper($1) == "COPY" {
|
||||||
for (i = 2; i < NF; i++)
|
for (i = 2; i < NF; i++)
|
||||||
print $i;
|
print $i;
|
||||||
}
|
}
|
||||||
' Dockerfile)"
|
' Dockerfile)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ for version in "${versions[@]}"; do
|
||||||
cat << EOE
|
cat << EOE
|
||||||
|
|
||||||
Tags: $(join ', ' "${variantAliases[@]}")
|
Tags: $(join ', ' "${variantAliases[@]}")
|
||||||
Architectures: $(join ', ' "$variantArches")
|
Architectures: $(join ', ' $variantArches)
|
||||||
GitCommit: $commit
|
GitCommit: $commit
|
||||||
Directory: $version/$variant
|
Directory: $version/$variant
|
||||||
EOE
|
EOE
|
||||||
|
|
20
update.sh
20
update.sh
|
@ -97,9 +97,6 @@ versions=(
|
||||||
2020.09-dev
|
2020.09-dev
|
||||||
)
|
)
|
||||||
|
|
||||||
travisEnv=
|
|
||||||
travisEnvAmd64=
|
|
||||||
|
|
||||||
function create_variant() {
|
function create_variant() {
|
||||||
dockerName=${1,,}
|
dockerName=${1,,}
|
||||||
dir="$dockerName/$variant"
|
dir="$dockerName/$variant"
|
||||||
|
@ -146,11 +143,6 @@ function create_variant() {
|
||||||
cp upgrade.exclude "$dir/"
|
cp upgrade.exclude "$dir/"
|
||||||
|
|
||||||
cp -rT .config "$dir/config"
|
cp -rT .config "$dir/config"
|
||||||
|
|
||||||
travisEnvAmd64='\n - env: VERSION='"$dockerName"' VARIANT='"$variant"' ARCH=amd64'"$travisEnvAmd64"
|
|
||||||
for arch in i386 amd64; do
|
|
||||||
travisEnv='\n - env: VERSION='"$dockerName"' VARIANT='"$variant"' ARCH='"$arch$travisEnv"
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
find . -maxdepth 1 -type d -regextype sed -regex '\./[[:digit:]]\+\(\.\|\-\)[[:digit:]]\+\(-rc\|-dev\)\?' -exec rm -r '{}' \;
|
find . -maxdepth 1 -type d -regextype sed -regex '\./[[:digit:]]\+\(\.\|\-\)[[:digit:]]\+\(-rc\|-dev\)\?' -exec rm -r '{}' \;
|
||||||
|
@ -161,15 +153,3 @@ for version in "${versions[@]}"; do
|
||||||
create_variant "$version"
|
create_variant "$version"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
# replace the fist '-' with ' '
|
|
||||||
travisEnv="$(echo "$travisEnv" | sed '0,/-/{s/-/ /}')"
|
|
||||||
travisEnvAmd64="$(echo "$travisEnvAmd64" | sed '0,/-/{s/-/ /}')"
|
|
||||||
|
|
||||||
# update .travis.yml
|
|
||||||
travisAmd64="$(awk -v 'RS=\n\n' '$1 == "-" && $2 == "stage:" && $3 == "test" && $4 == "images" && $5 == "(amd64)" { $0 = " - stage: test images (amd64)'"$travisEnvAmd64"'" } { printf "%s%s", $0, RS }' .travis.yml)"
|
|
||||||
echo "$travisAmd64" > .travis.yml
|
|
||||||
|
|
||||||
travisFull="$(awk -v 'RS=\n\n' '$1 == "-" && $2 == "stage:" && $3 == "test" && $4 == "images" && $5 == "(full)" { $0 = " - stage: test images (full)'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)"
|
|
||||||
|
|
||||||
echo "$travisFull" > .travis.yml
|
|
||||||
|
|
Loading…
Reference in a new issue