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 31, 2023
1 parent 1565920 commit df8a074
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 12 deletions.
118 changes: 118 additions & 0 deletions .github/workflows/conda.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# SPDX-FileCopyrightText: 2023 geisserml <[email protected]>
# 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
default: raw
options:
- raw
- helpers

defaults:
run:
shell: bash -el {0}

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 }}
channels: bblanchon,pypdfium2-team
channel-priority: strict

- name: Prepare
run: |
conda install -y conda-build conda-verify
git config --global user.email "[email protected]"
git config --global user.name "geisserml"
python3 -VV
python3 -m pip install -U -r req/setup.txt
- 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/noarch/*.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 }}
channels: bblanchon,pypdfium2-team
channel-priority: strict

- name: Download packages
uses: actions/download-artifact@v3
with:
name: conda_package
path: conda/transfer/

- name: Prepare
run: |
ls -l conda/transfer/
conda install -c bblanchon pdfium-binaries
conda install conda/transfer/*.tar.bz2
python3 -VV
- name: Test raw package
if: inputs.package == 'raw'
run: python3 conda/raw/minitest.py

- name: Test helpers package
if: inputs.package == 'helpers'
run: |
python3 -m pip install -U -r req/default.txt
./run test
# publish:
# TODO
15 changes: 15 additions & 0 deletions .github/workflows/conda_bundle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: 2023 geisserml <[email protected]>
# SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause

# TODO

name: Conda bundled
on:
workflow_dispatch:

jobs:
pass:
runs-on: ubuntu-latest
steps:
- name: Pass (TODO)
run: echo "TODO"
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 <[email protected]>
# 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 <[email protected]>
# SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause

name: Test Release
name: Test PyPI Release
on:
workflow_dispatch:
inputs:
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/trigger_conda_raw.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: 2023 geisserml <[email protected]>
# SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause

# TODO

name: Trigger conda_raw release
on:
workflow_dispatch:

jobs:
pass:
runs-on: ubuntu-latest
steps:
- name: Pass (TODO)
run: echo "TODO"
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", "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 df8a074

Please sign in to comment.