From d467547656f301678995311e7e604792113b505c Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 18 Aug 2020 22:38:18 +0200 Subject: [PATCH] Use github action instead of Travis CI --- .github/workflows/images.yml | 48 ++++++++++++++++++++ .github/workflows/update-sh.yml | 22 ++++++++++ .travis.yml | 77 --------------------------------- update.sh | 20 --------- 4 files changed, 70 insertions(+), 97 deletions(-) create mode 100644 .github/workflows/images.yml create mode 100644 .github/workflows/update-sh.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml new file mode 100644 index 0000000..4813ecc --- /dev/null +++ b/.github/workflows/images.yml @@ -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 }} diff --git a/.github/workflows/update-sh.yml b/.github/workflows/update-sh.yml new file mode 100644 index 0000000..3f5fb09 --- /dev/null +++ b/.github/workflows/update-sh.yml @@ -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)" ]] diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b14a8ba..0000000 --- a/.travis.yml +++ /dev/null @@ -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 diff --git a/update.sh b/update.sh index d4ce838..eb3ba42 100755 --- a/update.sh +++ b/update.sh @@ -97,9 +97,6 @@ versions=( 2020.09-dev ) -travisEnv= -travisEnvAmd64= - function create_variant() { dockerName=${1,,} dir="$dockerName/$variant" @@ -146,11 +143,6 @@ function create_variant() { cp upgrade.exclude "$dir/" 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 '{}' \; @@ -161,15 +153,3 @@ for version in "${versions[@]}"; do create_variant "$version" 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