Garage CI release-2021.03 #1309
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: Garage CI release-2021.03 | |
env: | |
GARAGE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
DOCKER_TAG: garage-ci-${{ github.run_id }} | |
OWNER: "rlworkgroup" | |
DOCKER_CACHE_REPO: "garage-ci" | |
MJKEY: ${{ secrets.MJKEY }} | |
CI_USER: rlworkgroupbot | |
on: | |
# The release ci in the master branch handles only cron jobs branch | |
# The pull_request and push and tag triggers are in the release branch itself | |
schedule: | |
- cron: '0 9 * * *' | |
jobs: | |
build_docker_container: | |
name: Build Docker Container | |
runs-on: ubuntu-latest | |
steps: | |
- name: Docker info | |
run: docker version | |
- uses: actions/checkout@v2 | |
with: | |
ref: release-2021.03 | |
- name: Login to GitHub Package Registry | |
run: echo ${{ secrets.CI_REGISTRY_TOKEN }} | docker login docker.pkg.github.com -u ${CI_USER} --password-stdin | |
- name: Build Docker container | |
run: | | |
DOCKER_BUILDKIT=1 docker build . \ | |
-f docker/Dockerfile \ | |
--target garage-dev \ | |
-t "${DOCKER_TAG}" \ | |
--build-arg GARAGE_GH_TOKEN \ | |
--cache-from="rlworkgroup/garage" | |
- name: Push to cache (GitHub Package Registry) | |
run: | | |
docker tag "${DOCKER_TAG}" "docker.pkg.github.com/${OWNER}/${DOCKER_CACHE_REPO}/${DOCKER_TAG}" | |
docker push "docker.pkg.github.com/${OWNER}/${DOCKER_CACHE_REPO}/${DOCKER_TAG}" | |
doctest: | |
name: Run Doctest | |
runs-on: ubuntu-latest | |
needs: build_docker_container | |
steps: | |
- name: Login to GitHub Package Registry | |
run: echo ${{ secrets.CI_REGISTRY_TOKEN }} | docker login docker.pkg.github.com -u ${CI_USER} --password-stdin | |
- name: Pull from cache (GitHub Package Registry) | |
run: docker pull "docker.pkg.github.com/${OWNER}/${DOCKER_CACHE_REPO}/${DOCKER_TAG}" | |
- name: Tag docker image | |
run: docker tag docker.pkg.github.com/${OWNER}/${DOCKER_CACHE_REPO}/${DOCKER_TAG} ${DOCKER_TAG} | |
- name: Doctest | |
run: | | |
docker run \ | |
-e MJKEY \ | |
--memory 6500m \ | |
--memory-swap 6500m \ | |
"${DOCKER_TAG}" \ | |
/bin/bash -c \ | |
'pushd docs && make doctest clean && popd' | |
normal_test: | |
name: Normal Tests | |
runs-on: ubuntu-latest | |
needs: build_docker_container | |
steps: | |
- name: Login to GitHub Package Registry | |
run: echo ${{ secrets.CI_REGISTRY_TOKEN }} | docker login docker.pkg.github.com -u ${CI_USER} --password-stdin | |
- name: Pull from cache (GitHub Package Registry) | |
run: docker pull "docker.pkg.github.com/${OWNER}/${DOCKER_CACHE_REPO}/${DOCKER_TAG}" | |
- name: Tag docker image | |
run: docker tag docker.pkg.github.com/${OWNER}/${DOCKER_CACHE_REPO}/${DOCKER_TAG} ${DOCKER_TAG} | |
- name: Normal tests | |
run: | | |
ci_env="$(bash <(curl -s https://codecov.io/env))" && | |
docker run \ | |
-e GITHUB_ACTIONS `# used by codecov` \ | |
-e CODECOV_TOKEN \ | |
$ci_env\ | |
--memory 6500m \ | |
--memory-swap 6500m \ | |
"${DOCKER_TAG}" \ | |
/bin/bash -c \ | |
'[ ! -f ${MJKEY_PATH} ] || mv ${MJKEY_PATH} ${MJKEY_PATH}.bak && | |
pytest --cov=garage --reruns 1 --cov-report=xml -m \ | |
"not nightly and not huge and not flaky and not large and not mujoco and not mujoco_long" --durations=20 && | |
for i in {1..5}; do | |
bash <(curl -s https://codecov.io/bash --retry 5) -Z && break | |
if [ $i == 5 ]; then | |
exit 1 | |
else | |
echo "Retry ${i}..." | |
sleep 30 | |
fi | |
done' | |
large_test: | |
name: Large Tests | |
runs-on: ubuntu-latest | |
needs: build_docker_container | |
steps: | |
- name: Login to GitHub Package Registry | |
run: echo ${{ secrets.CI_REGISTRY_TOKEN }} | docker login docker.pkg.github.com -u ${CI_USER} --password-stdin | |
- name: Pull from cache (GitHub Package Registry) | |
run: docker pull "docker.pkg.github.com/${OWNER}/${DOCKER_CACHE_REPO}/${DOCKER_TAG}" | |
- name: Tag docker image | |
run: docker tag docker.pkg.github.com/${OWNER}/${DOCKER_CACHE_REPO}/${DOCKER_TAG} ${DOCKER_TAG} | |
- name: Large tests | |
run: | | |
ci_env="$(bash <(curl -s https://codecov.io/env))" && | |
docker run \ | |
-e GITHUB_ACTIONS \ | |
-e CODECOV_TOKEN \ | |
$ci_env\ | |
--memory 6500m \ | |
--memory-swap 6500m \ | |
"${DOCKER_TAG}" \ | |
/bin/bash -c \ | |
'[ ! -f ${MJKEY_PATH} ] || mv ${MJKEY_PATH} ${MJKEY_PATH}.bak && | |
pytest --cov=garage --cov-report=xml --reruns 1 -m "large and not flaky" --durations=20 && | |
for i in {1..5}; do | |
bash <(curl -s https://codecov.io/bash --retry 5) -Z && break | |
if [ $i == 5 ]; then | |
exit 1 | |
else | |
echo "Retry ${i}..." | |
sleep 30 | |
fi | |
done' | |
mujoco_test: | |
name: MuJoCo-Based Tests | |
runs-on: ubuntu-latest | |
needs: build_docker_container | |
steps: | |
- name: Login to GitHub Package Registry | |
run: echo ${{ secrets.CI_REGISTRY_TOKEN }} | docker login docker.pkg.github.com -u ${CI_USER} --password-stdin | |
- name: Pull from cache (GitHub Package Registry) | |
run: docker pull "docker.pkg.github.com/${OWNER}/${DOCKER_CACHE_REPO}/${DOCKER_TAG}" | |
- name: Tag docker image | |
run: docker tag docker.pkg.github.com/${OWNER}/${DOCKER_CACHE_REPO}/${DOCKER_TAG} ${DOCKER_TAG} | |
- name: MuJoCo tests | |
run: | | |
ci_env="$(bash <(curl -s https://codecov.io/env))" && | |
docker run \ | |
-e MJKEY \ | |
-e GITHUB_ACTIONS \ | |
-e CODECOV_TOKEN \ | |
$ci_env\ | |
--memory 6500m \ | |
--memory-swap 6500m \ | |
"${DOCKER_TAG}" \ | |
/bin/bash -c \ | |
'pytest --cov=garage --cov-report=xml --reruns 1 -m "mujoco and not flaky" --durations=20 && | |
for i in {1..5}; do | |
bash <(curl -s https://codecov.io/bash --retry 5) -Z && break | |
if [ $i == 5 ]; then | |
exit 1 | |
else | |
echo "Retry ${i}..." | |
sleep 30 | |
fi | |
done' | |
mujoco_test_long: | |
name: Large MuJoCo-Based Tests | |
runs-on: ubuntu-latest | |
needs: build_docker_container | |
steps: | |
- name: Login to GitHub Package Registry | |
run: echo ${{ secrets.CI_REGISTRY_TOKEN }} | docker login docker.pkg.github.com -u ${CI_USER} --password-stdin | |
- name: Pull from cache (GitHub Package Registry) | |
run: docker pull "docker.pkg.github.com/${OWNER}/${DOCKER_CACHE_REPO}/${DOCKER_TAG}" | |
- name: Tag docker image | |
run: docker tag docker.pkg.github.com/${OWNER}/${DOCKER_CACHE_REPO}/${DOCKER_TAG} ${DOCKER_TAG} | |
- name: Large MuJoCo tests | |
run: | | |
ci_env="$(bash <(curl -s https://codecov.io/env))" && | |
docker run \ | |
-e MJKEY \ | |
-e GITHUB_ACTIONS \ | |
-e CODECOV_TOKEN \ | |
$ci_env\ | |
--memory 6500m \ | |
--memory-swap 6500m \ | |
"${DOCKER_TAG}" \ | |
/bin/bash -c \ | |
'pytest --cov=garage --cov-report=xml --reruns 1 -m "mujoco_long and not flaky" --durations=20 && | |
for i in {1..5}; do | |
bash <(curl -s https://codecov.io/bash --retry 5) -Z && break | |
if [ $i == 5 ]; then | |
exit 1 | |
else | |
echo "Retry ${i}..." | |
sleep 30 | |
fi | |
done' | |
nightly_test: | |
name: Nightly Tests | |
runs-on: ubuntu-latest | |
needs: build_docker_container | |
if: github.event_name == 'schedule' | |
steps: | |
- name: Login to GitHub Package Registry | |
run: echo ${{ secrets.CI_REGISTRY_TOKEN }} | docker login docker.pkg.github.com -u ${CI_USER} --password-stdin | |
- name: Pull from cache (GitHub Package Registry) | |
run: docker pull "docker.pkg.github.com/${OWNER}/${DOCKER_CACHE_REPO}/${DOCKER_TAG}" | |
- name: Tag docker image | |
run: docker tag docker.pkg.github.com/${OWNER}/${DOCKER_CACHE_REPO}/${DOCKER_TAG} ${DOCKER_TAG} | |
- name: Nightly tests | |
run: | | |
docker run \ | |
-e MJKEY \ | |
--memory 6500m \ | |
--memory-swap 6500m \ | |
"${DOCKER_TAG}" pytest -v -m nightly | |
verify_envs_conda: | |
name: Verify Conda Environment Installation | |
runs-on: ubuntu-latest | |
needs: build_docker_container | |
if: github.event_name == 'schedule' | |
steps: | |
- name: Login to GitHub Package Registry | |
run: echo ${{ secrets.CI_REGISTRY_TOKEN }} | docker login docker.pkg.github.com -u ${CI_USER} --password-stdin | |
- name: Pull from cache (GitHub Package Registry) | |
run: docker pull "docker.pkg.github.com/${OWNER}/${DOCKER_CACHE_REPO}/${DOCKER_TAG}" | |
- name: Tag docker image | |
run: docker tag docker.pkg.github.com/${OWNER}/${DOCKER_CACHE_REPO}/${DOCKER_TAG} ${DOCKER_TAG} | |
- name: Verify Conda | |
run: | | |
docker run \ | |
-e MJKEY \ | |
--memory 6500m \ | |
--memory-swap 6500m \ | |
"${DOCKER_TAG}" \ | |
/bin/bash -c \ | |
'CONDA_ROOT=$HOME/miniconda \ | |
CONDA=${CONDA_ROOT}/bin/conda \ | |
GARAGE_BIN=${CONDA_ROOT}/envs/garage-ci/bin; \ | |
touch ${MJKEY_PATH} && \ | |
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh && \ | |
bash miniconda.sh -b -p ${CONDA_ROOT} && \ | |
hash -r && \ | |
${CONDA} config --set always_yes yes --set changeps1 no && \ | |
${CONDA} install -c anaconda setuptools && \ | |
${CONDA} update -q conda && \ | |
${CONDA} init && \ | |
${CONDA} info -a && \ | |
${CONDA} create -n garage-ci python=3.6 pip -y && \ | |
${GARAGE_BIN}/pip install --upgrade pip setuptools && \ | |
${GARAGE_BIN}/pip install dist/garage.tar.gz[all,dev] && \ | |
${GARAGE_BIN}/pylint --disable=all --enable=import-error garage' | |
verify_envs_pipenv: | |
name: Verify Pipenv Environment Installation | |
runs-on: ubuntu-latest | |
needs: build_docker_container | |
if: github.event_name == 'schedule' | |
steps: | |
- name: Login to GitHub Package Registry | |
run: echo ${{ secrets.CI_REGISTRY_TOKEN }} | docker login docker.pkg.github.com -u ${CI_USER} --password-stdin | |
- name: Pull from cache (GitHub Package Registry) | |
run: docker pull "docker.pkg.github.com/${OWNER}/${DOCKER_CACHE_REPO}/${DOCKER_TAG}" | |
- name: Tag docker image | |
run: docker tag docker.pkg.github.com/${OWNER}/${DOCKER_CACHE_REPO}/${DOCKER_TAG} ${DOCKER_TAG} | |
- name: Verify Pipenv | |
run: | | |
docker run \ | |
-e MJKEY \ | |
--memory 6500m \ | |
--memory-swap 6500m \ | |
"${DOCKER_TAG}" \ | |
/bin/bash -c \ | |
"export PATH=\$PATH_NO_VENV && \ | |
export VIRTUAL_ENV= && \ | |
export PIPENV_MAX_RETRIES=2 && \ | |
touch \${MJKEY_PATH} && \ | |
pip3 install --upgrade pip setuptools && \ | |
pip3 install pipenv && \ | |
pipenv --python=3.6 && \ | |
pipenv install dist/garage.tar.gz[all,dev] && \ | |
pipenv graph && \ | |
# pylint will verify all imports work | |
pipenv run pylint --disable=all --enable=import-error garage" | |
delete_docker_container: | |
name: Delete Docker Container | |
runs-on: ubuntu-latest | |
needs: [doctest, normal_test, large_test, mujoco_test, mujoco_test_long, nightly_test, verify_envs_conda, verify_envs_pipenv] | |
if: always() | |
steps: | |
- uses: actions/delete-package-versions@v1 | |
with: | |
owner: ${{ env.OWNER }} | |
repo: ${{ env.DOCKER_CACHE_REPO }} | |
package-name: ${{ env.DOCKER_TAG }} | |
token: ${{ secrets.CI_REGISTRY_TOKEN }} |