From c0b29f882306415dc3db46fe6a3eb59d7662b234 Mon Sep 17 00:00:00 2001 From: Jeffrey Aven Date: Tue, 24 Oct 2023 14:18:48 +1100 Subject: [PATCH] updated workflow --- .devcontainer/Dockerfile | 22 ------------ .github/ISSUE_TEMPLATE/bug_report.md | 38 ++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 +++++++++++ .github/ISSUE_TEMPLATE/question.md | 15 ++++++++ .github/workflows/main.yml | 37 ++++++++++++++++++++ Dockerfile | 23 +++++++++++++ README.md | 7 ++++ notebooks/github.ipynb | 42 ++++++++++++++++++++++- 8 files changed, 181 insertions(+), 23 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/question.md create mode 100644 .github/workflows/main.yml create mode 100644 Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 3c1dae0..e69de29 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,22 +0,0 @@ -FROM stackql/stackql:latest AS stackql -FROM mcr.microsoft.com/devcontainers/universal:2 -COPY --from=stackql /srv/stackql/stackql /usr/local/bin/stackql -# set up matplotlib temp dir -RUN mkdir -p /tmp/matplotlib -RUN chmod 777 /tmp/matplotlib -ENV MPLCONFIGDIR=/tmp/matplotlib -ENV PYDEVD_DISABLE_FILE_VALIDATION=1 -ENV PYTHON_PACKAGES="\ - pystackql \ - matplotlib \ - pandas \ - mplfinance \ - psycopg2-binary \ - nest_asyncio \ - plotly \ - ipytree \ - nbformat \ - networkx \ -" -RUN pip install --upgrade pip \ - && pip install --no-cache-dir $PYTHON_PACKAGES \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..cb1b096 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '[BUG]' +labels: 'bug' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..c5b3a85 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: "[FEATURE]" +labels: enhancement +assignees: '' + +--- + +**Feature Description** +A clear and concise description of what you want to happen. + +**Example(s)** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Possible Approaches or Libraries to Consider** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 0000000..5a55f41 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,15 @@ +--- +name: Question +about: Pose a question to the StackQL team +title: "[QUESTION]" +labels: question +assignees: '' + +--- + + +## Question + +This channel is an opportunity to ask ad-hoc questions to the `stackql` team. This channel is in lieu of an official platform for ongoing discussions and questions. Please ask your question :) + +**Note**: Questions over github issues will be deprecated and retired once we settle on a platform / process ongoing. \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..a22f266 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,37 @@ +name: Build and Publish + +on: + push: + branches: [main] + pull_request: + +jobs: + build-and-push-docker-image: + name: Build Docker image and push to repositories + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build image and push to Docker Hub and GitHub Container Registry + uses: docker/build-push-action@v2 + with: + context: . + tags: | + stackql/stackql-codespaces-base:latest + stackql/stackql-codespaces-base:${{github.sha}} + # build on feature branches, push only on main branch + push: ${{ github.ref == 'refs/heads/main' }} + + - name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8e96852 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +# dev container image for GitHub Codespaces +FROM stackql/stackql:latest AS stackql +FROM mcr.microsoft.com/devcontainers/universal:2 +COPY --from=stackql /srv/stackql/stackql /usr/local/bin/stackql +# set up matplotlib temp dir +RUN mkdir -p /tmp/matplotlib +RUN chmod 777 /tmp/matplotlib +ENV MPLCONFIGDIR=/tmp/matplotlib +ENV PYDEVD_DISABLE_FILE_VALIDATION=1 +ENV PYTHON_PACKAGES="\ + pystackql \ + matplotlib \ + pandas \ + mplfinance \ + psycopg2-binary \ + nest_asyncio \ + plotly \ + ipytree \ + nbformat \ + networkx \ +" +RUN pip install --upgrade pip \ + && pip install --no-cache-dir $PYTHON_PACKAGES \ No newline at end of file diff --git a/README.md b/README.md index e69de29..e7d5164 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,7 @@ +[![StackQL](https://stackql.io/img/stackql-logo-bold.png)](https://stackql.io/) +
+[![GitHub Actions](https://github.com/stackql/stackql-codespaces-notebook/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/stackql/stackql-codespaces-notebook/actions/workflows/main.yml) +![License](https://img.shields.io/github/license/stackql/stackql) + +# stackql-codespaces-notebook + diff --git a/notebooks/github.ipynb b/notebooks/github.ipynb index c3a9976..202c953 100644 --- a/notebooks/github.ipynb +++ b/notebooks/github.ipynb @@ -11,6 +11,15 @@ "%load_ext pystackql.magic" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%stackql registry pull github" + ] + }, { "cell_type": "code", "execution_count": null, @@ -19,7 +28,16 @@ }, "outputs": [], "source": [ - "org = \"stackql\"" + "org = \"stackql\"\n", + "owner = \"stackql\"\n", + "repo = \"stackql\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Stargazers per Repo" ] }, { @@ -47,6 +65,28 @@ "source": [ "_.plot(kind='bar', title='Stargazers', x='name', y='stargazers_count')" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Repo Contributors who Arent Stargazers" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%%stackql\n", + "SELECT c.login as contrtibutor FROM \n", + "github.repos.contributors c\n", + "LEFT OUTER JOIN github.activity.repo_stargazers s\n", + "ON s.login = c.login\n", + "WHERE owner = '$owner' AND repo = '$repo'\n", + "AND s.login IS NULL" + ] } ], "metadata": {