-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from mrakitin/ci-minor-tweaks
CI: some tweaks to the steps; switch to miniconda action
- Loading branch information
Showing
4 changed files
with
92 additions
and
155 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 |
---|---|---|
@@ -1,75 +1,82 @@ | ||
name : tests | ||
name: tests | ||
|
||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: '00 4 * * *' # daily at 4AM | ||
- cron: '00 4 * * *' # daily at 4AM | ||
|
||
jobs: | ||
build: | ||
|
||
name: Test sirepo-bluesky with Python ${{ matrix.python-version }} | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
matrix: | ||
python-version: [3.7, 3.8, 3.9] | ||
|
||
fail-fast: false | ||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
steps: | ||
- name: Set env.REPOSITORY_NAME # just the repo, as opposed to org/repo | ||
shell: bash -l {0} | ||
run: | | ||
export REPOSITORY_NAME=${GITHUB_REPOSITORY#*/} | ||
echo "REPOSITORY_NAME=${REPOSITORY_NAME}" >> $GITHUB_ENV | ||
- name: start MongoDB | ||
uses: supercharge/mongodb-github-action@1.6.0 | ||
- name: Checkout the code | ||
uses: actions/checkout@v2 | ||
|
||
- name: start Sirepo-Bluesky container | ||
run: | | ||
set -vxeuo pipefail | ||
. scripts/start_docker.sh -d | ||
export SIREPO_DOCKER_CONTAINER_ID | ||
echo "SIREPO_DOCKER_CONTAINER_ID=${SIREPO_DOCKER_CONTAINER_ID}" >> $GITHUB_ENV | ||
- name: Start MongoDB | ||
uses: supercharge/mongodb-github-action@1.6.0 | ||
|
||
- name: is Sirepo-Bluesky running? | ||
run: docker ps -a | ||
- name: Start Sirepo Docker container | ||
shell: bash -l {0} | ||
run: | | ||
# For reference: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html. | ||
set -vxeuo pipefail | ||
. scripts/start_sirepo.sh -d | ||
export SIREPO_DOCKER_CONTAINER_ID | ||
echo "SIREPO_DOCKER_CONTAINER_ID=${SIREPO_DOCKER_CONTAINER_ID}" >> $GITHUB_ENV | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Check Sirepo state | ||
run: | | ||
set -vxeuo pipefail | ||
docker images | ||
docker ps -a | ||
docker logs ${SIREPO_DOCKER_CONTAINER_ID} | ||
- name: Create conda environment | ||
run: | | ||
# For reference: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html. | ||
set -vxeuo pipefail | ||
source $CONDA/etc/profile.d/conda.sh | ||
conda create -n test -c conda-forge python=${{ matrix.python-version }} shadow3 srwpy | ||
- name: Set up Python ${{ matrix.python-version }} with conda | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
activate-environment: ${{ env.REPOSITORY_NAME }}-py${{ matrix.python-version }} | ||
auto-update-conda: true | ||
miniconda-version: "latest" | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install | ||
shell: bash -l {0} | ||
run: | | ||
# For reference: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html. | ||
set -vxeuo pipefail | ||
source $CONDA/etc/profile.d/conda.sh | ||
conda activate test | ||
conda env list | ||
pip install --upgrade pip wheel | ||
pip install . | ||
pip install -r requirements-dev.txt | ||
pip list | ||
conda list | ||
- name: Install the package and its dependencies | ||
shell: bash -l {0} | ||
run: | | ||
# set -vxeuo pipefail | ||
# Do not check for unbound variables (the '-u' flag) as it fails on | ||
# conda deactivate command: | ||
# /usr/share/miniconda3/envs/sirepo-bluesky-py3.9/etc/conda/deactivate.d/glib_deactivate.sh: | ||
# line 1: GSETTINGS_SCHEMA_DIR_CONDA_BACKUP: unbound variable | ||
set -vxeo pipefail | ||
conda env list | ||
conda install -c conda-forge shadow3 srwpy | ||
pip install --upgrade pip wheel | ||
pip install . | ||
pip install -r requirements-dev.txt | ||
pip list | ||
conda list | ||
- name: Test with pytest | ||
shell: bash -l {0} | ||
run: | | ||
# For reference: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html. | ||
set -vxeuo pipefail | ||
source $CONDA/etc/profile.d/conda.sh | ||
conda activate test | ||
pytest -s -vv sirepo_bluesky/tests | ||
status=$? | ||
echo "Sirepo Docker container id: ${SIREPO_DOCKER_CONTAINER_ID}" | ||
docker logs ${SIREPO_DOCKER_CONTAINER_ID} | ||
if [ $status -gt 0 ]; then | ||
exit $status | ||
fi | ||
- name: Test with pytest | ||
shell: bash -l {0} | ||
run: | | ||
set -vxeuo pipefail | ||
pytest -s -vv | ||
status=$? | ||
echo "Sirepo Docker container id: ${SIREPO_DOCKER_CONTAINER_ID}" | ||
docker logs ${SIREPO_DOCKER_CONTAINER_ID} | ||
if [ $status -gt 0 ]; then | ||
exit $status | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,21 @@ | ||
docker run -it --rm -p 27017:27017 mongo | ||
#!/bin/bash | ||
|
||
set -vxeuo pipefail | ||
|
||
error_msg="Specify '-it' or '-d' on the command line as a first argument." | ||
|
||
arg="${1:-}" | ||
|
||
if [ -z "${arg}" ]; then | ||
echo "${error_msg}" | ||
exit 1 | ||
elif [ "${arg}" != "-it" -a "${arg}" != "-d" ]; then | ||
echo "${error_msg} Specified argument: ${arg}" | ||
exit 2 | ||
fi | ||
|
||
docker_image="mongo" | ||
|
||
docker pull ${docker_image} | ||
docker images | ||
docker run ${arg} --rm -p 27017:27017 --name mongo ${docker_image} |
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