From 57142d17d332db35f538f60c6f646ec5d8eb8786 Mon Sep 17 00:00:00 2001 From: Jens Maus Date: Fri, 14 May 2021 00:53:11 +0200 Subject: [PATCH] moved from travis-ci to github actions and retired codeclimate service. --- .codeclimate.yml | 16 -------- .github/workflows/ci.yml | 55 ++++++++++++++++++++++++++++ .github/workflows/purge_artifacts.sh | 55 ++++++++++++++++++++++++++++ .travis.yml | 54 --------------------------- README.md | 3 +- 5 files changed, 112 insertions(+), 71 deletions(-) delete mode 100644 .codeclimate.yml create mode 100644 .github/workflows/ci.yml create mode 100755 .github/workflows/purge_artifacts.sh delete mode 100644 .travis.yml diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100644 index 30fd0f7..0000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -engines: - duplication: - enabled: false - fixme: - enabled: true - markdownlint: - enabled: true - phpmd: - enabled: false -ratings: - paths: - - "**.c" - - "**.h" - - "**.l" - - "**.md" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0126b61 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: CI +on: + push: + pull_request: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-20.04 + timeout-minutes: 480 + + strategy: + fail-fast: false + matrix: + platform: [os4, os3, mos, aros-ppc, aros-i386, aros-x86_64] + build: [release, debug] + + steps: + - uses: actions/checkout@v2 + + - name: setup dependencies + run: | + sudo dpkg --add-architecture i386 + sudo apt-get update -y -qq || true + sudo apt-get -qq install libc6:i386 + sudo ln -s /usr/lib/x86_64-linux-gnu/libmpfr.so.6 /usr/lib/x86_64-linux-gnu/libmpfr.so.4 + + - name: setup env + run : | + echo "GITHUB_SHA7=$(echo ${GITHUB_SHA::7})" >>$GITHUB_ENV + + - name: install adtools build env + run: | + DOWNLOAD_PATH=https://github.com/adtools/adtools/releases/download/20170213 + curl -L ${DOWNLOAD_PATH}/adtools-utils.tar.bz2 | sudo tar xj -C / + if [[ ${{ matrix.platform }} =~ os3 ]]; then curl -L ${DOWNLOAD_PATH}/adtools-m68k-amigaos.tar.bz2 | sudo tar xj -C / ; fi + if [[ ${{ matrix.platform }} =~ os4 ]]; then curl -L ${DOWNLOAD_PATH}/adtools-ppc-amigaos.tar.bz2 | sudo tar xj -C / ; fi + if [[ ${{ matrix.platform }} =~ mos ]]; then curl -L ${DOWNLOAD_PATH}/adtools-ppc-morphos.tar.bz2 | sudo tar xj -C / ; fi + if [[ ${{ matrix.platform }} =~ aros-ppc ]]; then curl -L ${DOWNLOAD_PATH}/adtools-ppc-aros.tar.bz2 | sudo tar xj -C / ; fi + if [[ ${{ matrix.platform }} =~ aros-i386 ]]; then curl -L ${DOWNLOAD_PATH}/adtools-i386-aros.tar.bz2 | sudo tar xj -C / ; fi + if [[ ${{ matrix.platform }} =~ aros-x86_64 ]]; then curl -L ${DOWNLOAD_PATH}/adtools-x86_64-aros.tar.bz2 | sudo tar xj -C / ; fi + + - name: cleanup old action artifacts + run: .github/workflows/purge_artifacts.sh ${{ secrets.GITHUB_TOKEN }} + + #- name: remote debug tmate session + # uses: mxschmitt/action-tmate@v1 + # if: matrix.platform == 'os4' + + - name: build [${{ matrix.platform }}, ${{ matrix.build }}] + timeout-minutes: 480 + run: | + export PATH=/usr/local/amiga/bin:/opt/m68k-amigaos/bin:/opt/ppc-amigaos/bin:/opt/ppc-morphos/bin:${PATH} + if [[ ${{ matrix.build }} =~ release ]]; then make -j1 OS=${{ matrix.platform }} DEBUG= ; fi + if [[ ${{ matrix.build }} =~ debug ]]; then make -j1 OS=${{ matrix.platform }} ; fi diff --git a/.github/workflows/purge_artifacts.sh b/.github/workflows/purge_artifacts.sh new file mode 100755 index 0000000..529d406 --- /dev/null +++ b/.github/workflows/purge_artifacts.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +# Customize those three lines with your repository and credentials: +REPO=https://api.github.com/repos/${GITHUB_REPOSITORY} +GITHUB_USER=${GITHUB_REPOSITORY%%/*} +GITHUB_TOKEN=${1} + +# Number of most recent versions to keep for each artifact: +KEEP=4 + +# A shortcut to call GitHub API. +ghapi() { curl --silent --location --user $GITHUB_USER:$GITHUB_TOKEN "$@"; } + +# A temporary file which receives HTTP response headers. +TMPFILE=/tmp/tmp.$$ + +# An associative array, key: artifact name, value: number of artifacts of that name. +declare -A ARTCOUNT + +# Process all artifacts on this repository, loop on returned "pages". +URL=$REPO/actions/artifacts +while [[ -n "$URL" ]]; do + + # Get current page, get response headers in a temporary file. + JSON=$(ghapi --dump-header $TMPFILE "$URL") + + # Get URL of next page. Will be empty if we are at the last page. + URL=$(grep '^Link:' "$TMPFILE" | tr ',' '\n' | grep 'rel="next"' | head -1 | sed -e 's/.*.*//') + rm -f ${TMPFILE} + + # Number of artifacts on this page: + COUNT=$(( $(jq <<<$JSON -r '.artifacts | length') )) + + # Loop on all artifacts on this page. + for ((i=0; $i < $COUNT; i++)); do + + # Get name of artifact and count instances of this name. + STR=$(jq <<<$JSON -r ".artifacts[$i].name?") + name=${STR%%-*}-${STR##*-} + ARTCOUNT[$name]=$(( $(( ${ARTCOUNT[$name]} )) + 1)) + + printf "Found '%s' #%d, " $STR ${ARTCOUNT[$name]} + # Check if we must delete this one. + if [[ ${ARTCOUNT[$name]} -gt $KEEP ]]; then + id=$(jq <<<$JSON -r ".artifacts[$i].id?") + size=$(( $(jq <<<$JSON -r ".artifacts[$i].size_in_bytes?") )) + printf "deleting %d bytes\n" $size + ghapi -X DELETE $REPO/actions/artifacts/$id + else + printf "OK\n" + fi + done +done + +exit 0 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 54b02d4..0000000 --- a/.travis.yml +++ /dev/null @@ -1,54 +0,0 @@ -sudo: required -dist: trusty - -language: c - -# send build/failure notifications only to a specific -# email address and only on a status change -notifications: - email: - recipients: - - svn@yam.ch - on_success: change - on_failure: change - -# download and install our required cross compilers -install: - # Make sure we can install i386 packages as some adtools binaries - # requires i386 libraries being installed to work in the 64bit env - # of Travis - - sudo dpkg --add-architecture i386 - - sudo apt-get -qq update || true - - sudo apt-get -qq install libc6:i386 - # Install all adtools related stuff we need - - curl -L https://dl.bintray.com/jens-maus/adtools/adtools-utils.tar.bz2 | sudo tar xj -C / - - if [[ ${BUILD} =~ os3 ]]; then curl -L https://dl.bintray.com/jens-maus/adtools/adtools-m68k-amigaos.tar.bz2 | sudo tar xj -C / ; fi - - if [[ ${BUILD} =~ os4 ]]; then curl -L https://dl.bintray.com/jens-maus/adtools/adtools-ppc-amigaos.tar.bz2 | sudo tar xj -C / ; fi - - if [[ ${BUILD} =~ mos ]]; then curl -L https://dl.bintray.com/jens-maus/adtools/adtools-ppc-morphos.tar.bz2 | sudo tar xj -C / ; fi - - if [[ ${BUILD} =~ aros-ppc ]]; then curl -L https://dl.bintray.com/jens-maus/adtools/adtools-ppc-aros.tar.bz2 | sudo tar xj -C / ; fi - - if [[ ${BUILD} =~ aros-i386 ]]; then curl -L https://dl.bintray.com/jens-maus/adtools/adtools-i386-aros.tar.bz2 | sudo tar xj -C / ; fi - - if [[ ${BUILD} =~ aros-x86_64 ]]; then curl -L https://dl.bintray.com/jens-maus/adtools/adtools-x86_64-aros.tar.bz2 | sudo tar xj -C / ; fi - -# set the PATH variable to the directories the cross compilers are installed. -before_script: - - export PATH=/usr/local/amiga/bin:/opt/m68k-amigaos/bin:/opt/ppc-amigaos/bin:/opt/ppc-morphos/bin:${PATH} - -# specify a list of variables to test (here we test the build for our supported -# list of operating systems). -env: - - BUILD="OS=os4" - - BUILD="OS=os4 DEBUG=" - - BUILD="OS=os3" - - BUILD="OS=os3 DEBUG=" - - BUILD="OS=mos" - - BUILD="OS=mos DEBUG=" - - BUILD="OS=aros-ppc" - - BUILD="OS=aros-ppc DEBUG=" - - BUILD="OS=aros-i386" - - BUILD="OS=aros-i386 DEBUG=" - - BUILD="OS=aros-x86_64" - - BUILD="OS=aros-x86_64 DEBUG=" - -# the build command to execute for each test -script: - - make ${BUILD} -j1 diff --git a/README.md b/README.md index dd792a4..d0ab6db 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # codesets.library [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RAQSDY9YNZVCL) -[![Build Status](https://travis-ci.org/jens-maus/libcodesets.svg?branch=master)](https://travis-ci.org/jens-maus/libcodesets) [![Code Climate](https://codeclimate.com/github/jens-maus/libcodesets/badges/gpa.svg)](https://codeclimate.com/github/jens-maus/libcodesets) [![License](http://img.shields.io/:license-lgpl2-blue.svg?style=flat)](http://www.gnu.org/licenses/lgpl-2.1.html) [![Github Issues](http://githubbadges.herokuapp.com/jens-maus/libcodesets/issues.svg)](https://github.com/jens-maus/libcodesets/issues) +[![Build](https://github.com/jens-maus/libcodesets/workflows/CI/badge.svg)](https://github.com/jens-maus/libcodesets/actions) +[![License](http://img.shields.io/:license-lgpl2-blue.svg?style=flat)](http://www.gnu.org/licenses/lgpl-2.1.html) Classic Amiga systems, but even modern AmigaOS versions like AmigaOS4 and MorphOS don't come with a centralized programming interface for dealing