Skip to content

ci: update GitHub Actions #148

ci: update GitHub Actions

ci: update GitHub Actions #148

name: Version Test
on:
push:
branches: [main]
tags-ignore: ['**']
paths-ignore: ['**.md']
pull_request:
paths-ignore: ['**.md']
concurrency:
group: ${{ github.ref }}-version
cancel-in-progress: true
jobs:
test-version:
name: Test version (${{ matrix.os }} ${{ matrix.version }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
version:
[
'default',
'0.8.36',
'==0.8.36',
'git+https://github.com/ApeWorX/ape.git@main',
'<PATH_TO_APE>',
'<PATH_TO_APE_WITH_EXTRAS>',
]
extra-packages: [
'requirements.txt',
'pyproject.toml',
]
runs-on: ${{ matrix.os }}
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
# Checkout eth-ape repo if needed for <PATH_TO_APE>
- name: Checkout eth-ape
if: contains(matrix.version, '<PATH_TO_APE>') || contains(matrix.version, '<PATH_TO_APE_WITH_EXTRAS>')
uses: actions/checkout@v4
with:
repository: ApeWorX/ape
path: eth-ape
fetch-depth: 0
- name: Check version pin
id: check-version
run: |
if [[ "${{ matrix.version }}" == "default" ]]; then
echo "ape-version=''" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.version }}" == "<PATH_TO_APE>" ]]; then
echo "ape-version=${{ github.workspace }}/eth-ape" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.version }}" == "<PATH_TO_APE_WITH_EXTRAS>" ]]; then
echo "ape-version=${{ github.workspace }}/eth-ape[test]" >> $GITHUB_OUTPUT
else
echo "ape-version=${{ matrix.version }}" >> $GITHUB_OUTPUT
fi
- name: Convert 'requirements.txt' to 'pyproject.toml'
if: ${{ matrix.extra-packages == 'pyproject.toml' }}
shell: bash
run: |
pip install tomlkit
python -c 'from pathlib import Path; txt = Path("requirements.txt").read_text(); import tomlkit; print(tomlkit.dumps({"project": {"dependencies": [line for line in txt.splitlines() if not line.startswith("#")], "name":"test", "version": "0.0.0"}}))' | tee pyproject.toml
rm requirements.txt
- name: Run ape action
id: ape-action
uses: ./
with:
ape-version-pin: ${{ steps.check-version.outputs.ape-version }}
- name: Print outputs
run: |
echo "Ape Version: ${{ steps.ape-action.outputs.ape-version }}"
- run: ape --help
- name: Extra packages Test
run: pip show hypothesis