-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #199 from astraw/actions-ci
Use GitHub Actions and `earthly` to run CI.
- Loading branch information
Showing
12 changed files
with
117 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
name: CI | ||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
lint: | ||
strategy: | ||
fail-fast: false | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Earthly | ||
uses: earthly/actions-setup@v1 | ||
- name: Lint | ||
run: | | ||
earthly --ci +lint | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- "ubuntu:focal" | ||
- "debian:bullseye" | ||
- "ubuntu:jammy" | ||
- "debian:bookworm" | ||
# TODO(astraw/stdeb#195) | ||
# - "ubuntu:noble" | ||
# - "debian:trixie" | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Earthly | ||
uses: earthly/actions-setup@v1 | ||
- name: Run tests | ||
run: | | ||
earthly --ci +test --OS=${{matrix.os}} | ||
- name: Run pypi-install tests -- | ||
run: | | ||
earthly --ci +test-pypi-install --OS=${{matrix.os}} | ||
- name: Run 2and3 tests | ||
# This test can only be run on platforms that have Python 2 and Python 3 packages. | ||
if: ${{contains(fromJSON('["ubuntu:focal", "debian:bullseye", "ubuntu:jammy"]'), matrix.os)}} | ||
run: | | ||
earthly --ci +test-2and3 --OS=${{matrix.os}} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
VERSION 0.8 | ||
|
||
|
||
SRC: | ||
FUNCTION | ||
COPY --dir scripts stdeb test_data \ | ||
test*.sh *.txt *.py *.cfg *.toml *.rst \ | ||
MANIFEST.in \ | ||
/src/stdeb | ||
WORKDIR /src/stdeb | ||
|
||
BUILD: | ||
FUNCTION | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update; apt-get install -y \ | ||
# Build deps \ | ||
debhelper dh-python python3-all python3-pip \ | ||
# Install deps \ | ||
python3-requests apt-file \ | ||
# Test deps \ | ||
libpq-dev python3-all-dev | ||
|
||
DO +SRC | ||
RUN python3 setup.py --command-packages=stdeb.command bdist_deb | ||
RUN for f in deb_dist/*.deb; do echo; echo $f; dpkg --contents $f; done | ||
|
||
INSTALL: | ||
FUNCTION | ||
# Install stdeb | ||
RUN dpkg -i deb_dist/*.deb | ||
|
||
lint: | ||
FROM docker.io/library/python:3.10-alpine | ||
DO +SRC | ||
RUN python3 -m pip install -r requirements.txt | ||
RUN ruff format --check || true | ||
RUN ruff check || true | ||
|
||
build: | ||
ARG OS=debian:bookworm | ||
FROM $OS | ||
DO +BUILD | ||
|
||
test: | ||
FROM +build | ||
DO +INSTALL | ||
RUN env PYEXE=/usr/bin/python3 bash -x ./test.sh | ||
|
||
test-pypi-install: | ||
FROM +build | ||
DO +INSTALL | ||
RUN bash -x ./test-pypi-install.sh | ||
|
||
test-2and3: | ||
FROM +build | ||
DO +INSTALL | ||
# Not all platforms provide python2 | ||
RUN apt-get update; apt-get install -y python-all-dev || true | ||
RUN bash -x ./test2and3.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ruff | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
line-length = 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters