From e6092816aaf096744664df2533392a39754b880a Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 11 Nov 2020 10:19:36 +0100 Subject: [PATCH 01/13] Add copying of missing libraries from builder Signed-off-by: trivernis --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 76791aa..8a30444 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN timeout 1s ./snekcloud-server || exit 0 RUN cp config/00_default.toml config/10_local.toml FROM alpine -RUN apk add --no-cache build-base +COPY --from=builder /usr/lib/libgcc* /usr/lib COPY --from=builder /usr/src/snekcloud-server/target/release/snekcloud-server . COPY --from=builder /usr/src/snekcloud-server/target/release/config / COPY --from=builder /usr/src/snekcloud-server/target/release/private_key / From 2b5e6c2dc21371338ee18c917ef207ad7f36b76d Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 11 Nov 2020 11:01:59 +0100 Subject: [PATCH 02/13] Add missing cache param to docker build action Signed-off-by: trivernis --- .github/workflows/docker.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 47c7486..de91dc7 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -42,5 +42,7 @@ jobs: file: ./Dockerfile platforms: ${{github.events.inputs.platforms}} push: true + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache tags: | trivernis/snekcloud-server:alpine \ No newline at end of file From 1fccc6eb8f8590ab8565764459d146d0c7c26e00 Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 11 Nov 2020 11:12:49 +0100 Subject: [PATCH 03/13] Fix platforms input param Signed-off-by: trivernis --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index de91dc7..276508d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -40,7 +40,7 @@ jobs: with: context: . file: ./Dockerfile - platforms: ${{github.events.inputs.platforms}} + platforms: ${{github.event.inputs.platforms}} push: true cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache From ca3a3e36b1baa13bdb237d41fbd3f0c9ccc5ecf8 Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 11 Nov 2020 17:25:49 +0100 Subject: [PATCH 04/13] Add multiarch release build to rust action Signed-off-by: trivernis --- .github/workflows/rust.yml | 40 +++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c369dd4..16bad50 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -11,7 +11,6 @@ env: jobs: build: - runs-on: ubuntu-latest steps: @@ -31,3 +30,42 @@ jobs: run: cargo build --verbose - name: Run tests run: cargo test --verbose + + + build-release: + runs-on: ubuntu-latest + strategy: + matrix: + target: [ x86_64-unknown-linux-gnu, armv7-unknown-linux-gnueabihf, aarch64-unknown-linux-gnu, x86_64-pc-windows-gnu ] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.target }} + override: true + - name: Cache cargo builds + uses: actions/cache@v2 + with: + path: | + /tmp/.buildx-cache + target/**/build + target/**/deps + target/**/incremental + ~/.cargo/ + key: ${{ runner.os }}-cargo-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-cargo- + - name: Build Release + uses: actions-rs/cargo@v1 + with: + use-cross: true + command: build + args: --release --target ${{ matrix.target }} + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: snekcloud-server-${{ matrix.target }} + path: target/${{ matrix.target }}/snekcloud-server \ No newline at end of file From f4153d9cef3d778902ed7e94dfa1c40e04e957f5 Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 11 Nov 2020 17:26:48 +0100 Subject: [PATCH 05/13] Fix indentation error Signed-off-by: trivernis --- .github/workflows/rust.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 16bad50..4cf15f4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -42,10 +42,10 @@ jobs: uses: actions/checkout@v2 - name: Set up toolchain uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: ${{ matrix.target }} - override: true + with: + toolchain: stable + target: ${{ matrix.target }} + override: true - name: Cache cargo builds uses: actions/cache@v2 with: From f6e7db84392c1157a3243217819c4e25cfbfb07f Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 11 Nov 2020 17:27:37 +0100 Subject: [PATCH 06/13] Fix indentation errors Signed-off-by: trivernis --- .github/workflows/rust.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 4cf15f4..657b8d1 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -60,12 +60,12 @@ jobs: ${{ runner.os }}-cargo- - name: Build Release uses: actions-rs/cargo@v1 - with: - use-cross: true - command: build - args: --release --target ${{ matrix.target }} + with: + use-cross: true + command: build + args: --release --target ${{ matrix.target }} - name: Upload artifacts uses: actions/upload-artifact@v2 - with: - name: snekcloud-server-${{ matrix.target }} - path: target/${{ matrix.target }}/snekcloud-server \ No newline at end of file + with: + name: snekcloud-server-${{ matrix.target }} + path: target/${{ matrix.target }}/snekcloud-server \ No newline at end of file From 4219ab958325aca3e28b82335aea48f0494fd6c5 Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 11 Nov 2020 17:37:19 +0100 Subject: [PATCH 07/13] Add arch to cache key and fix artifact path Signed-off-by: trivernis --- .github/workflows/rust.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 657b8d1..740593f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -22,10 +22,11 @@ jobs: target/**/build target/**/deps target/**/incremental - key: ${{ runner.os }}-build-${{ hashFiles('Cargo.lock') }} + ~/.cargo/ + key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} restore-keys: | - ${{ runner.os }}-build-${{ hashFiles('Cargo.lock') }} - ${{ runner.os }}-build- + ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} + ${{ runner.os }}-cargo- - name: Build run: cargo build --verbose - name: Run tests @@ -55,8 +56,9 @@ jobs: target/**/deps target/**/incremental ~/.cargo/ - key: ${{ runner.os }}-cargo-${{ github.sha }} + key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }} restore-keys: | + ${{ runner.os }}-cargo-${{ matrix.target }}- ${{ runner.os }}-cargo- - name: Build Release uses: actions-rs/cargo@v1 @@ -68,4 +70,4 @@ jobs: uses: actions/upload-artifact@v2 with: name: snekcloud-server-${{ matrix.target }} - path: target/${{ matrix.target }}/snekcloud-server \ No newline at end of file + path: target/${{ matrix.target }}/release/snekcloud-server \ No newline at end of file From f0a0e6c7a63d551e8c472c4337675cc60ee7caee Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 11 Nov 2020 17:45:01 +0100 Subject: [PATCH 08/13] Change cache to use the whole target folder Signed-off-by: trivernis --- .github/workflows/rust.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 740593f..fd7d403 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -25,7 +25,6 @@ jobs: ~/.cargo/ key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} restore-keys: | - ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} ${{ runner.os }}-cargo- - name: Build run: cargo build --verbose @@ -51,10 +50,7 @@ jobs: uses: actions/cache@v2 with: path: | - /tmp/.buildx-cache - target/**/build - target/**/deps - target/**/incremental + target ~/.cargo/ key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }} restore-keys: | From 6fbd7fdb92b834a6c9541b13c67fa055afc56ff6 Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 11 Nov 2020 17:47:44 +0100 Subject: [PATCH 09/13] Add cargo audit check Signed-off-by: trivernis --- .github/workflows/rust.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index fd7d403..664aec9 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -19,9 +19,7 @@ jobs: uses: actions/cache@v2 with: path: | - target/**/build - target/**/deps - target/**/incremental + target ~/.cargo/ key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} restore-keys: | @@ -30,6 +28,10 @@ jobs: run: cargo build --verbose - name: Run tests run: cargo test --verbose + - name: Run audit + uses: actions-rs/audit-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} build-release: From 061d4988e3bbb7ea6dd52066d3fe5b4240edf2ae Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 11 Nov 2020 17:53:09 +0100 Subject: [PATCH 10/13] Make release build depend on test build Signed-off-by: trivernis --- .github/workflows/rust.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 664aec9..adcbdf7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -10,7 +10,7 @@ env: CARGO_TERM_COLOR: always jobs: - build: + build-and-test: runs-on: ubuntu-latest steps: @@ -34,7 +34,8 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - build-release: + build-releases: + needs: build-and-test runs-on: ubuntu-latest strategy: matrix: From 520745041e037e493a7dfbbbb7707ce4ad3f9576 Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 11 Nov 2020 17:56:29 +0100 Subject: [PATCH 11/13] Add push trigger for rust action on actions branch Signed-off-by: trivernis --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index adcbdf7..8d67701 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,7 +2,7 @@ name: Rust on: push: - branches: [ main ] + branches: [ main, actions ] pull_request: branches: [ main ] From 98284bfa0b8610b24f4e0da6164423470c04e0e5 Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 11 Nov 2020 17:57:34 +0100 Subject: [PATCH 12/13] Fix path for windows release build Signed-off-by: trivernis --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8d67701..7d7463b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -69,4 +69,4 @@ jobs: uses: actions/upload-artifact@v2 with: name: snekcloud-server-${{ matrix.target }} - path: target/${{ matrix.target }}/release/snekcloud-server \ No newline at end of file + path: target/${{ matrix.target }}/release/snekcloud-server* \ No newline at end of file From 7dc6c35a96c8f1f8bcecd5a4f3b7b90e2fed42b2 Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 11 Nov 2020 18:06:35 +0100 Subject: [PATCH 13/13] Change cache key for docker action Signed-off-by: trivernis --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 276508d..146aa12 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -25,7 +25,7 @@ jobs: uses: actions/cache@v2 with: path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} + key: ${{ runner.os }}-buildx-${{ hashFiles('Cargo.lock') }} restore-keys: | ${{ runner.os }}-buildx- -