ci: create devcontainer for github codespaces (#3) #23
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: Bioconda | |
| # This workflow can be used to maintain a bioconda recipe in the original repository of a package | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| # Publish semver tags as releases. | |
| tags: [ 'v*.*.*' ] | |
| paths-ignore: | |
| - 'README.md' | |
| pull_request: | |
| branches: [ "main" ] | |
| paths-ignore: | |
| - 'README.md' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-15-intel, macos-latest, ubuntu-24.04-arm] | |
| packagename: ["hipstr2"] | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v6 | |
| - name: Setup Miniforge | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| activate-environment: biobuild | |
| channels: conda-forge,bioconda,defaults | |
| miniforge-version: latest | |
| use-mamba: true | |
| - name: Get Date | |
| id: get-date | |
| run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Cache Conda env | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ env.CONDA }}/envs | |
| key: | |
| conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ env.CACHE_NUMBER }} | |
| env: | |
| # Increase this value to reset cache if needed | |
| CACHE_NUMBER: 0 | |
| id: cache | |
| - name: Install biobuild environment | |
| shell: bash -el {0} | |
| run: | |
| mamba create -y -n biobuild -c conda-forge -c bioconda -c nodefaults bioconda-utils | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| - name: Set package metadata | |
| run: | | |
| # TODO: set this to capture the version number dynamically | |
| VERSION="$(grep 'version:' _config.yml | awk -F': *' '{print $2}')" | |
| VCOMMIT="${{ github.sha }}" | |
| SHA256="$(curl -sL "${{ github.server_url }}/${{ github.repository }}/archive/${{ github.sha }}.tar.gz" | shasum -a 256 | cut -d " " -f 1)" | |
| USERNAME=$(cut -d/ -f1 <<< "${{ github.repository }}") | |
| echo $VERSION $VCOMMIT $SHA256 $USERNAME | |
| sed -i.bak 's/"VERSION"/"'"$VERSION"'"/;s/"VCOMMIT"/"'"$VCOMMIT"'"/;s/"SHA256"/"'"$SHA256"'"/;s/"USERNAME"/"'"$USERNAME"'"/' recipes/${{ matrix.packagename }}/meta.yaml | |
| rm recipes/${{ matrix.packagename }}/meta.yaml.bak | |
| - name: Create config.yml file | |
| run: | | |
| echo -e "channels:\n - conda-forge\n - bioconda\n - defaults" > config.yml | |
| - name: Lint | |
| shell: bash -el {0} | |
| if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
| run: | | |
| bioconda-utils lint --packages ${{ matrix.packagename }} | |
| - name: Run test | |
| shell: bash -el {0} | |
| run: | | |
| bioconda-utils build ${{ (startsWith(matrix.os, 'ubuntu') && format('--docker --mulled-test{0}', (endsWith(matrix.os, '-arm') && ' --docker-base-image quay.io/bioconda/bioconda-utils-build-env-cos7-aarch64') || '')) || '' }} --packages ${{ matrix.packagename }} | |
| mkdir -p ext | |
| cph x ${{ env.CONDA }}/envs/biobuild/conda-bld/*/*.conda --dest ext | |
| mv ext/bin/HipSTR HipSTR-${{ matrix.os }} | |
| - name: Upload built package as GitHub artifact | |
| id: artifact-upload | |
| uses: "actions/upload-artifact@v7" | |
| with: | |
| name: HipSTR-${{ matrix.os }} | |
| archive: false | |
| path: HipSTR-${{ matrix.os }} | |
| if-no-files-found: 'ignore' |