migrate to ruff for linting & formatting (#697) #1087
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: CI | |
on: [push, pull_request] | |
jobs: | |
target: | |
strategy: | |
matrix: | |
ci_target: | |
- ci_housekeeping | |
- ci_unit_tests | |
- integration_tests | |
- viral_refbased | |
- viral_assemble | |
# disabled due to test data bitrot (Apr 2023) | |
# - skylab_bulk_rna | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Maximize build space | |
uses: AdityaGarg8/remove-unwanted-software@v3 | |
with: | |
remove-dotnet: 'true' | |
remove-android: 'true' | |
remove-haskell: 'true' | |
remove-codeql: 'true' | |
if: ${{ matrix.ci_target == 'viral_assemble' }} | |
- name: Login to GitHub Packages Docker Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: docker.pkg.github.com | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: docker build | |
run: | | |
# Cache the dependency-installation image layer on GitHub Packages to speed up CI. Use a | |
# year/month tag to ensure we do refresh them occasionally. | |
DOCKER_TAG="docker.pkg.github.com/${GITHUB_REPOSITORY}/miniwdl_ci:$(date +%Y%m)" | |
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV | |
if docker pull "$DOCKER_TAG"; then | |
docker build -t "$DOCKER_TAG" --cache-from "$DOCKER_TAG" . | |
else | |
docker build -t "$DOCKER_TAG" . | |
fi | |
if [ "${{ matrix.ci_target }}" == "ci_housekeeping" ]; then | |
docker push "$DOCKER_TAG" || true # allow failure for third-party PRs | |
fi | |
- name: make ${{ matrix.ci_target }} | |
run: | | |
chmod -R ugo+rw . | |
# AWS_EC2_METADATA_DISABLED needed on Azure: https://github.com/aws/aws-cli/issues/5623 | |
docker run \ | |
--group-add $(stat -c %g /var/run/docker.sock) -v /var/run/docker.sock:/var/run/docker.sock \ | |
-v $(pwd):/home/wdler/miniwdl -v /tmp:/tmp \ | |
-e AWS_EC2_METADATA_DISABLED=true -e CI=true \ | |
"$DOCKER_TAG" make -C miniwdl ${{ matrix.ci_target }} | |
- name: Coveralls | |
if: ${{ matrix.ci_target == 'ci_unit_tests' }} | |
# https://github.com/coverallsapp/github-action/issues/30 | |
# https://github.com/marketplace/actions/coveralls-python | |
uses: AndreMiras/coveralls-python-action@develop | |
focal_self_test: | |
# run_self_test in a ubuntu:20.04 image with only the minimal runtime dependencies installed | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: docker build | |
run: | | |
mkdir focal_self_test | |
cp requirements.txt focal_self_test | |
cat << 'EOF' > focal_self_test/Dockerfile | |
FROM ubuntu:20.04 | |
ENV LC_ALL C.UTF-8 | |
ENV LANG C.UTF-8 | |
RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y python3-pip | |
RUN useradd -ms /bin/bash -u 1337 wdler | |
USER wdler | |
WORKDIR /home/wdler | |
RUN mkdir miniwdl | |
COPY requirements.txt /home/wdler/ | |
RUN pip3 install --user -r requirements.txt | |
ENV PYTHONPATH $PYTHONPATH:/home/wdler/.local/lib/python3.6 | |
ENV PATH $PATH:/home/wdler/.local/bin | |
# expectation -- mount miniwdl source tree at /home/wdler/miniwdl | |
CMD env -C miniwdl python3 -m WDL run_self_test | |
EOF | |
docker build -t miniwdl_focal_self_test focal_self_test | |
- name: miniwdl run_self_test | |
run: | | |
docker run \ | |
--group-add $(stat -c %g /var/run/docker.sock) -v /var/run/docker.sock:/var/run/docker.sock \ | |
-v $(pwd):/home/wdler/miniwdl -v /tmp:/tmp \ | |
-e AWS_EC2_METADATA_DISABLED=true \ | |
miniwdl_focal_self_test |