Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ggtakec committed Mar 18, 2022
1 parent 4230fc7 commit 74057a4
Show file tree
Hide file tree
Showing 16 changed files with 1,563 additions and 2 deletions.
143 changes: 143 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
#
# s3fs-fuse-awscred-lib ( s3fs-fuse credential I/F library for AWS )
#
# Copyright 2022 Takeshi Nakatani <ggtakec@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: awscredlib CI

on:
push:
pull_request:
#
# CRON event is fire on every sunday(UTC).
#
schedule:
- cron: '0 0 * * 0'

#
# Jobs
#
jobs:
Linux:
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:
# [NOTE]
# The following OS is not built because the version of cmake is low:
# ubuntu:18.04
# debian:stretch
# centos:centos7
#
container:
- ubuntu:21.10
- ubuntu:20.04
- debian:bullseye
- debian:buster
- rockylinux:8
- fedora:35
- opensuse/leap:15

container:
image: ${{ matrix.container }}

env:
# [NOTE]
# Installation special environment variables for debian and ubuntu.
#
DEBIAN_FRONTEND: noninteractive

steps:
# [NOTE]
# On openSUSE, tar and gzip must be installed before action/checkout.
#
- name: Install packages before checkout
run: |
if [ "${{ matrix.container }}" = "opensuse/leap:15" ]; then zypper install -y tar gzip; fi
- name: Checkout source code
uses: actions/checkout@v2

- name: Install packages
run: |
.github/workflows/linux-ci-helper.sh ${{ matrix.container }}
- name: Build aws-sdk-cpp
run: |
mkdir -p /tmp/aws-sdk/sdk_build
cd /tmp/aws-sdk
git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp
cd sdk_build
cmake ../aws-sdk-cpp -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/home/ggtakec/work/aws-sdk-cpp -DBUILD_ONLY="core;identity-management" -DAUTORUN_UNIT_TESTS=OFF
make
make install
- name: Build
run: |
cmake -S . -B build
cmake --build build
- name: Test
run: |
mkdir "${HOME}"/.aws
echo "[default]" > "${HOME}"/.aws/config
printf "%s\n%s\n%s\n" "[default]" "aws_access_key_id = TESTAWSACCESSKEYID" "aws_secret_access_key = TESTSECRETAWSACCESSKEYID" > "${HOME}"/.aws/credentials
./build/s3fsawscred_test | grep -v '[E|e]xpiration' | sed -e "s/Version .*$/Version/g" > /tmp/s3fsawscred_test.result
diff .github/workflows/s3fsawscred_test.result /tmp/s3fsawscred_test.result
macos11:
runs-on: macos-11

steps:
- name: Checkout source code
uses: actions/checkout@v2

- name: Install packages
run: |
brew install aws-sdk-cpp
- name: Build
run: |
cmake -S . -B build
cmake --build build
- name: Test
run: |
mkdir "${HOME}"/.aws
echo "[default]" > "${HOME}"/.aws/config
printf "%s\n%s\n%s\n" "[default]" "aws_access_key_id = TESTAWSACCESSKEYID" "aws_secret_access_key = TESTSECRETAWSACCESSKEYID" > "${HOME}"/.aws/credentials
./build/s3fsawscred_test | grep -v '[E|e]xpiration' | sed -e "s/Version .*$/Version/g" > /tmp/s3fsawscred_test.result
diff .github/workflows/s3fsawscred_test.result /tmp/s3fsawscred_test.result
#
# 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
#
149 changes: 149 additions & 0 deletions .github/workflows/linux-ci-helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
#!/bin/sh
#
# s3fs-fuse-awscred-lib ( s3fs-fuse credential I/F library for AWS )
#
# Copyright 2022 Takeshi Nakatani <ggtakec@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#-----------------------------------------------------------
# Common variables
#-----------------------------------------------------------
PRGNAME=$(basename "$0")

echo "${PRGNAME} [INFO] Start Linux helper for installing packages."

