Skip to content

Commit

Permalink
Transplant workflows from python-starlark-go (#174)
Browse files Browse the repository at this point in the history
* Transplant workflows from python-starlark-go

* Deal with not being src layout

* Try harder to cope with not being src layout

* No Go in this repo

* Make linter happy
  • Loading branch information
jordemort authored Aug 31, 2022
1 parent 2fe6c83 commit c052e0e
Show file tree
Hide file tree
Showing 9 changed files with 254 additions and 174 deletions.
136 changes: 0 additions & 136 deletions .github/workflows/build.yml

This file was deleted.

138 changes: 138 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: Build wheels

on:
pull_request:
push:
tags:
- "v*"

jobs:
# Build the source distribution for PyPI
build_sdist:
name: Build sdist
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Build sdist
run: |
python3.10 -m pip install --upgrade wheel
python3.10 setup.py sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

# Build binary distributions for PyPI
build_wheels:
name: Build ${{ matrix.build }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Windows isn't working right now: https://github.com/caketop/python-starlark-go/issues/4
# os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest]
build: [cp311, cp310, cp39, cp38, cp37, cp36]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-go@v3
if: runner.os != 'Linux'

- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/[email protected]

- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.build }}-*

- uses: actions/upload-artifact@v3
with:
path: wheelhouse/starlark_go-*.whl

# Create a GitHub release
github_release:
name: Create GitHub release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- name: "✏️ Generate release changelog"
id: changelog
uses: heinrichreimer/[email protected]
with:
filterByMilestone: false
onlyLastTag: true
pullRequests: true
prWoLabels: true
token: ${{ secrets.GITHUB_TOKEN }}
verbose: true

- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.changelog.outputs.changelog }}
files: dist/**/*

# Test PyPI
test_pypi_publish:
name: Test publishing to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true

# Publish to PyPI
pypi_publish:
name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/bumpr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Bump version
on:
push:
branches:
- main
pull_request:
types:
- labeled

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

# Bump version on merging Pull Requests with specific labels.
# (bump:major,bump:minor,bump:patch)
- uses: haya14busa/action-bumpr@v1
with:
github_token: ${{ secrets.BUMPR_TOKEN }}
67 changes: 33 additions & 34 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,55 +13,54 @@ name: "CodeQL"

on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [main]
schedule:
- cron: '24 5 * * 0'
- cron: "29 19 * * 4"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'cpp', 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
language: ["cpp", "python"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
- name: Build
run: |
python3.10 -m pip install --upgrade pip wheel
python3.10 setup.py build
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
Loading

0 comments on commit c052e0e

Please sign in to comment.