-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84c0991
commit 9587b16
Showing
5 changed files
with
275 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/bin/bash | ||
|
||
vercomp () { | ||
if [[ $1 == $2 ]]; then | ||
export vercomp_last_result=0 | ||
return $vercomp_last_result | ||
fi | ||
local IFS=. | ||
local i ver1=($1) ver2=($2) | ||
# fill empty fields in ver1 with zeros | ||
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)) | ||
do | ||
ver1[i]=0 | ||
done | ||
for ((i=0; i<${#ver1[@]}; i++)) | ||
do | ||
if [[ -z ${ver2[i]} ]]; then | ||
# fill empty fields in ver2 with zeros | ||
ver2[i]=0 | ||
fi | ||
if ((10#${ver1[i]} > 10#${ver2[i]})); then | ||
export vercomp_last_result=1 | ||
return $vercomp_last_result | ||
fi | ||
if ((10#${ver1[i]} < 10#${ver2[i]})); then | ||
export vercomp_last_result=2 | ||
return $vercomp_last_result | ||
fi | ||
done | ||
export vercomp_last_result=0 | ||
return $vercomp_last_result | ||
} | ||
|
||
install_fibjs() { | ||
local version=$1 | ||
if [[ -z "$version" ]]; then | ||
echo "[install_fibjs] version is required" | ||
exit 1 | ||
fi | ||
local os=$2 | ||
if [[ -z "$os" ]]; then | ||
echo "[install_fibjs] os is required" | ||
exit 1 | ||
fi | ||
local arch=$3 | ||
if [[ -z "$arch" ]]; then | ||
echo "[install_fibjs] arch is required" | ||
exit 1 | ||
fi | ||
|
||
local url_base="https://github.com/fibjs/fibjs/releases/download/v${version}/fibjs-v${version}-${os}-${arch}" | ||
|
||
# in fact, there's also non-archived linux fibjs | ||
if [[ "$RUNNER_OS" == "Linux" ]]; then | ||
if [ "$lower_than_0_37_0" == "true" ]; then | ||
local remote_url="${url_base}.xz" | ||
curl -SL "$remote_url" -o ./node_modules/.bin/fibjs.xz; | ||
xz -d ./node_modules/.bin/fibjs.xz; | ||
else | ||
local remote_url="${url_base}.tar.gz" | ||
curl -SL "$remote_url" -o ./node_modules/.bin/fibjs.tar.gz; | ||
tar -xzf ./node_modules/.bin/fibjs.tar.gz -C ./node_modules/.bin; | ||
fi | ||
chmod a+x ./node_modules/.bin/fibjs; | ||
elif [[ "$RUNNER_OS" == "macOS" ]]; then | ||
local remote_url="${url_base}" | ||
curl -SL "$remote_url" -o ./node_modules/.bin/fibjs; | ||
chmod a+x ./node_modules/.bin/fibjs; | ||
else | ||
local remote_url="${url_base}.exe" | ||
curl -SL "$remote_url" -o ./node_modules/.bin/fibjs.exe; | ||
fi | ||
echo "[install_fibjs] Downloading fibjs from ${remote_url}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
name: run ci for fibjs | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'ci/**' | ||
- 'ci-**' | ||
- 'releases/**' | ||
- 'feat/**' | ||
- 'bugfix/**' | ||
- 'dev' | ||
- 'master' | ||
- 'test_ci' | ||
tags: | ||
- v*.*.* | ||
- test_github_actions_* | ||
pull_request: | ||
branches: | ||
- 'dev' | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
continue-on-error: true | ||
strategy: | ||
matrix: | ||
include: | ||
- os: windows-2019 | ||
arch: x64 | ||
fibjs: 0.36.0 | ||
- os: windows-2019 | ||
arch: x64 | ||
fibjs: 0.37.0 | ||
- os: windows-2019 | ||
arch: x86 | ||
fibjs: 0.36.0 | ||
- os: windows-2019 | ||
arch: x86 | ||
fibjs: 0.37.0 | ||
- os: ubuntu-20.04 | ||
arch: x64 | ||
fibjs: 0.36.0 | ||
- os: ubuntu-20.04 | ||
arch: x64 | ||
fibjs: 0.37.0 | ||
- os: ubuntu-20.04 | ||
arch: x86 | ||
fibjs: 0.36.0 | ||
- os: ubuntu-20.04 | ||
arch: x86 | ||
fibjs: 0.37.0 | ||
- os: macos-11 | ||
arch: x64 | ||
fibjs: 0.36.0 | ||
- os: macos-11 | ||
arch: x64 | ||
fibjs: 0.37.0 | ||
- os: macos-14 | ||
arch: x64 | ||
fibjs: 0.36.0 | ||
- os: macos-14 | ||
arch: x64 | ||
fibjs: 0.37.0 | ||
- os: macos-14 | ||
arch: arm64 | ||
fibjs: 0.37.0 | ||
|
||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
|
||
- name: Set Env Variables | ||
id: set-env-vars | ||
shell: bash | ||
run: | | ||
bash .github/workflows/set-env-vars.sh | ||
env: | ||
ARCH: ${{ matrix.arch }} | ||
OS: ${{ matrix.os }} | ||
FIBJS_VERSION: ${{ matrix.fibjs }} | ||
|
||
- name: Install FIBJS | ||
shell: bash | ||
run: | | ||
mkdir -p ./node_modules/.bin; | ||
rm -rf ./node_modules/.bin/fibjs; | ||
. ./.github/workflows/fns.sh --source-only | ||
install_fibjs $FIBJS_VERSION $FIBJS_OS $FIBJS_ARCH; | ||
env: | ||
FIBJS_OS: ${{ steps.set-env-vars.outputs.FIBJS_OS }} | ||
FIBJS_ARCH: ${{ steps.set-env-vars.outputs.FIBJS_ARCH }} | ||
lower_than_0_37_0: ${{ steps.set-env-vars.outputs.lower_than_0_37_0 }} | ||
FIBJS_VERSION: ${{ matrix.fibjs }} | ||
|
||
- name: Run CI | ||
shell: bash | ||
run: | | ||
if [[ -f ".github/workflows/run-ci.sh" ]]; then | ||
bash .github/workflows/run-ci.sh; | ||
else | ||
npm install; | ||
npm run ci; | ||
fi | ||
env: | ||
FIBJS_OS: ${{ steps.set-env-vars.outputs.FIBJS_OS }} | ||
GIT_BRANCH: ${{ steps.set-env-vars.outputs.GIT_BRANCH }} | ||
RELEASE_TAG: ${{ steps.set-env-vars.outputs.RELEASE_TAG }} | ||
GIT_TAG: ${{ steps.set-env-vars.outputs.GIT_TAG }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
. ./.github/workflows/fns.sh --source-only | ||
|
||
export GIT_BRANCH=${GITHUB_REF#refs/heads/} | ||
echo "::set-output name=GIT_BRANCH::$GIT_BRANCH" | ||
export GIT_TAG=$(git tag | grep $(git describe --tags HEAD)) | ||
echo "::set-output name=GIT_TAG::$GIT_TAG" | ||
export GIT_COMMIT_HEAD_MSG=$(git log --format=%b -1) | ||
echo "::set-output name=GIT_COMMIT_HEAD_MSG::$GIT_COMMIT_HEAD_MSG" | ||
export GIT_COMMIT_SHORTCUTS=$(git log --format=%h -1) | ||
echo "::set-output name=GIT_COMMIT_SHORTCUTS::$GIT_COMMIT_SHORTCUTS" | ||
export GIT_COMMIT_TIME=$(git show -s --format="%cd" --date=format:%Y%m%d%H%M%S HEAD) | ||
echo "::set-output name=GIT_COMMIT_TIME::$GIT_COMMIT_TIME" | ||
|
||
if [[ "$GIT_TAG" =~ ^v?[012]\.[0-9]+\.[0-9]+$ ]]; then | ||
export IS_GIT_TAG_MATCH_SEMVER="true" | ||
echo "::set-output name=IS_GIT_TAG_MATCH_SEMVER::$IS_GIT_TAG_MATCH_SEMVER" | ||
fi | ||
|
||
if [ -z "$GIT_TAG" ]; then | ||
export RELEASE_TAG="$GIT_COMMIT_TIME-$GIT_COMMIT_SHORTCUTS"; | ||
else | ||
export RELEASE_TAG="$GIT_TAG"; | ||
fi | ||
if [ -z "$IS_GIT_TAG_MATCH_SEMVER" ]; then | ||
SUFFIX=${GIT_BRANCH//\//'-'} | ||
RELEASE_TAG="$RELEASE_TAG-$SUFFIX" | ||
fi | ||
echo "::set-output name=RELEASE_TAG::$RELEASE_TAG"; | ||
|
||
vercomp "${FIBJS_VERSION}" "0.37.0" | ||
if [[ "$vercomp_last_result" -eq "2" ]]; then | ||
export lower_than_0_37_0="true" | ||
else | ||
export lower_than_0_37_0="false" | ||
fi | ||
|
||
echo "::set-output name=lower_than_0_37_0::$lower_than_0_37_0"; | ||
|
||
case "${RUNNER_OS}" in | ||
Windows) | ||
# lower than 0.37.0 | ||
if [[ "$lower_than_0_37_0" == "true" ]]; then | ||
export FIBJS_OS=windows | ||
else | ||
export FIBJS_OS=win32 | ||
fi | ||
;; | ||
macOS) | ||
export FIBJS_OS=darwin | ||
;; | ||
Linux) | ||
export FIBJS_OS=linux | ||
;; | ||
*) | ||
echo "unsupported RUNNER_OS ${RUNNER_OS}"; | ||
exit 1 | ||
;; | ||
esac | ||
echo "::set-output name=FIBJS_OS::$FIBJS_OS"; | ||
|
||
case "${ARCH}" in | ||
i386|ia32|x86) | ||
if [[ "$lower_than_0_37_0" == "true" ]]; then | ||
export FIBJS_ARCH=x86 | ||
else | ||
export FIBJS_ARCH=ia32 | ||
fi | ||
;; | ||
amd64|x64) | ||
export FIBJS_ARCH=x64 | ||
;; | ||
*) | ||
export FIBJS_ARCH=$ARCH | ||
;; | ||
esac | ||
echo "::set-output name=FIBJS_ARCH::$FIBJS_ARCH"; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters