Initial commits - use pixi, slight restructure and refactor #8
Workflow file for this run
This file contains hidden or 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: Tests, Package, and Deployment | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: [next, qa, main] | |
| tags: ["v*"] | |
| # cancel previous job if new commit is pushed | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| PKG_NAME: dgs_resolution | |
| jobs: | |
| ################# | |
| ### Run Tests ### | |
| ################# | |
| tests: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Pixi | |
| uses: prefix-dev/setup-pixi@v0.9.4 | |
| # - name: Install chromium | |
| # run: | | |
| # echo "chromium enables testing HTML reports" | |
| # sudo apt-get install --yes chromium-browser | |
| # - name: Run unit tests | |
| # run: | | |
| # pixi run test -vv -m "not datarepo and not sns_mounted" --cov=src --cov-report=xml --cov-report=term-missing tests/ | |
| # mv .coverage .coverage.unit | |
| # - name: Run integration tests | |
| # run: | | |
| # git submodule update --init | |
| # pixi run test -vv -m "datarepo" --cov=src --cov-report=xml --cov-report=term-missing tests/ | |
| # mv .coverage .coverage.integration | |
| # - name: Upload coverage to codecov | |
| # uses: codecov/codecov-action@v5 | |
| # with: | |
| # token: ${{ secrets.CODECOV_TOKEN }} | |
| ############################## | |
| ### Package and Deployment ### | |
| ############################## | |
| build: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 100 | |
| fetch-tags: true | |
| ref: ${{ github.ref }} | |
| - name: Setup Pixi | |
| uses: prefix-dev/setup-pixi@v0.9.4 | |
| - name: Build conda package | |
| run: | | |
| pixi run conda-build | |
| mkdir -p /tmp/local-channel/linux-64 | |
| cp ${{ env.PKG_NAME }}-*.conda /tmp/local-channel/linux-64/ | |
| - name: Verify Conda Package | |
| uses: neutrons/conda-verify@main | |
| with: | |
| python-version: "3.11" | |
| local-channel: /tmp/local-channel | |
| package-name: ${{ env.PKG_NAME }} | |
| # Upload the conda package for job "publish" to use later | |
| - name: upload conda package as artifact | |
| uses: actions/upload-artifact@v6 | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| with: | |
| name: artifact-conda-package | |
| path: ${{ env.PKG_NAME }}-*.conda | |
| # Publish the package as a separate job so that the Github Actions webpage | |
| # shows it as a separate step in the CI workflow | |
| publish: | |
| runs-on: ubuntu-latest | |
| needs: [tests, build] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 100 | |
| fetch-tags: true | |
| ref: ${{ github.ref }} | |
| - name: Setup Pixi | |
| uses: prefix-dev/setup-pixi@v0.9.4 | |
| - name: Download conda package artifact | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: artifact-conda-package | |
| - name: Upload package to anaconda | |
| env: | |
| ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
| IS_RC: ${{ contains(github.ref, 'rc') }} | |
| run: | | |
| # label is main or rc depending on the tag-name | |
| CONDA_LABEL="main" | |
| if [ "${IS_RC}" = "true" ]; then CONDA_LABEL="rc"; fi | |
| echo pushing ${{ github.ref }} with label $CONDA_LABEL | |
| pixi run anaconda upload --label $CONDA_LABEL --user neutrons ${{ env.PKG_NAME }}-*.conda | |
| # Trigger GitLab dev deploy pipeline | |
| deploy-dev: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.ref == 'refs/heads/next' | |
| steps: | |
| - name: Get Environment Name | |
| uses: neutrons/branch-mapper@main | |
| id: env_name | |
| with: | |
| prefix: mr_reduction | |
| - name: Trigger Dev Deploy | |
| # use https://github.com/eic/trigger-gitlab-ci/pull/14 until merged | |
| uses: eic/trigger-gitlab-ci@d984d8d53d871d2fdc1325639d94322da6e8747f | |
| id: trigger | |
| with: | |
| url: https://code.ornl.gov | |
| project_id: 20403 | |
| ref_name: main | |
| token: ${{ secrets.GITLAB_DEPLOY_TOKEN }} | |
| - name: Annotate commit | |
| uses: peter-evans/commit-comment@v4 | |
| with: | |
| body: | | |
| GitLab pipeline for ${{ steps.env_name.outputs.name }} has been submitted for this commit: ${{ steps.trigger.outputs.web_url }} |