1
0
mirror of https://github.com/adtools/clib2.git synced 2025-11-22 19:52:24 +00:00

moved from travis-ci to github actions and retired codeclimate.

This commit is contained in:
Jens Maus
2021-05-14 00:31:17 +02:00
parent 975f949aa1
commit e1da3dadfb
5 changed files with 110 additions and 53 deletions

View File

@ -1,14 +0,0 @@
---
engines:
duplication:
enabled: false
fixme:
enabled: true
markdownlint:
enabled: true
ratings:
paths:
- "**.c"
- "**.h"
- "**.l"
- "**.md"

54
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,54 @@
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]
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 }}]
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.platform }} =~ os4 ]]; then make -C library -j1 -f GNUmakefile.os4 OS=os4 ; fi
if [[ ${{ matrix.platform }} =~ os3 ]]; then make -C library -j1 -f GNUmakefile.68k OS=os3 ; fi

55
.github/workflows/purge_artifacts.sh vendored Executable file
View File

@ -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/.*<//' -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

View File

@ -1,36 +0,0 @@
sudo: required
dist: trusty
language: c
# 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|release ]]; then curl -L https://dl.bintray.com/jens-maus/adtools/adtools-m68k-amigaos.tar.bz2 | sudo tar xj -C / ; fi
- if [[ ${BUILD} =~ os4|release ]]; then curl -L https://dl.bintray.com/jens-maus/adtools/adtools-ppc-amigaos.tar.bz2 | sudo tar xj -C / ; fi
- if [[ ${BUILD} =~ mos|release ]]; then curl -L https://dl.bintray.com/jens-maus/adtools/adtools-ppc-morphos.tar.bz2 | sudo tar xj -C / ; fi
- if [[ ${BUILD} =~ aros-ppc|release ]]; then curl -L https://dl.bintray.com/jens-maus/adtools/adtools-ppc-aros.tar.bz2 | sudo tar xj -C / ; fi
- if [[ ${BUILD} =~ aros-i386|release ]]; 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|release ]]; then curl -L https://dl.bintray.com/jens-maus/adtools/adtools-x86_64-aros.tar.bz2 | sudo tar xj -C / ; fi
- if [[ ${BUILD} =~ mingw32|release ]]; then sudo apt-get -qq install binutils-mingw-w64-i686 gcc-mingw-w64-i686 ; 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="-f GNUmakefile.68k OS=os3"
- BUILD="-f GNUmakefile.os4 OS=os4"
# the build command to execute for each test
script:
- make -C library -j1 ${BUILD}

View File

@ -1,9 +1,7 @@
# clib2 An ISO 'C' (1994) compliant runtime library for AmigaOS
[![Build Status](https://travis-ci.org/adtools/clib2.svg?branch=master)](https://travis-ci.org/adtools/clib2)
[![Code Climate](https://codeclimate.com/github/adtools/clib2/badges/gpa.svg)](https://codeclimate.com/github/adtools/clib2)
[![Build](https://github.com/amiga-mui/adtools/clib2/workflows/CI/badge.svg)](https://github.com/adtools/clib2/actions)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![Github Issues](http://githubbadges.herokuapp.com/adtools/clib2/issues.svg)](https://github.com/adtools/clib2/issues)
## What is this?