Skip to content

Bump actions/checkout from 2 to 4 #23

Bump actions/checkout from 2 to 4

Bump actions/checkout from 2 to 4 #23

Workflow file for this run

# This workflow runs on all pull requests. It has the following functions:
# 1. Apply flake8 to the codebase for linting
# 2. Run either the default test suite, or specific tests if specified in
# the PR comments, on all supported python versions and operating systems.
name: pull_request_tests
on: pull_request
# Set globally scoped environmental variables.
env:
ISSUE_NUMBER: ${{ github.event.pull_request.number }}
PR_URL: https://github.com/obspy/obspy/pull/${{ github.event.pull_request.number }}
CI_URL: https://github.com/obspy/obspy/actions/runs/${{ github.run_id }}
CONFIG_PATH: obspy_ci_config/conf.json
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OBSPY_GITHUB_BRANCH: release_0.10.0
jobs:
# Parse the comments from the PR and uploads a json with selected options
get_ci_config:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: create ci config
shell: bash -l {0}
run: |
pip install git+https://github.com/obspy/obspy_github_api@${OBSPY_GITHUB_BRANCH}
obshub make-config ${ISSUE_NUMBER} --path=${CONFIG_PATH} --token=${GITHUB_TOKEN}
- name: upload ci config
uses: actions/upload-artifact@v1
with:
name: obspy_ci_config
path: ${{ env.CONFIG_PATH }}
# Simply applies flake8 to the codebase.
lint_code:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install flake8
run: |
pip install wheel
pip install flake8
- name: Set up reviewdog
run: |
mkdir -p $HOME/bin
curl -sfL \
https://github.com/reviewdog/reviewdog/raw/master/install.sh | \
sh -s -- -b $HOME/bin
echo "$HOME/bin" >> $GITHUB_PATH
- name: flake8
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -o pipefail
python -m flake8 obspy | \
reviewdog -f=pep8 -name=flake8 \
-tee -reporter=github-check -filter-mode nofilter
# Runs the tests on combinations of the supported python/os matrix.
test_code:
runs-on: ${{ matrix.os }}
needs: get_ci_config
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8]
steps:
- uses: actions/checkout@v4
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: 'latest'
python-version: ${{ matrix.python-version }}
activate-environment: test
environment-file: .github/test_conda_env.yml
- name: print package info
shell: bash -l {0}
run: |
conda info -a
conda list
- name: download test config
uses: actions/download-artifact@v1
with:
name: obspy_ci_config
- name: install obspy
shell: bash -l {0}
run: |
pip install -e .
- name: install obspy github api
shell: bash -l {0}
run : |
pip install git+https://github.com/obspy/obspy_github_api@${OBSPY_GITHUB_BRANCH}
- name: run test suite
shell: bash -l {0}
run: |
export MODULELIST=`obshub read-config-value module_list --path=${CONFIG_PATH}`
export MODULELISTSPACES=`obshub read-config-value module_list_spaces --path=${CONFIG_PATH}`
coverage run --rcfile=.coveragerc --source=${MODULELIST} -m obspy.scripts.runtests --no-flake8 -n gh-actions -r --ci-url="${CI_URL}" --pr-url="${PR_URL}" $MODULELISTSPACES
coverage xml -o coverage.xml
- name: upload coverage
uses: codecov/codecov-action@v1
with:
flags: unittests
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-umbrella
fail_ci_if_error: false
file: coverage.xml
# This is a very useful step for debugging, it allows you to ssh into the CI
# machine (https://github.com/marketplace/actions/debugging-with-tmate).
# Make sure to open the log before the job starts else you cant see the tmate
# url. See https://github.com/mxschmitt/action-tmate/issues/1.
# Also, the CI machine will close on a non-zero exit code (annoying). This can
# be overcome by coalescing the null command like so:
# $ some-command-that-can-fail || :
#
#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v1