-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
97 additions
and
162 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: tests | ||
|
||
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: [macos-latest, ubuntu-latest, windows-latest] | ||
python-version: ["3.10", "3.12"] | ||
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: Update build tools | ||
run: python -m pip install --upgrade pip | ||
|
||
- name: Install Xnat-Ingest | ||
run: python -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: 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 Docker image tag from git tag | ||
run: | | ||
echo "DOCKER_IMAGE_TAG=$(git describe --tags --abbrev=0" >> $GITHUB_ENV | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache | ||
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max | ||
context: build | ||
platforms: linux/amd64,linux/arm64 | ||
push: ${{ github.event_name == 'release' }} | ||
tags: | | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.DOCKER_IMAGE_TAG }} | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest |
This file was deleted.
Oops, something went wrong.