Skip to content

Hash pin workflows and enable dependabot (#177) #157

Hash pin workflows and enable dependabot (#177)

Hash pin workflows and enable dependabot (#177) #157

Workflow file for this run

name: Build Pacparser
on:
push:
branches: [master]
paths:
- 'src/**'
- '.github/workflows/build.yml'
pull_request:
workflow_dispatch:
inputs:
tag:
description: 'Tag to run workflow for'
required: true
permissions:
contents: read
jobs:
build:
strategy:
matrix:
os: [ubuntu, windows, macos]
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
if: ${{ !contains(github.event_name, 'workflow_dispatch') }}
with:
fetch-depth: 0
- name: Check out code for workflow_dispatch
if: ${{ contains(github.event_name, 'workflow_dispatch') }}
uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
with:
fetch-depth: 0
ref: ${{ github.event.inputs.tag }}
- name: make non-windows
if: ${{ matrix.os != 'windows' }}
run: make -C src
- name: make windows
if: ${{ matrix.os == 'windows' }}
run: make -C src -f Makefile.win32
- name: Get ref_name
id: get_ref_name
if: ${{ matrix.os != 'windows' }}
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "ref_name=${{ github.base_ref }}"
echo "ref_name=${{ github.base_ref }}" >> $GITHUB_OUTPUT || exit 1
else
echo "ref_name=${{ github.ref_name }}"
echo "ref_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT || exit 1
fi
- name: make non-windows dist
if: ${{ matrix.os != 'windows' }}
run: |
DIST_OS_SUFFIX=${{ matrix.os }} make -C src dist
ls -R src/*.zip
- name: make windows dist
if: ${{ matrix.os == 'windows' }}
run: |
make -C src -f Makefile.win32 dist
- name: Upload dist (non-windows)
if: ${{ matrix.os != 'windows' }}
uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # v2.3.1
with:
name: pacparser-dist
path: src/pacparser*.zip
- name: Upload dist (windows)
if: ${{ matrix.os == 'windows' }}
uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # v2.3.1
with:
name: pacparser-${{ matrix.os }}
path: src/dist
python-module-build:
strategy:
matrix:
os: [ubuntu, windows, macos]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
if: ${{ !contains(github.event_name, 'workflow_dispatch') }}
with:
fetch-depth: 0
- name: Check out code for workflow_dispatch
if: ${{ contains(github.event_name, 'workflow_dispatch') }}
uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
with:
fetch-depth: 0
ref: ${{ github.event.inputs.tag }}
- name: Set up Python
uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3.1.4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Set up setuptools
run: |
python --version
python -mpip install setuptools
- name: make non-windows
if: ${{ matrix.os != 'windows' }}
run: make -C src pymod-dist
- name: make windows
if: ${{ matrix.os == 'windows' }}
run: make -C src -f Makefile.win32 pymod-dist
- name: Upload dist
uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # v2.3.1
with:
name: pacparser-python-${{ matrix.python-version }}-${{ matrix.os }}-dist
path: src/pymod/pacparser-python*
- name: Build wheel non-linux
if: ${{ matrix.os != 'ubuntu' }}
run: |
python -m pip install wheel
cd src/pymod && python setup.py bdist_wheel
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
id: changes
with:
filters: |
src:
- 'src/**'
- name: Publish package to PyPI (non-linux)
if: ${{ (matrix.os != 'ubuntu') && (steps.changes.outputs.src == 'true') && (github.event_name != 'pull_request') }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI }}
run: |
python -m pip install twine
ls -R .
twine upload src/pymod/dist/*
build-linux-wheels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
if: ${{ !contains(github.event_name, 'workflow_dispatch') }}
with:
fetch-depth: 0
- name: Check out code for workflow_dispatch
if: ${{ contains(github.event_name, 'workflow_dispatch') }}
uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
with:
fetch-depth: 0
ref: ${{ github.event.inputs.tag }}
- name: Set env
run: echo "PACPARSER_VERSION=$(git describe --always --tags --candidate=100)" >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3.1.4
- name: Set up setuptools
run: |
python --version
python -mpip install setuptools
- name: make
run: make -C src pymod
- name: Build sdist
run: cd src/pymod && python setup.py sdist
- name: Install cibuildwheel and twine
run: python -m pip install cibuildwheel twine
- name: Build wheel using cibuildwheel
run: |
cp src/spidermonkey/libjs.a src/pacparser.o src/pacparser.h src/pymod
cd src/pymod && python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: 'cp{37,38,39,310,311}-manylinux*64'
CIBW_ENVIRONMENT: 'PACPARSER_VERSION=${{ env.PACPARSER_VERSION }}'
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
id: changes
with:
filters: |
src:
- 'src/**'
- name: Publish package to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/master' && steps.changes.outputs.src == 'true') }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI }}
run: |
twine upload src/pymod/dist/*