Bump isbang/compose-action from 1.5.0 to 2.0.1 #433
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
name: "PR Checks" | |
on: | |
pull_request: | |
branches: | |
- dev | |
- main | |
- 'releases/**' | |
paths-ignore: | |
- 'debian/changelog' | |
jobs: | |
Lint-Project: | |
timeout-minutes: 30 | |
name: "Linting checks" | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: install static-checks-requirements | |
run: | | |
python3 -m pip install pip --upgrade | |
python3 -m pip install pyopenssl --upgrade | |
python3 -m pip install docker-compose yamllint | |
- name: Yamllint | |
uses: karancode/yamllint-github-action@master | |
with: | |
yamllint_file_or_dir: docker-compose.yml docker-compose-nvidia.yml docker-compose-host.yml docker-compose-nvidia-host.yml | |
yamllint_strict: false | |
yamllint_comment: true | |
yamllint_config_filepath: .yamllint-config.yml | |
env: | |
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: run docker-compose lint | |
run: | | |
docker-compose -f docker-compose.yml config | |
docker-compose -f docker-compose-host.yml config | |
docker-compose -f docker-compose-nvidia.yml config | |
docker-compose -f docker-compose-nvidia-host.yml config | |
# - name: Validate json | |
# uses: anyone-developer/anyone-validate-json@main | |
# with: | |
# file-extension: '.json' | |
# ignore-files: '' | |
# ignore-directories: '.git' | |
# read-path: 'robots' | |
Test-Project: | |
timeout-minutes: 30 | |
name: "Cluster sanity checks" | |
runs-on: ubuntu-20.04 | |
needs: [ Lint-Project ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: install requirements | |
run: | | |
python3 -m pip install pip --upgrade | |
python3 -m pip install pyopenssl --upgrade | |
python3 -m pip install docker-compose | |
- name: prepare docker-compose cluster | |
run: | | |
mkdir -p ./{logs,shared,userspace,models_database} || true | |
sudo chown 1000:1000 ./{logs,shared,userspace,models_database} -R | |
- name: run docker-compose cluster | |
uses: isbang/[email protected] | |
with: | |
compose-file: './docker-compose.yml' | |
down-flags: '--volumes' | |
- name: test cluster frontend | |
run: | | |
export base_url="http://localhost:8080" | |
export token_url="$base_url/token-auth/" | |
export authenticated_url="$base_url/api/v1/User/movai/?" | |
# retry for 1 minute | |
count=10 | |
set +e | |
for i in $(seq $count); do | |
status_code=$(curl -k -s -o /dev/null --cookie-jar cookies --header 'Content-Type: application/json' -X POST --data '{"username":"movai","password":"movai","remember":true}' -w "%{http_code}" $token_url) | |
if [ $status_code == 200 ]; then | |
break | |
fi | |
echo "Waiting for MOV.AI Flow™ availability (ret:$status_code)" | |
sleep 10 | |
done | |
[ $status_code == 200 ] || exit -1 | |
err_status_code=$(curl "$authenticated_url" -k -s -o /dev/null -w "%{http_code}") | |
[ $err_status_code == 401 ] || exit -1 | |
json_token=$(curl -k -s --cookie-jar cookies --header 'Content-Type: application/json' -X POST --data '{"username":"movai","password":"movai","remember":true}' $token_url) | |
token=$( jq -r ".access_token" <<<"$json_token" ) | |
ok_status_code=$(curl "$authenticated_url" -k -s -o /dev/null -H "Authorization: Bearer $token" -w "%{http_code}") | |
[ $ok_status_code == 200 ] || exit -1 | |
Test-Project-HostMode: | |
timeout-minutes: 30 | |
name: "Host Mode Cluster checks" | |
runs-on: ubuntu-20.04 | |
needs: [ Lint-Project ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: install requirements | |
run: | | |
python3 -m pip install pip --upgrade | |
python3 -m pip install pyopenssl --upgrade | |
python3 -m pip install docker-compose | |
- name: prepare docker-compose cluster | |
run: | | |
mkdir -p ./{logs,shared,userspace,models_database} || true | |
sudo chown 1000:1000 ./{logs,shared,userspace,models_database} -R | |
- name: run docker-compose cluster in host mode | |
uses: isbang/[email protected] | |
with: | |
compose-file: './docker-compose-host.yml' | |
down-flags: '--volumes' | |
- name: test cluster frontend in host mode | |
run: | | |
export base_url="http://localhost:8080" | |
export token_url="$base_url/token-auth/" | |
export authenticated_url="$base_url/api/v1/User/movai/?" | |
# retry for 1 minute | |
count=10 | |
set +e | |
for i in $(seq $count); do | |
status_code=$(curl -k -s -o /dev/null --cookie-jar cookies --header 'Content-Type: application/json' -X POST --data '{"username":"movai","password":"movai","remember":true}' -w "%{http_code}" $token_url) | |
if [ $status_code == 200 ]; then | |
break | |
fi | |
echo "Waiting for MOV.AI Flow™ availability (ret:$status_code)" | |
sleep 10 | |
done | |
[ $status_code == 200 ] || exit -1 | |
err_status_code=$(curl "$authenticated_url" -k -s -o /dev/null -w "%{http_code}") | |
[ $err_status_code == 401 ] || exit -1 | |
json_token=$(curl -k -s --cookie-jar cookies --header 'Content-Type: application/json' -X POST --data '{"username":"movai","password":"movai","remember":true}' $token_url) | |
token=$( jq -r ".access_token" <<<"$json_token" ) | |
ok_status_code=$(curl "$authenticated_url" -k -s -o /dev/null -H "Authorization: Bearer $token" -w "%{http_code}") | |
[ $ok_status_code == 200 ] || exit -1 | |
Pack-Project: | |
timeout-minutes: 30 | |
name: "Pack Checks" | |
runs-on: ubuntu-20.04 | |
needs: [ Lint-Project ] | |
container: | |
image: registry.cloud.mov.ai/qa/ros-buildtools-noetic:v2.0.3 | |
options: --user root | |
credentials: | |
username: ${{secrets.PORTUS_APP_USER}} | |
password: ${{secrets.PORTUS_APP_TOKEN}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Find Package details | |
id: vars | |
run: | | |
PACKAGE_VERSION=$(dpkg-parsechangelog --show-field Version) | |
PACKAGE_NAME=$(dpkg-parsechangelog --show-field Source) | |
echo ::set-output name=pkg_name::$PACKAGE_NAME | |
echo ::set-output name=pkg_version::$PACKAGE_VERSION | |
- name: Raise Version | |
id: vars-after-raise | |
run: | | |
PACKAGE_VERSION=${{ steps.vars.outputs.pkg_version }} | |
main_version=${PACKAGE_VERSION%-*} | |
build_id="${PACKAGE_VERSION#*-}" | |
raised_buildid=$(($build_id+1)) | |
RAISED_PACKAGE_VERSION="$main_version-$raised_buildid" | |
echo ::set-output name=pkg_version::$RAISED_PACKAGE_VERSION | |
- name: Pack debian | |
run: | | |
git config --global --add safe.directory $(pwd) | |
git config --global user.name '${{ secrets.RAISE_BOT_COMMIT_USER }}' | |
git config --global user.email '${{ secrets.RAISE_BOT_COMMIT_MAIL }}' | |
apt-get update | |
apt-get install -y devscripts equivs git-buildpackage | |
# Set the install command to be used by mk-build-deps (use --yes for non-interactive) | |
install_tool="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes" | |
# Install build dependencies automatically | |
mk-build-deps --install --tool="${install_tool}" debian/control | |
# Add version into changelog and commit it | |
gbp dch --ignore-branch -N ${{ steps.vars-after-raise.outputs.pkg_version }} -c | |
# Build .deb with binaries only | |
dpkg-buildpackage -b --unsigned-source --unsigned-changes | |
# Store generated .deb | |
mkdir artifacts && \ | |
cp ../*.deb artifacts | |
- name: Publish to Nexus ppa-dev | |
run: | | |
NEXUS_ENDPOINT="artifacts.cloud.mov.ai" | |
NEXUS_REPO="ppa-dev" | |
FILE_LOCATION=$(find artifacts/*.deb) | |
curl -u "${{ secrets.NEXUS_PUBLISHER_USR }}:${{ secrets.NEXUS_PUBLISHER_PWD }}" \ | |
-H "Content-Type: multipart/form-data" \ | |
--data-binary "@$FILE_LOCATION" \ | |
"https://$NEXUS_ENDPOINT/repository/$NEXUS_REPO/" | |
- name: Store artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages | |
path: artifacts/* |