Skip to content

Commit

Permalink
ci(workflows): migrate to the same files structure than other projects
Browse files Browse the repository at this point in the history
  • Loading branch information
Psycojoker committed Jul 10, 2024
1 parent 737df75 commit 8f9911f
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 107 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build

on:
push:
branches:
- dev
- main
pull_request:
branches:
- "*"

jobs:
build:
runs-on: ubuntu-22.04
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Download Docker cache image (if available)
run: docker pull ghcr.io/$GITHUB_REPOSITORY/build-cache || true

- name: Build the Docker image
run: |
git fetch --prune --unshallow --tags
docker build . -t pyaleph-node:${GITHUB_REF##*/} -f deployment/docker-build/pyaleph.dockerfile --cache-from=ghcr.io/$GITHUB_REPOSITORY/build-cache
- name: Push the image to the cache
# It's not possible to push packages from fork PRs.
if: github.event.pull_request.head.repo.full_name == github.repository
run: |
docker tag pyaleph-node:${GITHUB_REF##*/} ghcr.io/$GITHUB_REPOSITORY/build-cache
d
107 changes: 0 additions & 107 deletions .github/workflows/pyaleph-ci.yml

This file was deleted.

73 changes: 73 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Test/Coverage with Python

on:
push:
branches:
- dev
- main
pull_request:
branches:
- "*"

jobs:
tests:
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:15.1
ports:
- 5432:5432
env:
POSTGRES_USER: aleph
POSTGRES_PASSWORD: decentralize-everything
POSTGRES_DATABASE: aleph
redis:
image: redis:7.0.10
ports:
- 127.0.0.1:6379:6379


steps:
- uses: actions/checkout@v4
with:
# Fetch the whole history for all tags and branches (required for aleph.__version__)
fetch-depth: 0

- name: Set up Python 3.11
id: setup-python
uses: actions/setup-python@v2
with:
python-version: 3.11

- name: Install latest Rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
# components: rustfmt, clippy

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pytest-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pytest-${{ hashFiles('pyproject.toml') }}
- run: |
pip install hatch coverage
- run: |
sudo cp .github/openssl-ci.cnf /etc/ssl/openssl.cnf
export OPENSSL_CONF=/etc/ssl/openssl.cnf
touch config.yml # Fake config file for alembic
# TODO: determine why ResourceWarning warnings occur in some tests.
hatch run testing:test
- run: |
hatch run testing:cov
- uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: aleph-im/aleph-sdk-python

0 comments on commit 8f9911f

Please sign in to comment.