Skip to content

ci-cd

ci-cd #17

Workflow file for this run

name: ci-cd
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# on: [push, pull_request]
jobs:
ci:
# Set up operating system
runs-on: ubuntu-latest
# Define job steps
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install the solc with apt
run: |
DEBIAN_FRONTEND=noninteractive sudo add-apt-repository ppa:ethereum/ethereum && \
DEBIAN_FRONTEND=noninteractive sudo apt-get update && \
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y solc
- name: Check-out repository
uses: actions/checkout@v4
with:
submodules: 'true'
token: ${{ secrets.PAT_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: meca-contracts/src/ganache/.nvmrc
- name: Install the dependency for ganache
run: npm install
working-directory: meca-contracts/src/ganache
- name: Install poetry
uses: snok/install-poetry@v1
- name: Install package
run: poetry install
- name: Test with pytest
run: poetry run pytest tests/ --cov=pymeca
cd:
permissions:
id-token: write
contents: write
# Only run this job if the "ci" job passes
needs: ci
# Set up operating system
runs-on: ubuntu-latest
# Define job steps
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Check-out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Python Semantic Release to prepare release
id: release
uses: python-semantic-release/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'
with:
repository-url: https://test.pypi.org/legacy/
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
- name: Test install from TestPyPI
if: steps.release.outputs.released == 'true'
run: |
pip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
pymeca
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Publish package distributions to GitHub Releases
uses: python-semantic-release/upload-to-gh-release@main
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}