build: fix wfs

This commit is contained in:
Ondrej Vlach 2023-12-09 16:28:40 +01:00
parent 39a64b3e38
commit fa241d75f4
Signed by: ovlach
GPG Key ID: 4FF1A23B4914DE70
2 changed files with 36 additions and 5 deletions

View File

@ -5,9 +5,40 @@ on:
branches: branches:
- master - master
jobs: jobs:
tests:
name: tests
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:
key: "${{github.repository}}-cache-cargo-clippy-v4-${{ steps.get-hash.outputs.hash }}"
path: |
.cache
target
restore-keys: ${{github.repository}}-cache-cargo-clippy-v4
- name: tests
uses: nanobyte-public/rust-action@v3
with:
args: |
CARGO_HOME=./.cache cargo-nan \"${{secrets.deployment_package}}\" cargo clippy -- -Dwarnings && \
CARGO_HOME=./.cache cargo-nan \"${{secrets.deployment_package}}\" cargo clippy --tests -- -Dwarnings && \
CARGO_HOME=./.cache cargo-nan \"${{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-clippy-v4-${{ steps.get-hash.outputs.hash }}"
docker: docker:
name: docker name: docker
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: tests # require tests to pass before deploy runs
container: container:
image: ovlach/docker-gitea:v0.0.2-alpha image: ovlach/docker-gitea:v0.0.2-alpha
steps: steps:
@ -23,12 +54,12 @@ jobs:
run: echo "::set-output name=short_hash::$(git rev-parse --short HEAD)" run: echo "::set-output name=short_hash::$(git rev-parse --short HEAD)"
- name: Build and push docker - name: Build and push docker
run: | run: |
docker build . -t git.nanobyte.cz/$GITHUB_REPOSITORY_OWNER/ovlach_pdf:${{steps.git.outputs.short_hash}} && \ docker build . -t git.nanobyte.cz/$GITHUB_REPOSITORY_OWNER/ovlach_pdf:${{steps.git.outputs.short_hash}} --build-arg GITEA_TOKEN="${{secrets.DEPLOYMENT_PACKAGE}}" && \
docker push git.nanobyte.cz/$GITHUB_REPOSITORY_OWNER/ovlach_pdf:${{steps.git.outputs.short_hash}} docker push git.nanobyte.cz/$GITHUB_REPOSITORY_OWNER/ovlach_pdf:${{steps.git.outputs.short_hash}}
stage_deployment: stage_deployment:
name: stage-deployment name: stage-deployment
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [docker] # require tests to pass before deploy runs needs: [docker, tests] # require tests to pass before deploy runs
steps: steps:
- uses: https://github.com/actions/checkout.git@v4 - uses: https://github.com/actions/checkout.git@v4
- name: Get short hash from git repository - name: Get short hash from git repository
@ -49,4 +80,4 @@ jobs:
curl -L https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv5.3.0/kustomize_v5.3.0_linux_amd64.tar.gz -o kustomize.tar.gz && tar -xzf kustomize.tar.gz curl -L https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv5.3.0/kustomize_v5.3.0_linux_amd64.tar.gz -o kustomize.tar.gz && tar -xzf kustomize.tar.gz
- name: Update images - name: Update images
run: | run: |
cd vlach_xyz_deploy && cd kubernetes/staging/ && ../../../kustomize edit set image pdf=git.nanobyte.cz/$GITHUB_REPOSITORY_OWNER/ovlach_pdf:${{steps.git.outputs.short_hash}} && git add . && git commit -m "upgrade ovlach_pdf -> ${{steps.git.outputs.short_hash}}" && git push origin master cd vlach_xyz_deploy && cd kubernetes/staging/ && ../../../kustomize edit set image web=git.nanobyte.cz/$GITHUB_REPOSITORY_OWNER/ovlach_pdf:${{steps.git.outputs.short_hash}} && git add . && git commit -m "upgrade ovlach_pdf -> ${{steps.git.outputs.short_hash}}" && git push origin master

View File

@ -8,7 +8,7 @@ jobs:
clippy: clippy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: git.nanobyte.cz/nanobyte/nano-rust-builder:1.74.5f84654 image: git.nanobyte.cz/nanobyte-public/nano-rust-builder:1.74.5f84654
steps: steps:
- uses: https://github.com/actions/checkout.git@v4 - uses: https://github.com/actions/checkout.git@v4
- name: Hash of Cargo.lock - name: Hash of Cargo.lock
@ -34,7 +34,7 @@ jobs:
key: "${{github.repository}}-cache-cargo-clippy-v4-${{ steps.get-hash.outputs.hash }}" key: "${{github.repository}}-cache-cargo-clippy-v4-${{ steps.get-hash.outputs.hash }}"
test: test:
container: container:
image: git.nanobyte.cz/nanobyte/nano-rust-builder:1.74.5f84654 image: git.nanobyte.cz/nanobyte-public/nano-rust-builder:1.74.5f84654
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: https://github.com/actions/checkout.git@v4 - uses: https://github.com/actions/checkout.git@v4