From 7a916be07e380abfab2b4ff7c28876e117e11be9 Mon Sep 17 00:00:00 2001 From: clux Date: Tue, 24 May 2022 20:35:47 +0100 Subject: [PATCH 1/7] integration tests running git fetch Signed-off-by: clux --- .github/workflows/integration.yml | 30 ++++++++++++++++++++++++++++++ justfile | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/integration.yml diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 0000000..8e864ab --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,30 @@ +name: integration +on: + pull_request: + branches: + - 'main' + +jobs: + docker: + name: 'Integration tests' + runs-on: 'ubuntu-latest' + steps: + - uses: 'actions/checkout@v2' + - uses: extractions/setup-just@v1 + + - name: Build stable image + uses: docker/build-push-action@v2 + with: + context: . + push: false + build-args: | + CHANNEL=stable + tags: clux/muslrust:temp + + - name: Compute tags + shell: bash + run: docker run clux/muslrust:temp rustc --version + + - name: Compute tags + shell: bash + run: docker run -v $PWD:/volume -w /volume -t clux/muslrust:temp git fetch --tags diff --git a/justfile b/justfile index fcc0ede..5c24ca5 100644 --- a/justfile +++ b/justfile @@ -12,7 +12,7 @@ build-nightly: (_build "nightly") # Shell into the built container run: - docker run -v $PWD/test:/volume -w /volume -it clux/muslrust:temp /bin/bash + docker run -v $PWD:/volume -w /volume -it clux/muslrust:temp /bin/bash # Test an individual crate against built containr _t crate: From 8fb6039d01f13c7e3e7fe30fa7ad4a14f5b8491e Mon Sep 17 00:00:00 2001 From: clux Date: Tue, 24 May 2022 20:43:02 +0100 Subject: [PATCH 2/7] needs a safe hook Signed-off-by: clux --- .github/workflows/integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 8e864ab..d17af4e 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -27,4 +27,4 @@ jobs: - name: Compute tags shell: bash - run: docker run -v $PWD:/volume -w /volume -t clux/muslrust:temp git fetch --tags + run: docker run -v $PWD:/volume -w /volume -t clux/muslrust:temp git config --global --add safe.directory /volume && git fetch --tags From d6a2f1ade865e37522ee06cf15ee4d56d9e841f5 Mon Sep 17 00:00:00 2001 From: clux Date: Tue, 24 May 2022 20:54:07 +0100 Subject: [PATCH 3/7] fix names of commands Signed-off-by: clux --- .github/workflows/integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index d17af4e..a409c93 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -21,10 +21,10 @@ jobs: CHANNEL=stable tags: clux/muslrust:temp - - name: Compute tags + - name: Compute rustc version shell: bash run: docker run clux/muslrust:temp rustc --version - - name: Compute tags + - name: Verify we can run git fetch shell: bash run: docker run -v $PWD:/volume -w /volume -t clux/muslrust:temp git config --global --add safe.directory /volume && git fetch --tags From 663f455496f9dab517a82fee801e7c9f92d13ccf Mon Sep 17 00:00:00 2001 From: clux Date: Wed, 25 May 2022 13:52:45 +0100 Subject: [PATCH 4/7] quick integration test run Signed-off-by: clux --- .github/workflows/integration.yml | 4 ++++ Dockerfile.test | 10 ++++++++++ justfile | 8 +++++++- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 Dockerfile.test diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index a409c93..d82c1a8 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -28,3 +28,7 @@ jobs: - name: Verify we can run git fetch shell: bash run: docker run -v $PWD:/volume -w /volume -t clux/muslrust:temp git config --global --add safe.directory /volume && git fetch --tags + + - name: Verify we can docker build in builder pattern + shell: bash + run: just integration diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 0000000..429a5e9 --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,10 @@ +FROM clux/muslrust:temp as builder + +# Test a particular crate +ARG CRATE +COPY test/${CRATE} app + +WORKDIR /app +RUN cargo new --bin api +WORKDIR /app/api +RUN cargo build --release diff --git a/justfile b/justfile index 5c24ca5..e4173f8 100644 --- a/justfile +++ b/justfile @@ -14,7 +14,13 @@ build-nightly: (_build "nightly") run: docker run -v $PWD:/volume -w /volume -it clux/muslrust:temp /bin/bash -# Test an individual crate against built containr +_i crate: + docker build --build-arg CRATE="{{crate}}crate" -f Dockerfile.test -t clux/muslrust-tests:temp . + +# Test building all crates in a builder pattern +integration: (_i "plain") (_i "ssl") (_i "rustls") (_i "pq") (_i "serde") (_i "curl") (_i "zlib") (_i "hyper") (_i "dieselpg") (_i "dieselsqlite") + +# Test an individual crate against built container _t crate: ./test.sh {{crate}} From fce7af11a8156130d73b76fdf92330164dc7a719 Mon Sep 17 00:00:00 2001 From: clux Date: Wed, 25 May 2022 14:03:15 +0100 Subject: [PATCH 5/7] more sensible integration tests Signed-off-by: clux --- .github/workflows/integration.yml | 2 +- justfile | 6 +++--- Dockerfile.test => test/Dockerfile.test | 12 ++++++++---- 3 files changed, 12 insertions(+), 8 deletions(-) rename Dockerfile.test => test/Dockerfile.test (56%) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index d82c1a8..216154f 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -31,4 +31,4 @@ jobs: - name: Verify we can docker build in builder pattern shell: bash - run: just integration + run: docker build --build-arg CRATE="hypercrate" -f test/Dockerfile.test -t clux/muslrust-tests:temp test/ diff --git a/justfile b/justfile index e4173f8..0857dd7 100644 --- a/justfile +++ b/justfile @@ -15,10 +15,10 @@ run: docker run -v $PWD:/volume -w /volume -it clux/muslrust:temp /bin/bash _i crate: - docker build --build-arg CRATE="{{crate}}crate" -f Dockerfile.test -t clux/muslrust-tests:temp . + docker build --build-arg CRATE="{{crate}}crate" -f test/Dockerfile.test -t clux/muslrust-tests:temp test/ -# Test building all crates in a builder pattern -integration: (_i "plain") (_i "ssl") (_i "rustls") (_i "pq") (_i "serde") (_i "curl") (_i "zlib") (_i "hyper") (_i "dieselpg") (_i "dieselsqlite") +# Test builder pattern and building a copied crate in a builder +integration: (_i "hyper") # Test an individual crate against built container _t crate: diff --git a/Dockerfile.test b/test/Dockerfile.test similarity index 56% rename from Dockerfile.test rename to test/Dockerfile.test index 429a5e9..c843c11 100644 --- a/Dockerfile.test +++ b/test/Dockerfile.test @@ -1,10 +1,14 @@ FROM clux/muslrust:temp as builder +# Test a blank crate +WORKDIR / +RUN cargo new --bin api +WORKDIR /api +RUN cargo build --release + # Test a particular crate ARG CRATE -COPY test/${CRATE} app - +COPY ${CRATE} /app WORKDIR /app -RUN cargo new --bin api -WORKDIR /app/api +RUN ls /app/* RUN cargo build --release From 43287ae6229d8a938a4ced9bf37d407c04e89c63 Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 26 May 2022 20:57:51 +0100 Subject: [PATCH 6/7] try simplified drone setup Signed-off-by: clux --- .drone.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..97c6626 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,28 @@ +--- +kind: pipeline +name: amd64 + +platform: + os: linux + arch: amd64 + +steps: + + - name: prepare repo + image: clux/muslrust:1.61.0 + user: root + commands: + - git fetch --tags + - git submodule init + - git submodule update --recursive --remote + - chown 1000:1000 . -R + + #- name: check formatting + # image: rustdocker/rust:nightly + # commands: + # - /root/.cargo/bin/cargo fmt -- --check + + - name: check with different features + image: clux/muslrust:1.61.0 + commands: + - cd test/hypercrate && cargo build From 6ff1ae6dd856e277e1eb0e6d2bc586d08fcda67b Mon Sep 17 00:00:00 2001 From: clux Date: Sun, 5 Jun 2022 19:06:51 +0100 Subject: [PATCH 7/7] stash branch Signed-off-by: clux --- .drone.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index 97c6626..441e152 100644 --- a/.drone.yml +++ b/.drone.yml @@ -17,11 +17,6 @@ steps: - git submodule update --recursive --remote - chown 1000:1000 . -R - #- name: check formatting - # image: rustdocker/rust:nightly - # commands: - # - /root/.cargo/bin/cargo fmt -- --check - - name: check with different features image: clux/muslrust:1.61.0 commands: