Skip to content

Commit

Permalink
Merge pull request #66 from zapatacomputing/dev
Browse files Browse the repository at this point in the history
Merge dev to main
  • Loading branch information
mstechly authored Apr 22, 2022
2 parents 09ec5d2 + a52677d commit 35b778e
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 9 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ github_actions-default:

# For some reason, mypy fails unless we re-install ruamel.yaml.
${VENV}/bin/python3 -m pip uninstall -y ruamel.yaml
${VENV}/bin/python3 -m pip install ruamel.yaml
${VENV}/bin/python3 -m pip install ruamel.yaml

build-system-deps:
$(PYTHON) -m pip install setuptools wheel "setuptools_scm>=6.0"
6 changes: 6 additions & 0 deletions subtrees/z_quantum_actions/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
################################################################################
# © Copyright 2021-2022 Zapata Computing Inc.
################################################################################
TOP_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
include $(TOP_DIR)/variables.mk

Expand Down Expand Up @@ -82,6 +85,9 @@ style-default: flake8 mypy black isort
muster-default: style coverage
@echo This project passes muster!

build-system-deps-default:
:

# This is what converts the -default targets into base target names.
# Do not remove!!!
%: %-default
Expand Down
40 changes: 37 additions & 3 deletions subtrees/z_quantum_actions/actions/publish-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,46 @@ runs:
git push --tags
echo "::set-output name=tag::$TAG"
# Use pip to build a PEP 517 wheel
- name: Build wheel
id: build-wheel
shell: bash
run: python3 -m pip wheel --isolated --no-deps -w dist .

# Upload all artifacts in dist
- name: Store wheel artifacts
uses: actions/upload-artifact@v2
with:
name: Python Wheels
path: dist

- name: Create entry on GH Releases
id: make-release
shell: bash
run: |
curl \
# When we make a release, we should check the response for the "upload_url"
API_RESPONSE=$(curl \
-X POST \
curl -H "Authorization: token ${{ github.token }}" \
-H "Authorization: token ${{ github.token }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/releases \
-d '{"tag_name":"${{ steps.push-new-version-tag.outputs.tag }}"}'
-d '{"tag_name":"${{ steps.push-new-version-tag.outputs.tag }}"}')
# The URL from github has some extras in curly brackets that we do not want:
# The URL always ends in assets, so we can use that to help check for the end
UPLOAD_URL=$(echo ${API_RESPONSE} | jq .upload_url | sed "s/\(.*assets\){.*}/\1/")
echo "::set-output name=upload_url::${UPLOAD_URL}"
- name: Upload wheel to release page
shell: bash
run: |
# We don't know the wheel name, so we can check for everything in the dist dir
# We may build multiple wheels from a single repo, so this works for that too.
for wheel in dist/*; do
curl \
-X POST \
-H "Authorization: token ${{ github.token }}" \
-H "Accept: application/vnd.github.v3+json" \
-H "Content-Type: $(file -b --mime-type $wheel)" \
-T "$wheel" \
"${{ steps.make-release.outputs.upload_url }}?name=$(basename $wheel)"
done
3 changes: 3 additions & 0 deletions subtrees/z_quantum_actions/bin/get_next_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#! /usr/bin/env python3
################################################################################
# © Copyright 2022 Zapata Computing Inc.
################################################################################

# This script ia intended to be run from within a Github Action.
# Reads current project version, bumps "minor", and sets the "next_version" output
Expand Down
3 changes: 3 additions & 0 deletions subtrees/z_quantum_actions/sample_setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env python
################################################################################
# © Copyright 2021-2022 Zapata Computing Inc.
################################################################################

import site
import sys
Expand Down
3 changes: 3 additions & 0 deletions subtrees/z_quantum_actions/setup_extras.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
################################################################################
# © Copyright 2021-2022 Zapata Computing Inc.
################################################################################
extras = {
# Development extras needed in every project, because the stylechecks depend on it.
# If you need more dev deps, extend this list in your own setup.py.
Expand Down
3 changes: 3 additions & 0 deletions subtrees/z_quantum_actions/tests/test_get_next_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
################################################################################
# © Copyright 2022 Zapata Computing Inc.
################################################################################
import re
import subprocess

Expand Down
2 changes: 1 addition & 1 deletion subtrees/z_quantum_actions/workflow-templates/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: actions/checkout@v2

# ------------------------------------------------------------------------
# Loads private SSH key to the SSH agent. Allows to install dependencies
# Loads private SSH key to the SSH agent. Allows to install dependencies
# from private git repos, but requires setting `secrets.SSH_PRIVATE_KEY`
# in repo settings.
# ------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
run-action:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion subtrees/z_quantum_actions/workflow-templates/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: actions/checkout@v2

# ------------------------------------------------------------------------
# Loads private SSH key to the SSH agent. Allows to install dependencies
# Loads private SSH key to the SSH agent. Allows to install dependencies
# from private git repos, but requires setting `secrets.SSH_PRIVATE_KEY`
# in repo settings.
# ------------------------------------------------------------------------
Expand Down

0 comments on commit 35b778e

Please sign in to comment.