Unverified Commit 59be1fe3 authored by Duggan, John's avatar Duggan, John Committed by GitHub
Browse files

Merge pull request #26 from nova-model/ci

Use GitHub CI
parents b7a609ac 1bb48d0a
Loading
Loading
Loading
Loading
Loading
+48 −0
Original line number Diff line number Diff line
name: Build and Test

on: push

concurrency:
  group: "${{ github.ref }}"
  cancel-in-progress: true

env:
  NDIP_DOCKER_REPOSITORY: "${{ secrets.NDIP_DOCKER_REPOSITORY }}"
  READTHEDOCS_WEBHOOK_URL: "${{ secrets.READTHEDOCS_WEBHOOK_URL }}"
  READTHEDOCS_WEBHOOK_SECRET: "${{ secrets.READTHEDOCS_WEBHOOK_SECRET }}"

jobs:
  build-and-test:
    runs-on: ubuntu-latest
    timeout-minutes: 60
    env:
      GIT_STRATEGY: clone
      IMAGE_NAME: "${NDIP_DOCKER_REPOSITORY}/${{ github.repository }}"
    steps:
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3
      - name: Checkout repo
        uses: actions/checkout@v4
        with:
          fetch-depth: 20
          lfs: true
      - name: Build
        uses: docker/build-push-action@v6
        id: build
        with:
          file: dockerfiles/Dockerfile
          load: true
      - name: Run ruff check
        run: docker run --rm ${{ steps.build.outputs.imageid }} poetry run ruff check
      - name: Run format check
        run: docker run --rm ${{ steps.build.outputs.imageid }} poetry run ruff format --check
      - name: Run mypy
        run: docker run --rm ${{ steps.build.outputs.imageid }} poetry run mypy .
      - name: Unit tests
        run: docker run --rm ${{ steps.build.outputs.imageid }} poetry run pytest
      - name: Run coverage
        run: docker run --rm ${{ steps.build.outputs.imageid }} sh -c "poetry run coverage run && poetry run coverage report"
      - name: Docs test
        run: docker run --rm ${{ steps.build.outputs.imageid }} bash build_docs.sh
+61 −0
Original line number Diff line number Diff line
name: Publish Package

on: workflow_dispatch

concurrency:
  group: "${{ github.ref }}"
  cancel-in-progress: true

env:
  PYPI_API_TOKEN: "${{ secrets.PYPI_API_TOKEN }}"

jobs:
  tag-release:
    runs-on: ubuntu-latest
    timeout-minutes: 60
    permissions: write-all
    env:
      GIT_STRATEGY: clone
      IMAGE_NAME: "${NDIP_DOCKER_REPOSITORY}/${{ github.repository }}"
    steps:
      - name: Checkout repo
        uses: actions/checkout@v4
        with:
          fetch-depth: 20
          lfs: true
      - name: Parse version
        run: echo "VERSION=$(cat pyproject.toml | grep "version =" | head -n 1 | awk '{ print $3 }' | tr -d '"')" >> $GITHUB_ENV
      - name: Create release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ env.VERSION }}
          release_name: ${{ env.VERSION }}

  publish-package:
    needs: tag-release
    runs-on: ubuntu-latest
    if: github.event_name == 'workflow_dispatch'
    timeout-minutes: 60
    env:
      GIT_STRATEGY: clone
      IMAGE_NAME: "${NDIP_DOCKER_REPOSITORY}/${{ github.repository }}"
    steps:
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3
      - name: Checkout repo
        uses: actions/checkout@v4
        with:
          fetch-depth: 20
          lfs: true
      - name: Build
        uses: docker/build-push-action@v6
        id: build
        with:
          file: dockerfiles/Dockerfile
          load: true
      - name: Publish
        run: docker run --rm ${{ steps.build.outputs.imageid }} poetry publish -u __token__ -p ${PYPI_API_TOKEN}
+1 −1
Original line number Diff line number Diff line
FROM --platform=amd64 regproxy.ornl.gov/hub_proxy/python:3.10-slim AS source
FROM --platform=amd64 python:3.10-slim AS source

RUN apt-get update && apt-get install -y qt6-base-dev