From 0fac7a52a6718aec381264bd45681930ad77de34 Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Sun, 25 Sep 2022 16:06:59 +0300 Subject: [PATCH 1/2] Build ego binary artifacts for release --- .dockerignore | 2 +- .github/workflows/release.yml | 24 +++++++++++++++++++++++ .github/workflows/tests.yml | 7 ++++++- varia/{Dockerfile.tests => Dockerfile.ci} | 7 +++++-- 4 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/release.yml rename varia/{Dockerfile.tests => Dockerfile.ci} (65%) 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..407cfd0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,10 +17,15 @@ 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 + - uses: actions/upload-artifact@v3 + with: + name: my-artifact + path: path/to/artifact/ + 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 From 3f3a25f7d4b8b1bac5afd014391f0cd6666282ab Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Sun, 25 Sep 2022 16:29:43 +0300 Subject: [PATCH 2/2] Testing stuff --- .github/workflows/tests.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 407cfd0..b0bd4f1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,8 +24,13 @@ jobs: 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: my-artifact - path: path/to/artifact/ + name: ego-x86_64-linux.tar.gz + path: dist/ego-x86_64-linux.tar.gz if-no-files-found: error