This commit is contained in:
2023-12-03 15:46:05 +01:00
parent a5e0857285
commit 2b133a9f3f
13 changed files with 779 additions and 152 deletions

View File

@@ -0,0 +1,31 @@
name: release
run-name: release
on:
push:
branches:
- master
jobs:
tests:
uses: ./.gitea/workflows/test.yaml # use the callable tests job to run tests
secrets: inherit
deploy:
name: deploy
runs-on: ubuntu-latest
needs: [tests] # require tests to pass before deploy runs
container:
image: ovlach/docker-gitea:v0.0.2-alpha
steps:
- uses: https://github.com/actions/checkout.git@v4
- name: Login to git.nanobyte.cz
uses: https://github.com/docker/login-action@v3
with:
username: ${{ secrets.DEPLOYMENT_PACKAGE }}
password: ${{ secrets.DEPLOYMENT_PACKAGE }}
registry: git.nanobyte.cz
- name: Get short hash from git repository
id: git
run: echo "::set-output name=short_hash::$(git rev-parse --short HEAD)"
- name: Build and push docker
run: |
docker build . -t git.nanobyte.cz/$GITHUB_REPOSITORY_OWNER/ovlach_backend:${{steps.git.outputs.short_hash}} --build-arg GITEA_TOKEN="Bearer ${{secrets.DEPLOYMENT_PACKAGE}}" && \
docker push git.nanobyte.cz/$GITHUB_REPOSITORY_OWNER/ovlach_backend:${{steps.git.outputs.short_hash}}

View File

@@ -2,52 +2,66 @@ name: test
run-name: test
on:
workflow_call:
secrets:
DEPLOYMENT_PACKAGE:
description: 'needed for checkout depenediencies'
required: true
push:
branches:
- '*'
jobs:
clippy:
runs-on: ubuntu-latest
container:
image: git.nanobyte.cz/nanobyte/nano-rust-builder:1.74.5f84654
steps:
- uses: https://github.com/actions/checkout.git@v4
- name: Hash of Cargo.lock
id: get-hash
run: echo "::set-output name=hash::$(md5sum Cargo.lock | awk '{ print $1; }')"
- uses: https://gitea.com/wolfogre/cache/restore@v3
id: cache
with:
key: "${{github.repository}}-cache-cargo-clippy-v4-${{ steps.get-hash.outputs.hash }}"
path: |
.cache
target
key: ${{github.repository}}-cache-cargo-clippy-v4-${{ hashFiles('Cargo.lock') }}
restore-keys: ${{github.repository}}-cache-cargo-clippy-v4
- uses: nanobyte-public/rust-action@master
with:
args: CARGO_HOME=./.cache cargo clippy -- -Dwarnings
args: CARGO_HOME=./.cache cargo-nan \"Bearer ${{secrets.DEPLOYMENT_PACKAGE}}\" cargo clippy -- -Dwarnings
- uses: https://gitea.com/wolfogre/cache/save@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
path: |
.cache
target
key: ${{github.repository}}-cache-cargo-clippy-v4-${{ hashFiles('Cargo.lock') }}
key: "${{github.repository}}-cache-cargo-clippy-v4-${{ steps.get-hash.outputs.hash }}"
test:
container:
image: git.nanobyte.cz/nanobyte/nano-rust-builder:1.74.5f84654
runs-on: ubuntu-latest
steps:
- uses: https://github.com/actions/checkout.git@v4
- name: Hash of Cargo.lock
id: get-hash
run: echo "::set-output name=hash::$(md5sum Cargo.lock | awk '{ print $1; '})"
- uses: https://gitea.com/wolfogre/cache/restore@v3
id: cache
with:
path: |
.cache
target
key: ${{github.repository}}-cache-cargo-test-v4-${{ hashFiles('Cargo.lock') }}
restore-keys: ${{github.repository}}-cache-cargo-test-v4
key: "${{github.repository}}-cache-test-clippy-v4-${{ steps.get-hash.outputs.hash }}"
restore-keys: ${{github.repository}}-cache-test-test-v4
- uses: nanobyte-public/rust-action@master
with:
args: |
CARGO_HOME=./.cache cargo test
CARGO_HOME=./.cache cargo-nan \"Bearer ${{secrets.DEPLOYMENT_PACKAGE}}\" cargo test
- uses: https://gitea.com/wolfogre/cache/save@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
path: |
.cache
target
key: ${{github.repository}}-cache-cargo-test-v4-${{ hashFiles('Cargo.lock') }}
key: "${{github.repository}}-cache-test-clippy-v4-${{ steps.get-hash.outputs.hash }}"