Skip to content

Commit

Permalink
Start working on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mara004 committed Oct 30, 2023
1 parent 1565920 commit 3920ae5
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 12 deletions.
111 changes: 111 additions & 0 deletions .github/workflows/conda.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# SPDX-FileCopyrightText: 2023 geisserml <geisserml@gmail.com>
# SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause

name: Conda packaging
on:
workflow_dispatch:
inputs:
publish:
default: false
type: boolean
test:
default: true
type: boolean
py_version:
default: '3.11'
type: string
package:
type: choice
options:
- raw
- helpers

defaults:
run:
shell: bash

jobs:

build:

runs-on: ubuntu-latest
steps:

- name: Check out repository
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
fetch-depth: 0

- name: Miniconda setup
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ inputs.py_version }}

- name: Prepare deps
run: |
conda install -y conda-build anaconda-client
conda config --prepend channels bblanchon
conda config --prepend channels pypdfium2-team
conda config --set channel_priority strict
- name: Build package
run: ./run craft conda_${{ inputs.package }}

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: conda_package
path: conda/${{ inputs.package }}/out/*.tar.bz2

test:

if: ${{ inputs.test }}
needs: build

strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
py: ['3.8', '3.9', '3.10', '3.11']

runs-on: ${{ matrix.os }}

steps:

- name: Check out repository
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}

- name: Miniconda setup
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.py }}

- name: Prepare deps
run: |
conda config --prepend channels bblanchon
conda config --set channel_priority strict
- name: Download packages
uses: actions/download-artifact@v3
with:
name: conda_package
path: conda/${{ inputs.package }}/out/

- name: Install
run: conda install -c local -c bblanchon -c pypdfium2-team conda/${{ inputs.package }}/out/*.tar.bz2

- name: Test raw package
if: inputs.package == 'raw'
run: python3 conda/raw/minitest.py

- name: Test helpers package
if: inputs.package == 'raw'
run: ./run test

# publish:
# TODO
1 change: 1 addition & 0 deletions .github/workflows/conda_bundle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

4 changes: 0 additions & 4 deletions .github/workflows/gh_pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ concurrency:
group: "pages"
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:

build:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: 2023 geisserml <geisserml@gmail.com>
# SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause

name: Build Packages
name: Main packaging
on:
workflow_dispatch:
inputs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_release.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: 2023 geisserml <geisserml@gmail.com>
# SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause

name: Test Release
name: Test PyPI Release
on:
workflow_dispatch:
inputs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/trigger_conda_raw.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Separate trigger workflow because we can't configure inputs for scheduled workflow runs (and don't want publish enabled by default in the main workflow)

name: Trigger Release
name: Trigger main release
on:
# https://github.com/bblanchon/pdfium-binaries/blob/master/.github/workflows/trigger.yml
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
Expand All @@ -13,10 +13,6 @@ on:
# - cron: '0 4 * * 2' # old weekly schedule
workflow_dispatch:

defaults:
run:
shell: bash

jobs:

release:
Expand Down
3 changes: 2 additions & 1 deletion setupsrc/pypdfium2_setup/craft_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
P_CONDA_RAW = "conda_raw"
P_CONDA_HELPERS = "conda_helpers"

CondaChannels = ("-c", "local", "-c", "bblanchon", "-c", "pypdfium2-team")
CondaDir = ProjectDir / "conda"


Expand Down Expand Up @@ -109,7 +110,7 @@ def __exit__(self, *_):

def run_conda_build(recipe_dir, out_dir, args=[]):
with TmpCommitCtx():
run_cmd(["conda", "build", recipe_dir, "--output-folder", out_dir, *args], cwd=ProjectDir, env=os.environ)
run_cmd(["conda", "build", *CondaChannels, recipe_dir, "--output-folder", out_dir, *args], cwd=ProjectDir, env=os.environ)


CondaNames = {
Expand Down

0 comments on commit 3920ae5

Please sign in to comment.