renamed base logger back to 'logger' #92
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/CD | |
on: | |
push: | |
branches: [ main, develop ] | |
pull_request: | |
branches: [ main, develop ] | |
release: | |
types: [published] | |
defaults: | |
run: | |
shell: bash | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
test: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] # , macos-latest, windows-latest] | |
python-version: ["3.10", "3.11"] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Disable etelemetry | |
run: echo "NO_ET=TRUE" >> $GITHUB_ENV | |
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# - name: Install other dependencies | |
# run: | | |
# sudo apt-get update | |
# sudo apt-get install -y libxml2-dev libxslt-dev git dcmtk | |
- name: Install Minconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-activate-base: true | |
activate-environment: "" | |
- name: Install MRtrix via Conda | |
run: | | |
conda install -c mrtrix3 mrtrix3 | |
mrconvert --version | |
- name: Update build tools | |
run: python${{ matrix.python-version }} -m pip install --upgrade pip | |
- name: Install Xnat-Ingest | |
run: python${{ matrix.python-version }} -m pip install .[test] | |
- name: Save XNAT username/password in ~/.netrc | |
run: | | |
echo "machine localhost:8080" > $HOME/.netrc | |
echo "user admin" >> $HOME/.netrc | |
echo "password admin" >> $HOME/.netrc | |
- name: Pytest | |
run: pytest -vvs --cov xnat_ingest --cov-config .coveragerc --cov-report xml . | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
deploy: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Unset header | |
# checkout@v2 adds a header that makes branch protection report errors | |
# because the Github action bot is not a collaborator on the repo | |
run: git config --local --unset http.https://github.com/.extraheader | |
- name: Fetch tags | |
run: git fetch --prune --unshallow | |
- name: Set up Docker buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get version from latest git tag and construct image tags | |
id: versions | |
run: | | |
VERSION=$(git describe --tags --abbrev=0) | |
VERSION=${VERSION#v} | |
IMAGE=${{ env.REGISTRY }}/$(echo "${{ env.IMAGE_NAME }}" | awk '{print tolower($0)}') | |
echo "IMAGE=$IMAGE" >> $GITHUB_OUTPUT | |
echo "TAG=$IMAGE:$VERSION" >> $GITHUB_OUTPUT | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
cache-from: type=registry,ref=${{ steps.versions.outputs.IMAGE }}:buildcache | |
cache-to: type=registry,ref=${{ steps.versions.outputs.IMAGE }}:buildcache,mode=max | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name == 'release' }} | |
tags: | | |
${{ steps.versions.outputs.TAG }} | |
${{ steps.versions.outputs.IMAGE }}:latest |