From ec9b855aee7c90f481865a72b9c856375bd39dae Mon Sep 17 00:00:00 2001 From: Trivernis Date: Tue, 10 Nov 2020 20:11:37 +0100 Subject: [PATCH 1/5] Add rust build and test workflow --- .github/workflows/rust.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..7ae98f3 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,22 @@ +name: Rust + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose From 5baedcc0affc56335336a032af03a5c52acc7537 Mon Sep 17 00:00:00 2001 From: trivernis Date: Tue, 10 Nov 2020 20:15:15 +0100 Subject: [PATCH 2/5] Add docker build action Signed-off-by: trivernis --- .github/workflows/docker.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..e99ef6d --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,35 @@ +name: Docker + +on: + push: + branches: [ main ] + +jobs: + multi: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x + push: true + tags: | + trivernis/snekcloud-server:latest \ No newline at end of file From 5fed0068b8535a93b587eb57e5c5af75ee5f4978 Mon Sep 17 00:00:00 2001 From: trivernis Date: Tue, 10 Nov 2020 20:22:00 +0100 Subject: [PATCH 3/5] Add cache to rust build task Signed-off-by: trivernis --- .github/workflows/rust.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 7ae98f3..431343c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -18,5 +18,11 @@ jobs: - uses: actions/checkout@v2 - name: Build run: cargo build --verbose + - name: Cache build data + uses: actions/cache@v2 + with: + path: | + target/**/build + target/**/deps - name: Run tests run: cargo test --verbose From 347f79fad2fd75deabdb4e53ed6eebbb8bc10ead Mon Sep 17 00:00:00 2001 From: trivernis Date: Tue, 10 Nov 2020 20:24:29 +0100 Subject: [PATCH 4/5] Move cache to before running build Signed-off-by: trivernis --- .github/workflows/rust.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 431343c..59f4764 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -16,13 +16,13 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Build - run: cargo build --verbose - name: Cache build data uses: actions/cache@v2 with: path: | target/**/build target/**/deps + - name: Build + run: cargo build --verbose - name: Run tests run: cargo test --verbose From 72876173567d041371809402780cd24818a7f7b1 Mon Sep 17 00:00:00 2001 From: trivernis Date: Tue, 10 Nov 2020 20:26:17 +0100 Subject: [PATCH 5/5] Add cache key Signed-off-by: trivernis --- .github/workflows/rust.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 59f4764..9267250 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -22,6 +22,10 @@ jobs: path: | target/**/build target/**/deps + key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build- + ${{ runner.os }}- - name: Build run: cargo build --verbose - name: Run tests