Skip to content

Lintify sourcextractor #2118

Lintify sourcextractor

Lintify sourcextractor #2118

# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
pull_request:
merge_group:
# run the pipeline on the 0th minute of the 0th hour of day 1 and 15 every month
schedule:
- cron: '0 0 1,15 * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
ci:
# The type of runner that the job will run on
runs-on: ubuntu-22.04
# Specify the python versions to test
strategy:
matrix:
python-version: ["3.10", "3.11"]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
# Set up the python versions
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
# Runs a set of commands using the runners shell
- name: set up ssh
uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: |
${{ secrets.WIRC_STARTERPACK_TOKEN }}
- name: install packages
run: |
sudo apt-get update
sudo apt-get install -y sextractor scamp swarp build-essential
echo "deb http://ftp.us.debian.org/debian sid main" | sudo tee -a /etc/apt/sources.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9
sudo apt-get update && sudo apt-get install -y psfex
sudo ln -s /usr/bin/source-extractor /usr/bin/sex
sudo ln -s /usr/bin/SWarp /usr/bin/swarp
echo `sex --version`
echo `scamp --version`
echo `swarp --version`
echo `psfex --version`
pip install --upgrade pip
python -m pip install --upgrade poetry coveralls
poetry install
# Set up database
- name: postgres
run: |
sudo apt install postgresql
sudo service postgresql restart
sudo -u postgres psql -c "create user runner; grant all privileges on database postgres to runner; ALTER USER runner WITH SUPERUSER;"
# First make sure the doc tests are up to date
- name: Run doc tests
run: |
poetry run make -C docs/ doctest
# Runs a set of commands using the runners shell
- name: Test the code
env:
OUTPUT_DATA_DIR : /home/runner/
PG_ADMIN_USER: runner
PG_ADMIN_PWD: ""
DB_USER: runner
DB_PWD: ""
WATCHDOG_EMAIL: ${{ secrets.WATCHDOG_EMAIL }}
WATCHDOG_EMAIL_PASSWORD: ${{ secrets.WATCHDOG_EMAIL_PASSWORD }}
WATCHDOG_EMAIL_RECIPIENTS: ${{ secrets.WATCHDOG_EMAIL_RECIPIENTS }}
KOWALSKI_TOKEN: ${{ secrets.KOWALSKI_TOKEN }}
FRITZ_TOKEN: ${{ secrets.FRITZ_TOKEN }}
run: |
TESTDATA_CHECK="True" poetry run coverage run -m unittest discover tests/
- name: Run Coveralls
if: ${{ success() }}
run: |
poetry run coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Echo tag name
run: echo "Tag is ${{ github.ref }}, Tagged is ${{ startsWith(github.ref, 'refs/tags/')}}, Python Check is ${{matrix.python-version == 3.10}}, Deploy is ${{ startsWith(github.ref, 'refs/tags/') && matrix.python-version == 3.10}}"
# Build a tarball and push to Pypi if tagged with new version
- name: Build and publish
if: ${{ startsWith(github.ref, 'refs/tags/') && success() && matrix.python-version == 3.11}}
run: |
poetry publish -n --build
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}