Skip to content

Merge pull request #107 from ggtakec/release1096 #304

Merge pull request #107 from ggtakec/release1096

Merge pull request #107 from ggtakec/release1096 #304

Workflow file for this run

#
# K2HASH
#
# Utility tools for building configure/packages by AntPickax
#
# Copyright 2020 Yahoo Japan Corporation.
#
# AntPickax provides utility tools for supporting autotools
# builds.
#
# These tools retrieve the necessary information from the
# repository and appropriately set the setting values of
# configure, Makefile, spec,etc file and so on.
# These tools were recreated to reduce the number of fixes and
# reduce the workload of developers when there is a change in
# the project configuration.
#
# For the full copyright and license information, please view
# the license file that was distributed with this source code.
#
# AUTHOR: Takeshi Nakatani
# CREATE: Fri, Nov 13 2020
# REVISION: 1.0
#
#------------------------------------------------------------------------------------
# Github Actions
#------------------------------------------------------------------------------------
name: C/C++ AntPickax CI
#
# Events
#
on:
push:
pull_request:
#
# CRON event is fire on every sunday(UTC).
#
schedule:
- cron: '0 15 * * 0'
#
# Jobs
#
jobs:
build:
runs-on: ubuntu-latest
#
# build matrix for containers
#
strategy:
#
# do not stop jobs automatically if any of the jobs fail
#
fail-fast: false
#
# matrix for containers
#
matrix:
container:
- ubuntu:24.04
- ubuntu:22.04
- ubuntu:20.04
- debian:bookworm
- debian:bullseye
- rockylinux:9
- rockylinux:8
- fedora:41
- fedora:40
- alpine:3.20
- alpine:3.19
- alpine:3.18
container:
image: ${{ matrix.container }}
steps:
- name: Checkout source code
uses: actions/checkout@v4
#
# Set environments from secrets
#
# [NOTE] Secrets
# Use Secrets of organization or repository as parameters to
# pass to build_helper.sh for building and packaging, .
#
# The available Secret variables are listed below:
# OSTYPE_VARS_FILE : specify custom variables file
# BUILD_NUMBER : buld number for packaging
# DEVELOPER_FULLNAME : developer name for package
# DEVELOPER_EMAIL : developer e-mail for package
# FORCE_PUBLISH : true means force to publish packages, false means never publish
# USE_PACKAGECLOUD_REPO : true means using pacakgecloud.io repo, false is not using
# * PACKAGECLOUD_TOKEN : The token for publishing to packagcloud.io
# PACKAGECLOUD_OWNER : owner name as a part of path to packagcloud.io for publishing/downloading
# PACKAGECLOUD_PUBLISH_REPO : repo name as a part of path to packagcloud.io for publishing
# PACKAGECLOUD_DOWNLOAD_REPO : repo name as a part of path to packagcloud.io for downloading
#
# "PACKAGECLOUD_TOKEN" is a required variable to publish the
# package.
#
- name: Set environments from secrets
run: |
echo "ENV_OSTYPE_VARS_FILE=${{ secrets.OSTYPE_VARS_FILE }}" >> "${GITHUB_ENV}"
echo "ENV_BUILD_NUMBER=${{ secrets.BUILD_NUMBER }}" >> "${GITHUB_ENV}"
echo "ENV_DEVELOPER_FULLNAME=${{ secrets.DEVELOPER_FULLNAME }}" >> "${GITHUB_ENV}"
echo "ENV_DEVELOPER_EMAIL=${{ secrets.DEVELOPER_EMAIL }}" >> "${GITHUB_ENV}"
echo "ENV_FORCE_PUBLISH=${{ secrets.FORCE_PUBLISH }}" >> "${GITHUB_ENV}"
echo "ENV_USE_PACKAGECLOUD_REPO=${{ secrets.USE_PACKAGECLOUD_REPO }}" >> "${GITHUB_ENV}"
echo "ENV_PACKAGECLOUD_TOKEN=${{ secrets.PACKAGECLOUD_TOKEN }}" >> "${GITHUB_ENV}"
echo "ENV_PACKAGECLOUD_OWNER=${{ secrets.PACKAGECLOUD_OWNER }}" >> "${GITHUB_ENV}"
echo "ENV_PACKAGECLOUD_PUBLISH_REPO=${{ secrets.PACKAGECLOUD_PUBLISH_REPO }}" >> "${GITHUB_ENV}"
echo "ENV_PACKAGECLOUD_DOWNLOAD_REPO=${{ secrets.PACKAGECLOUD_DOWNLOAD_REPO }}" >> "${GITHUB_ENV}"
#
# Run building and packaging helper
#
- name: Run building and packaging
run: |
/bin/sh -c "$GITHUB_WORKSPACE/.github/workflows/build_helper.sh -os ${{ matrix.container }}"
dockerimage:
runs-on: ubuntu-latest
needs: build
#
# build matrix for containers
#
strategy:
#
# do not stop jobs automatically if any of the jobs fail
#
fail-fast: false
#
# matrix for containers
#
matrix:
#
# Specify the "baseimage" in the following format:
# <base image tag>,<base dev image tag>,<OS tag name>(,<default tag flag>)
#
# <base image tag>: specify the Docker image name(ex. "alpine:latest")
# <base dev image tag>: specify the Docker image name(ex. "alpine:latest")
# <OS tag name>: OS tag attached to the created Docker image
# <default tag flag>: If you want to use the created Docker image as the default image, specify "default".
#
imageinfo:
- alpine:3.20,alpine:3.20,alpine,default
- ubuntu:24.04,ubuntu:24.04,ubuntu
#
# Run building and pushing helper
#
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
#
# Login to avoid the Docker Hub rate limit
#
# Github Secret cannot be read in the case of Pull Request, so that process
# here will fail, so we need to skip it. Even if we skip this process, if we
# are using the official Runner of Github Actions, the IP address rate will
# not be limited and we will not get an error.
# However, this restriction release is based on the contract between Github
# and DockerHub, so if we skip this process, we may get an error.
#
- name: Login to DockerHub
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESSTOKEN }}
#
# Set environments from secrets
#
# [NOTE] Secrets
# When passing parameters to docker_helper.sh in build and pusing,
# use Secret of organization or repository.
#
# By setting the correct values for the following variable names,
# they will be passed as parameters in docker_helper.sh.
# * DOCKER_HUB_USERNAME : Docker Hub username to read/push the docker images
# * DOCKER_HUB_ACCESSTOKEN : Docker Hub user's Access Token
# DOCKER_HUB_ORG : Docker Hub organization to push(ex. "antpickax")
# IMAGETYPE_VARS_FILE : specify custom variables file
# FORCE_DOCKER_PUSH : specify force push(true) or not push(false)
# USE_PACKAGECLOUD_REPO : true means using pacakgecloud.io repo, false is not using
# PACKAGECLOUD_OWNER : owner name as a part of path to packagcloud.io for publishing/downloading
# PACKAGECLOUD_DOWNLOAD_REPO : repo name as a part of path to packagcloud.io for downloading
#
# [REQUIRED]
# DOCKER_HUB_USERNAME and DOCKER_HUB_ACCESSTOKEN is required to read and push docker images!
#
- name: Set docker image build environments from secrets
run: |
echo "ENV_DOCKER_IMAGE_INFO=${{ matrix.imageinfo }}" >> "${GITHUB_ENV}"
echo "ENV_IMAGE_NAMES=k2hash,k2hash-dev" >> "${GITHUB_ENV}"
echo "ENV_IMAGEVAR_FILE=${{ secrets.IMAGETYPE_VARS_FILE }}" >> "${GITHUB_ENV}"
echo "ENV_DOCKER_HUB_ORG=${{ secrets.DOCKER_HUB_ORG }}" >> "${GITHUB_ENV}"
echo "ENV_FORCE_PUSH=${{ secrets.FORCE_DOCKER_PUSH }}" >> "${GITHUB_ENV}"
echo "ENV_USE_PACKAGECLOUD_REPO=${{ secrets.USE_PACKAGECLOUD_REPO }}" >> "${GITHUB_ENV}"
echo "ENV_PACKAGECLOUD_OWNER=${{ secrets.PACKAGECLOUD_OWNER }}" >> "${GITHUB_ENV}"
echo "ENV_PACKAGECLOUD_DOWNLOAD_REPO=${{ secrets.PACKAGECLOUD_DOWNLOAD_REPO }}" >> "${GITHUB_ENV}"
#
# Run building and pushing
#
- name: Build and Push image to Docker Hub
run: |
${GITHUB_WORKSPACE}/.github/workflows/docker_helper.sh
#
# Local variables:
# tab-width: 4
# c-basic-offset: 4
# End:
# vim600: expandtab sw=4 ts=4 fdm=marker
# vim<600: expandtab sw=4 ts=4
#