Merge pull request #1 from emotion3459/main #63
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Run Tests and Package" | |
on: | |
push: | |
pull_request: | |
jobs: | |
tests-linux: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
vs: ["58", "59", "latest"] | |
py: ["39", "310"] | |
arch: ["i686", "x86_64"] | |
steps: | |
- uses: actions/[email protected] | |
- uses: cachix/install-nix-action@v15 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: cachix/cachix-action@v10 | |
with: | |
name: vs-engine | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
- run: nix build -L .#checks.${{ matrix.arch }}-linux.check-python${{ matrix.py }}-vapoursynth${{ matrix.vs }} | |
tests-darwin: | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
vs: ["58", "59", "latest"] | |
py: ["39", "310"] | |
steps: | |
- uses: actions/[email protected] | |
- uses: cachix/install-nix-action@v15 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: cachix/cachix-action@v10 | |
with: | |
name: vs-engine | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
- run: nix build -L .#checks.x86_64-darwin.check-python${{ matrix.py }}-vapoursynth${{ matrix.vs }} | |
tests-windows: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
vs: ["58", "59"] | |
arch: ["x64", "x86"] | |
include: | |
- vs: "58" | |
python: "3.10" | |
- vs: "59" | |
python: "3.10" | |
steps: | |
- uses: actions/[email protected] | |
- name: Install Python ${{ matrix.python }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "${{ matrix.python }}" | |
architecture: "${{ matrix.arch }}" | |
- name: Installing dependencies | |
run: | | |
pip install flit | |
pip install vapoursynth==${{ matrix.vs }} vapoursynth_portable==${{ matrix.vs }} | |
flit install --user --pth-file | |
- name: Running Tests | |
run: | | |
python -m unittest discover -s ./tests/ -v | |
build: | |
runs-on: ubuntu-latest | |
needs: | |
- tests-linux | |
- tests-darwin | |
- tests-windows | |
steps: | |
# Set-up runner. | |
- uses: actions/[email protected] | |
- name: Set outputs | |
id: vars | |
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: Check outputs | |
run: echo ${{ steps.vars.outputs.sha_short }} | |
- uses: cachix/install-nix-action@v15 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: cachix/cachix-action@v10 | |
with: | |
name: vs-engine | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
# Replace the dirty-tag with the commit-id. | |
- if: "!(github.event_name == 'push' && contains(github.ref, 'refs/tags/'))" | |
run: | | |
cat pyproject.toml | sed 's/\(version = "\)\(.*\)+dirty\("\)/\1\2.dev0+${{ steps.vars.outputs.sha_short }}\3/g' > pyproject.toml.tagged | |
cat pyproject.toml.tagged | |
mv pyproject.toml.tagged pyproject.toml | |
# Remove the dirty-tag from the builder. | |
- if: "github.event_name == 'push' && contains(github.ref, 'refs/tags/')" | |
run: | | |
cat pyproject.toml | sed 's/\(version = "\)\(.*\)+dirty\("\)/\1\2\3/g' > pyproject.toml.tagged | |
cat pyproject.toml.tagged | |
mv pyproject.toml.tagged pyproject.toml | |
# Build the distribution. | |
- run: nix build -L .#dist | |
- run: | | |
mkdir dist | |
cp result/* dist | |
ls -lAh dist | |
- name: Archive distribution | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Packages | |
path: | | |
dist/**/* | |
publish: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: build | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: Packages | |
path: dist | |
- name: Install twine | |
run: | | |
pip install twine | |
- name: Upload VapourSynth | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
twine upload dist/* | |