diff --git a/.dockerignore b/.dockerignore index 86ea41e..42a6484 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,4 +3,4 @@ _local .idea .git .github -varia/Dockerfile.tests +varia/Dockerfile.ci diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..60d3a55 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,24 @@ +name: Release build +on: + release: + types: [created] + +env: + DOCKER_BUILDKIT: 1 +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build + run: docker build . --pull -f varia/Dockerfile.ci --tag ego-build + - name: Get binary file + run: | + mkdir -p dist + docker run --rm ego-build cat target/release/ego > dist/ego + cd dist && tar czf ego-x86_64-linux.tar.gz ego + - uses: actions/upload-artifact@v3 + with: + name: ego-x86_64-linux.tar.gz + path: dist/ego-x86_64-linux.tar.gz + if-no-files-found: error diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3790c29..b0bd4f1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,10 +17,20 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build - run: docker build . --pull -f varia/Dockerfile.tests --tag ego-build + run: docker build . --pull -f varia/Dockerfile.ci --tag ego-build - name: Test suite run: docker run --rm ego-build cargo test --color=always - name: Clippy lints run: docker run --rm ego-build cargo clippy --color=always - name: rustfmt run: docker run --rm ego-build cargo fmt -- --color=always --check + - name: Get binary file + run: | + mkdir -p dist + docker run --rm ego-build cat target/release/ego > dist/ego + cd dist && tar czf ego-x86_64-linux.tar.gz ego + - uses: actions/upload-artifact@v3 + with: + name: ego-x86_64-linux.tar.gz + path: dist/ego-x86_64-linux.tar.gz + if-no-files-found: error diff --git a/varia/Dockerfile.tests b/varia/Dockerfile.ci similarity index 65% rename from varia/Dockerfile.tests rename to varia/Dockerfile.ci index ac72190..f665039 100644 --- a/varia/Dockerfile.tests +++ b/varia/Dockerfile.ci @@ -1,5 +1,6 @@ # This Dockerfile is mostly for CI, see .github/workflows/tests.yml -FROM rust AS ego-build +# Using Debian 'bullseye' as base, it has older glibc that's likely to be compatible with recent desktop distributions. +FROM rust:bullseye AS ego-build WORKDIR /root/build # Make warnings fatal @@ -19,4 +20,6 @@ RUN mkdir src/ && \ # Do the actual build COPY . . -RUN cargo build --bins --tests --color=always +RUN cargo build --tests --color=always +# Release build for publishing binaries +RUN cargo build --release --bins --color=always && strip target/release/ego