Skip to content

add dependencies field in distribution #151

add dependencies field in distribution

add dependencies field in distribution #151

Workflow file for this run

name: CI
on:
push:
pull_request:
release:
types: [released]
defaults:
run:
shell: pwsh
jobs:
package:
runs-on: ubuntu-latest
env:
PYTHONUTF8: 1
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.12"
- name: Build
run: |
python -m pip install build
python -m build
- name: Upload package artifacts
uses: actions/upload-artifact@v4
with:
name: package
path: ./dist
- name: Prepare
run: |
python -m pip install ./dist/*.whl
aexpy --help
mkdir -p ./cache
- name: Test Preprocess
run: |
aexpy -vvv preprocess -r -p generator-oj-problem@0.0.1 ./cache ./cache/distribution1.json
aexpy -vvv preprocess -r -p generator-oj-problem@0.0.2 ./cache ./cache/distribution2.json
- name: Test Extraction
continue-on-error: false
run: |
aexpy -vvv extract ./cache/distribution1.json ./cache/api1.json
aexpy -vvv extract ./cache/distribution2.json ./cache/api2.json
- name: Test Difference
continue-on-error: false
run: |
aexpy -vvv diff ./cache/api1.json ./cache/api2.json ./cache/diff.json
- name: Test Report
continue-on-error: false
run: |
aexpy -vvv report ./cache/diff.json ./cache/report.json
- name: Test View
continue-on-error: false
run: |
aexpy -vvv view ./cache/distribution1.json
aexpy -vvv view ./cache/distribution2.json
aexpy -vvv view ./cache/api1.json
aexpy -vvv view ./cache/api2.json
aexpy -vvv view ./cache/diff.json
aexpy -vvv view ./cache/report.json
- name: Upload results
uses: actions/upload-artifact@v4
with:
name: package-cache
path: ./cache
image:
runs-on: ubuntu-latest
env:
PYTHONUTF8: 1
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v4
with:
python-version: '3.12'
architecture: 'x64'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
run: |
docker build -t aexpy/aexpy .
- name: Prepare
run: |
docker run aexpy/aexpy --help
mkdir -p ./cache
- name: Test Preprocess
run: |
docker run -v ${{ github.workspace }}/cache:/data aexpy/aexpy -vvv preprocess -r -p generator-oj-problem@0.0.1 /data /data/distribution1.json
docker run -v ${{ github.workspace }}/cache:/data aexpy/aexpy -vvv preprocess -r -p generator-oj-problem@0.0.2 /data /data/distribution2.json
- name: Test Extraction
continue-on-error: false
run: |
docker run -v ${{ github.workspace }}/cache:/data aexpy/aexpy -vvv extract /data/distribution1.json /data/api1.json
docker run -v ${{ github.workspace }}/cache:/data aexpy/aexpy -vvv extract /data/distribution2.json /data/api2.json
- name: Test Difference
continue-on-error: false
run: |
docker run -v ${{ github.workspace }}/cache:/data aexpy/aexpy -vvv diff /data/api1.json /data/api2.json /data/diff.json
- name: Test Report
continue-on-error: false
run: |
docker run -v ${{ github.workspace }}/cache:/data aexpy/aexpy -vvv report /data/diff.json /data/report.json
- name: Test View
continue-on-error: false
run: |
docker run -v ${{ github.workspace }}/cache:/data aexpy/aexpy -vvv view /data/distribution1.json
docker run -v ${{ github.workspace }}/cache:/data aexpy/aexpy -vvv view /data/distribution2.json
docker run -v ${{ github.workspace }}/cache:/data aexpy/aexpy -vvv view /data/api1.json
docker run -v ${{ github.workspace }}/cache:/data aexpy/aexpy -vvv view /data/api2.json
docker run -v ${{ github.workspace }}/cache:/data aexpy/aexpy -vvv view /data/diff.json
docker run -v ${{ github.workspace }}/cache:/data aexpy/aexpy -vvv view /data/report.json
- name: Upload results
uses: actions/upload-artifact@v4
with:
name: image-cache
path: ./cache
docs:
runs-on: ubuntu-latest
env:
PYTHONUTF8: 1
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v4
with:
python-version: '3.12'
architecture: 'x64'
- name: Setup paperead
run: pip install paperead
- name: Generate documents
run: |
cd docs
paperead build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: docs
path: ./docs/dist
deploy:
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' || github.event_name == 'release' }}
needs: [image, docs, package]
runs-on: ubuntu-latest
env:
PYTHONUTF8: 1
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: docs
path: ./docs/dist
- name: Deploy docs to netlify
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: netlify/actions/cli@master
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
with:
args: deploy --dir=./docs/dist --prod
secrets: '["NETLIFY_AUTH_TOKEN", "NETLIFY_SITE_ID"]'
- name: Download package artifacts
uses: actions/download-artifact@v4
with:
name: package
path: ./dist
- name: Deploy packages
if: ${{ github.event_name == 'release' }}
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m pip install --upgrade twine
python -m twine upload --skip-existing --repository pypi "dist/*"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Image Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: stardustdl/aexpy
- name: Set BUILD_DATE
run: echo "BUILD_DATE=$(date -Ins)" >> $GITHUB_ENV
- name: Deploy image
uses: docker/build-push-action@v5
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GIT_COMMIT=${{ github.sha }}
BUILD_DATE=${{ env.BUILD_DATE }}