From a23d6f68405e240be06dd1586fa98be038320bec Mon Sep 17 00:00:00 2001 From: P-O Quirion Date: Tue, 16 Jan 2024 12:44:22 -0500 Subject: [PATCH] Dev (#27) * Adding digest_unanalyzed route + debug Operation being linked to Readset when ingesting transfer and GenPipes * Using project rather than project_name or project_id in routes - test 1 * Need to convert project_id from name_to_id from list of int into str * Adding a new attribute for experiment: nucleic_acid_type * Accepting metric without flag set * Allowing job_status being null if job hasn't been submitted * Skipping null job during ingesting genpipes as we don't want files not generated * Build and push Image. Dockefile to Containerfile * Release container with latest_release tag on gitub release (#26) * Tag image on quay on releases * Update pyproject.toml to fix enum error message --------- Co-authored-by: Paul Stretenowich --- .github/workflows/build_image.yml | 38 +++++++++ .github/workflows/run_test.yml | 132 ++++++++++++++---------------- 2 files changed, 101 insertions(+), 69 deletions(-) create mode 100644 .github/workflows/build_image.yml diff --git a/.github/workflows/build_image.yml b/.github/workflows/build_image.yml new file mode 100644 index 0000000..f2b2b98 --- /dev/null +++ b/.github/workflows/build_image.yml @@ -0,0 +1,38 @@ +--- +name: Release +on: + release: + types: [published] + +env: + REGISTRY_USER: c3genomics+github_pusher + IMAGE_REGISTRY: quay.io + REGISTRY_PASSWORD: ${{ secrets.QUAY_ROBOT_TOKEN }} + IMAGE: c3genomics/project_tracking + LATEST_RELEASE: latest_release + +jobs: + build: + name: Release image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: set tag + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: pull release + run: | + # pull taged images and set to latest release + podman pull ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE }}:${{ env.RELEASE_VERSION }} + podman tag ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE }}:${{ env.RELEASE_VERSION }} \ + ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE }}:${{ env.LATEST_RELEASE }} + - name: Push to repo + uses: redhat-actions/push-to-registry@v2 + with: + username: ${{ env.REGISTRY_USER }} + password: ${{ env.REGISTRY_PASSWORD }} + registry: ${{ env.IMAGE_REGISTRY }} + image: ${{ env.IMAGE }} + tags: ${{ env.LATEST_RELEASE }} + - name: Print image url + run: echo "Image pushed to ${{ steps.push-to-repo.outputs.registry-paths }}" + diff --git a/.github/workflows/run_test.yml b/.github/workflows/run_test.yml index 14ad43c..84bf5d1 100644 --- a/.github/workflows/run_test.yml +++ b/.github/workflows/run_test.yml @@ -1,77 +1,71 @@ --- name: Tests suite on: - pull_request: - types: [opened, synchronize, reopened] - branches: - - 'main' - - 'dev' - push: - branches: - - 'main' - - 'dev' - - tags: - - '[0-9]+.[0-9]+.[0-9]+' + pull_request: + types: [opened, synchronize, reopened] + branches: ['main', 'dev'] + push: + tags: '[0-9]+.[0-9]+.[0-9]+' + branches: ['main', 'dev'] env: - REGISTRY_USER: c3genomics+github_pusher - IMAGE_REGISTRY: quay.io - REGISTRY_PASSWORD: ${{ secrets.QUAY_ROBOT_TOKEN }} - IMAGE: c3genomics/project_tracking + REGISTRY_USER: c3genomics+github_pusher + IMAGE_REGISTRY: quay.io + REGISTRY_PASSWORD: ${{ secrets.QUAY_ROBOT_TOKEN }} + IMAGE: c3genomics/project_tracking jobs: - test: - runs-on: ${{ matrix.os }} - strategy: - matrix: - python-version: ["3.11"] - os: [ubuntu-latest, macos-latest] + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + python-version: ["3.11"] + os: [ubuntu-latest, macos-latest] - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install .[tests] flake8 - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is - # 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 \ - --max-line-length=127 --statistics - - name: Test with pytest - run: | - pytest -v - build: - needs: test - if: startsWith(github.ref, 'refs/tags') - name: Build image - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: set tag - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - name: Buildah Action - uses: redhat-actions/buildah-build@v2 - with: - image: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE }} - tags: ${{ env.RELEASE_VERSION }} latest_release - containerfiles: ./Containerfile - - name: Push to repo - uses: redhat-actions/push-to-registry@v2 - with: - username: ${{ env.REGISTRY_USER }} - password: ${{ env.REGISTRY_PASSWORD }} - registry: ${{ env.IMAGE_REGISTRY }} - image: ${{ env.IMAGE }} - tags: ${{ env.RELEASE_VERSION }} latest_release - - name: Print image url - run: echo "Image pushed to ${{ steps.push-to-repo.outputs.registry-paths }}" - + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install .[tests] flake8 + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is + # 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 \ + --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest -v + build: + needs: test + if: startsWith(github.ref, 'refs/tags') + name: Build image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: set tag + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Buildah Action + uses: redhat-actions/buildah-build@v2 + with: + image: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE }} + tags: ${{ env.RELEASE_VERSION }} + containerfiles: ./Containerfile + - name: Push to repo + uses: redhat-actions/push-to-registry@v2 + with: + username: ${{ env.REGISTRY_USER }} + password: ${{ env.REGISTRY_PASSWORD }} + registry: ${{ env.IMAGE_REGISTRY }} + image: ${{ env.IMAGE }} + tags: ${{ env.RELEASE_VERSION }} + - name: Print image url + run: echo "Image pushed to ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE }}:${{ env.RELEASE_VERSION }}" + \ No newline at end of file