-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial attempt at GitHub Actions based CI. #199
Merged
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f934acc
Add an Earthfile for use with earthly.
nuclearsandwich 80df492
Initial attempt at GitHub Actions based CI using Earthly
nuclearsandwich 747ff5c
Update test scripts.
nuclearsandwich cd4c3bc
Add ruff configuration file.
nuclearsandwich 3008073
Update README badge.
nuclearsandwich bd733ba
Remove old test configuration files.
nuclearsandwich 1c52e88
Split a function for copying sources.
nuclearsandwich 5ce765f
Only run 2and3 tests on platforms that have Python 2 and 3.
nuclearsandwich 9e7333a
Wrap array in fromJSON.
nuclearsandwich 4edf6f3
Install all dependencies in a single apt-get install command.
nuclearsandwich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,58 @@ | ||
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 | ||
# Build deps | ||
RUN apt-get update; apt-get install -y debhelper dh-python python3-all python3-pip | ||
# Install deps | ||
RUN apt-get update; apt-get install -y python3-requests apt-file | ||
# Test deps | ||
RUN apt-get update; apt-get install -y 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For performance reasons maybe use a single
apt-get update and apt-get install
invocation and if you want to keep the dependencies separated use env vars?