#-----------------------------------------------------------
# Parameter check
#-----------------------------------------------------------
#
# Usage: ${PRGNAME} "OS:VERSION"
#
if [ $# -ne 1 ]; then
echo "${PRGNAME} [ERROR] No container name options specified."
fi
CONTAINER_FULLNAME="$1"

#-----------------------------------------------------------
# OS dependent variables
#-----------------------------------------------------------
if [ "${CONTAINER_FULLNAME}" = "ubuntu:21.10" ]; then
PACKAGE_MANAGER_BIN="apt-get"
PACKAGE_UPDATE_OPTIONS="update -y -qq"

INSTALL_PACKAGES="git g++ cmake libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev"
INSTALL_REPO_OPTIONS=""

elif [ "${CONTAINER_FULLNAME}" = "ubuntu:20.04" ]; then
PACKAGE_MANAGER_BIN="apt-get"
PACKAGE_UPDATE_OPTIONS="update -y -qq"

INSTALL_PACKAGES="git g++ cmake libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev"
INSTALL_REPO_OPTIONS=""

elif [ "${CONTAINER_FULLNAME}" = "ubuntu:18.04" ]; then
PACKAGE_MANAGER_BIN="apt-get"
PACKAGE_UPDATE_OPTIONS="update -y -qq"

INSTALL_PACKAGES="git g++ cmake libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev"
INSTALL_REPO_OPTIONS=""

elif [ "${CONTAINER_FULLNAME}" = "debian:bullseye" ]; then
PACKAGE_MANAGER_BIN="apt-get"
PACKAGE_UPDATE_OPTIONS="update -y -qq"

INSTALL_PACKAGES="git g++ cmake libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev"
INSTALL_REPO_OPTIONS=""

elif [ "${CONTAINER_FULLNAME}" = "debian:buster" ]; then
PACKAGE_MANAGER_BIN="apt-get"
PACKAGE_UPDATE_OPTIONS="update -y -qq"

INSTALL_PACKAGES="git g++ cmake libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev"
INSTALL_REPO_OPTIONS=""

elif [ "${CONTAINER_FULLNAME}" = "debian:stretch" ]; then
PACKAGE_MANAGER_BIN="apt-get"
PACKAGE_UPDATE_OPTIONS="update -y -qq"

INSTALL_PACKAGES="git g++ cmake libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev"
INSTALL_REPO_OPTIONS=""

elif [ "${CONTAINER_FULLNAME}" = "rockylinux:8" ]; then
PACKAGE_MANAGER_BIN="dnf"
PACKAGE_UPDATE_OPTIONS="update -y -qq"

INSTALL_PACKAGES="git gcc-c++ cmake libcurl-devel openssl-devel uuid-devel zlib-devel pulseaudio-libs-devel"
INSTALL_REPO_OPTIONS="--enablerepo=powertools"

elif [ "${CONTAINER_FULLNAME}" = "centos:centos7" ]; then
PACKAGE_MANAGER_BIN="yum"
PACKAGE_UPDATE_OPTIONS="update -y"

INSTALL_PACKAGES="git gcc-c++ cmake libcurl-devel openssl-devel uuid-devel zlib-devel pulseaudio-libs-devel"
INSTALL_REPO_OPTIONS=""

elif [ "${CONTAINER_FULLNAME}" = "fedora:35" ]; then
PACKAGE_MANAGER_BIN="dnf"
PACKAGE_UPDATE_OPTIONS="update -y -qq"

INSTALL_PACKAGES="git gcc-c++ cmake libcurl-devel openssl-devel uuid-devel zlib-devel pulseaudio-libs-devel"
INSTALL_REPO_OPTIONS=""

elif [ "${CONTAINER_FULLNAME}" = "opensuse/leap:15" ]; then
PACKAGE_MANAGER_BIN="zypper"
PACKAGE_UPDATE_OPTIONS="refresh"

INSTALL_PACKAGES="git gcc-c++ cmake libcurl-devel openssl-devel uuid-devel zlib-devel libpulse-devel"
INSTALL_REPO_OPTIONS=""

else
echo "No container configured for: ${CONTAINER_FULLNAME}"
exit 1
fi

#-----------------------------------------------------------
# Install
#-----------------------------------------------------------
#
# Update packages (ex. apt-get update -y -qq)
#
echo "${PRGNAME} [INFO] Updates."
if ! /bin/sh -c "${PACKAGE_MANAGER_BIN} ${PACKAGE_UPDATE_OPTIONS}"; then
exit 1
fi

#
# Install packages
#
echo "${PRGNAME} [INFO] Install packages."
if ! /bin/sh -c "${PACKAGE_MANAGER_BIN} ${INSTALL_REPO_OPTIONS} install -y ${INSTALL_PACKAGES}"; then
exit 1
fi

#-----------------------------------------------------------
# Finish
#-----------------------------------------------------------
echo "${PRGNAME} [INFO] Finish Linux helper for installing packages."

exit 0

#
# Local variables:
# tab-width: 4
# c-basic-offset: 4
# End:
# vim600: noexpandtab sw=4 ts=4 fdm=marker
# vim<600: noexpandtab sw=4 ts=4
#
27 changes: 27 additions & 0 deletions .github/workflows/s3fsawscred_test.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[awscred_test] Start test for s3fsawscred.so

[Function] InitS3fsCredential
[Succeed]

[Function] VersionS3fsCredential - short
[Succeed] s3fs-fuse-awscred-lib : Version

[Function] VersionS3fsCredential - detail
[Succeed]
s3fs-fuse-awscred-lib : Version
s3fs-fuse credential I/F library for AWS
Copyright 2022 Takeshi Nakatani <ggtakec@gmail.com>

[Function] UpdateS3fsCredential
[s3fsawscred] : Access Key Id = TESTAWSACCESSKEYID
[s3fsawscred] : Secret Key = TESTSECRETAWSACCESSKEYID
[s3fsawscred] : Session Token =
[Succeed] Credential = {
AWS Access Key Id = TESTAWSACCESSKEYID
AWS Secret Key = TESTSECRETAWSACCESSKEYID
AWS Session Token =
}

[Function] FreeS3fsCredential
[Succeed]

Loading

0 comments on commit 74057a4

Please sign in to comment.