got half of issues with external script for polling worked out. #41
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
name: build | |
on: | |
push: | |
paths: | |
- "*.py" | |
- "**/pyproject.toml" | |
- "**/*.py" | |
- .github/workflows/build.yaml | |
- "**/*.go" | |
env: | |
PYTHON_VERSION: "3.11" | |
POETRY_VERSION: "1.4.2" | |
jobs: | |
build-go: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Build everything | |
run: cd go/src/github.com/broadinstitute/sparklesworker && go build -v ./... | |
- name: build executable | |
run: bash scripts/build-static-exe.sh | |
- name: print md5sum | |
run: md5sum cli/sparklespray/bin/sparklesworker && ls -s cli/sparklespray/bin/sparklesworker | |
- name: Upload executable | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sparklesworker-exe-${{ github.run_number }} | |
path: cli/sparklespray/bin/sparklesworker | |
retention-days: 5 | |
# - name: Test | |
# run: cd go/src/github.com/broadinstitute/sparklesworker && go test -v ./... | |
test-python: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
# the following logic for caching taken from https://gist.github.com/gh640/233a6daf68e9e937115371c0ecd39c61 | |
# Poetry cache depends on OS, Python version and Poetry version. | |
- name: Cache Poetry cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pypoetry | |
key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }} | |
# virtualenv cache should depends on OS, Python version and `poetry.lock` (and optionally workflow files). | |
- name: Cache Packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.local | |
key: poetry-local-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }} | |
- name: Set up poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- name: Install dependencies | |
run: poetry install | |
working-directory: cli | |
- name: Run pyratchet | |
working-directory: cli | |
run: poetry run pyright-ratchet run pyright | |
- name: Run tests | |
run: poetry run pytest | |
working-directory: cli | |
build-package: | |
needs: [test-python, build-go] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
# the following logic for caching taken from https://gist.github.com/gh640/233a6daf68e9e937115371c0ecd39c61 | |
# Poetry cache depends on OS, Python version and Poetry version. | |
- name: Cache Poetry cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pypoetry | |
key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }} | |
# virtualenv cache should depends on OS, Python version and `poetry.lock` (and optionally workflow files). | |
- name: Cache Packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.local | |
key: poetry-local-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }} | |
- name: Set up poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- name: Download executable | |
uses: actions/download-artifact@v3 | |
with: | |
name: sparklesworker-exe-${{ github.run_number }} | |
path: cli/sparklespray/bin | |
- name: print md5sum | |
run: md5sum cli/sparklespray/bin/sparklesworker && ls -s cli/sparklespray/bin/sparklesworker | |
- name: get package version | |
run: (echo -n 'package_version=' && poetry version -s) >> "$GITHUB_ENV" | |
working-directory: cli | |
- name: Build package | |
run: poetry build | |
working-directory: cli | |
# - name: debug info | |
# run: find . -print && ls -l dist && ls -l sparkles/bin | |
# working-directory: cli | |
- name: Upload sparklespray-${{ env.package_version }}.tar.gz package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sparklespray-${{ env.package_version }} | |
path: cli/dist/sparklespray-*.tar.gz | |
retention-days: 5 | |