Skip to content

Commit b25b95c

Browse files
committed
ci(workflows): migrate to the same files structure than other projects
1 parent bf11966 commit b25b95c

File tree

3 files changed

+111
-107
lines changed

3 files changed

+111
-107
lines changed

.github/workflows/build.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
- main
8+
pull_request:
9+
branches:
10+
- "*"
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-22.04
15+
steps:
16+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
17+
- uses: actions/checkout@v2
18+
19+
- name: Log in to registry
20+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
21+
22+
- name: Download Docker cache image (if available)
23+
run: docker pull ghcr.io/$GITHUB_REPOSITORY/build-cache || true
24+
25+
- name: Build the Docker image
26+
run: |
27+
git fetch --prune --unshallow --tags
28+
docker build . -t pyaleph-node:${GITHUB_REF##*/} -f deployment/docker-build/pyaleph.dockerfile --cache-from=ghcr.io/$GITHUB_REPOSITORY/build-cache
29+
30+
- name: Push the image to the cache
31+
# It's not possible to push packages from fork PRs.
32+
if: github.event.pull_request.head.repo.full_name == github.repository
33+
run: |
34+
docker tag pyaleph-node:${GITHUB_REF##*/} ghcr.io/$GITHUB_REPOSITORY/build-cache
35+
docker push ghcr.io/$GITHUB_REPOSITORY/build-cache

.github/workflows/pyaleph-ci.yml

Lines changed: 0 additions & 107 deletions
This file was deleted.

.github/workflows/pytest.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Test/Coverage with Python
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
- main
8+
pull_request:
9+
branches:
10+
- "*"
11+
12+
jobs:
13+
tests:
14+
runs-on: ubuntu-22.04
15+
services:
16+
postgres:
17+
image: postgres:15.1
18+
ports:
19+
- 5432:5432
20+
env:
21+
POSTGRES_USER: aleph
22+
POSTGRES_PASSWORD: decentralize-everything
23+
POSTGRES_DATABASE: aleph
24+
redis:
25+
image: redis:7.0.10
26+
ports:
27+
- 127.0.0.1:6379:6379
28+
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
with:
33+
# Fetch the whole history for all tags and branches (required for aleph.__version__)
34+
fetch-depth: 0
35+
36+
- name: Set up Python 3.11
37+
id: setup-python
38+
uses: actions/setup-python@v2
39+
with:
40+
python-version: 3.11
41+
42+
- name: Install latest Rust nightly toolchain
43+
uses: actions-rs/toolchain@v1
44+
with:
45+
toolchain: nightly
46+
override: true
47+
48+
- name: Set rust to nightly
49+
run: |
50+
rustup default nightly # Required to build some dependencies
51+
52+
- name: Cache dependencies
53+
uses: actions/cache@v4
54+
with:
55+
path: ~/.cache/pip
56+
key: ${{ runner.os }}-pytest-${{ hashFiles('pyproject.toml') }}
57+
restore-keys: |
58+
${{ runner.os }}-pytest-${{ hashFiles('pyproject.toml') }}
59+
60+
- run: |
61+
pip install hatch coverage
62+
63+
- run: |
64+
sudo cp .github/openssl-ci.cnf /etc/ssl/openssl.cnf
65+
export OPENSSL_CONF=/etc/ssl/openssl.cnf
66+
touch config.yml # Fake config file for alembic
67+
# TODO: determine why ResourceWarning warnings occur in some tests.
68+
hatch run testing:test
69+
70+
- run: |
71+
hatch run testing:cov
72+
73+
- uses: codecov/[email protected]
74+
with:
75+
token: ${{ secrets.CODECOV_TOKEN }}
76+
slug: aleph-im/aleph-sdk-python

0 commit comments

Comments
 (0)