Skip to content

Improve Actions CI success rate at 1st attempt #174

Improve Actions CI success rate at 1st attempt

Improve Actions CI success rate at 1st attempt #174

Workflow file for this run

name: CI
# by not building all branches on push, we avoid the duplicated builds in PRs
on:
push:
branches:
- main
tags:
- '**'
pull_request:
concurrency:
# cancel previous runs of the same workflow for the same PR when new commits are pushed
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
NUMBA_NUM_THREADS: 1
MPLBACKEND: Agg
PYTEST_ADDOPTS: --color=yes
jobs:
static-code-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: "3.10.9"
tests:
timeout-minutes: 60
strategy:
matrix:
include:
- python-version: "3.10.9"
os: ubuntu-latest
- python-version: "3.11"
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: |
python -m pip install --upgrade pip
- name: Build the package
run: |
pip install build
python -m build
- name: Install the package
run: pip install .[test]
- name: Install the package in editable mode with all additional dependencies
run: pip install --editable .[all]
# - name: Install httpdirfs to access astrometry index files without downloading them
# run: sudo apt install httpdirfs
# - uses: actions/cache/restore@v3
# id: cache
# with:
# path: $HOME/.cache/httpdirfs/
# key: astrometry_5200_cache
# - name: Debug cache
# run: ls $HOME/.astrometry_cache/5200/index-5200-00.fits || true
# - name: Mount astrometry index file in default location
# run: mkdir -p $HOME/.astrometry_cache/5200 && httpdirfs --cache 'https://portal.nersc.gov/project/cosmo/temp/dstn/index-5200/LITE/' $HOME/.astrometry_cache/5200/
# - name: Check that it was correctly mounted
# run: ls $HOME/.astrometry_cache/5200/index-5200-00.fits
- name: Download test data
env:
TEST_DATA_PASSWORD: ${{ secrets.test_data_password }}
run: |
export TESTDATA_MD5SUM=`grep 'TESTDATA_MD5SUM' ./tests/conftest.py | awk -F"'" '{print $2}' | tr -d '\n'`
wget --post-data "pass=$TEST_DATA_PASSWORD" "https://vhega.iaa.es/iop4/iop4testdata.tar.gz?md5sum=$TESTDATA_MD5SUM" -O $HOME/iop4testdata.tar.gz
- name: Run tests (with -o log_cli=true -o log_cli_level=DEBUG to debug CI actions)
run: pytest -o log_cli=true -o log_cli_level=DEBUG -vxs tests/
# - uses: actions/cache/save@v3
# with:
# path: $HOME/.cache/httpdirfs/
# key: astrometry_5200_cache
# - name: Output some info for debugging
# # | true so erros in this step are ignored
# run: |
# df -h || true
# du -sh $HOME/.cache/httpdirfs/ || true
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10.9"
- name: Update pip
run: |
python -m pip install --upgrade pip
- name: Install doc dependencies
run: |
pip install -e .[doc]
python -c 'import iop4lib; print(iop4lib.__version__)'
- name: Build docs
run: cd docs && make html