diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml deleted file mode 100644 index fcadfd9..0000000 --- a/.forgejo/workflows/build.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Build and Test - -on: - push: - branches: ["**"] - pull_request: - -env: - DOCKER_TLS_CERTDIR: /certs - IMAGE_TAG: ${{ github.sha }} - SHORT_SHA: ${{ github.sha }} - -jobs: - cache-mii: - runs-on: debian-trixie - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Cache Container Storage - uses: actions/cache@v4 - with: - path: | - /var/lib/containers/storage - /run/containers/storage - ~/.local/share/containers/storage - key: image-cache - - - name: Login to Registry - run: podman login -u ${{ secrets.PACKAGE_USER }} -p ${{ secrets.PACKAGE_PWD }} git.spbr.net - - - name: Set Short SHA - run: echo "SHORT_SHA=${GITHUB_SHA::6}" >> $GITHUB_ENV - - - name: Build and Push - env: - CI_REGISTRY_IMAGE: git.spbr.net/spacebar/rust-boss - CI_COMMIT_SHORT_SHA: ${{ env.SHORT_SHA }} - run: | - podman login -u ${{ secrets.PACKAGE_USER }} -p ${{ secrets.PACKAGE_PWD }} git.spbr.net - podman build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" . - podman push "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" - - - name: Push Retagged Branch - env: - CI_REGISTRY_IMAGE: git.spbr.net/spacebar/rust-boss - CI_COMMIT_SHORT_SHA: ${{ forgejo.ref_name }} - CI_COMMIT_PREVIOUS_SHA: ${{ env.SHORT_SHA }} - run: | - podman login -u ${{ secrets.PACKAGE_USER }} -p ${{ secrets.PACKAGE_PWD }} git.spbr.net - podman pull "$CI_REGISTRY_IMAGE:$CI_COMMIT_PREVIOUS_SHA" - podman tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_PREVIOUS_SHA" "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" - podman push "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" - - - name: Push Retagged Latest - env: - CI_REGISTRY_IMAGE: git.spbr.net/spacebar/rust-boss - CI_COMMIT_SHORT_SHA: latest - CI_COMMIT_PREVIOUS_SHA: ${{ env.SHORT_SHA }} - run: | - podman login -u ${{ secrets.PACKAGE_USER }} -p ${{ secrets.PACKAGE_PWD }} git.spbr.net - podman pull "$CI_REGISTRY_IMAGE:$CI_COMMIT_PREVIOUS_SHA" - podman tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_PREVIOUS_SHA" "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" - podman push "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..e1f1315 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,43 @@ +default: + image: quay.io/podman/stable + +stages: + - test + - build + - retag + +test: + stage: test + image: rust:alpine3.22 + script: + - apk add --no-cache musl-dev openssl-dev openssl-libs-static protobuf-dev lld + - cargo test + +build-and-push-image: + stage: build + script: + - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + - podman build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" . + - podman push "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" + +push-retagged-branch: + stage: retag + script: + - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + - podman pull "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" + - podman tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" + - podman push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" + rules: + - if: $CI_PIPELINE_SOURCE == "push" + when: on_success + +push-retagged-latest: + stage: retag + script: + - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + - podman pull "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" + - podman tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" "$CI_REGISTRY_IMAGE:latest" + - podman push "$CI_REGISTRY_IMAGE:latest" + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push" + when: on_success diff --git a/Cargo.toml b/Cargo.toml index 953656c..7c35104 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,4 +28,4 @@ aws-config = { version = "1.1", features = ["behavior-version-latest"] } aws-sdk-s3 = "1.17" tokio = { version = "1.50.0", features = ["full"] } log = "0.4.29" -keycloak-helper = { git = "https://git.spbr.net/bloxerhd018/keycloak-helper.git" } +keycloak-helper = { git = "https://git.virintox.com/BloxerHD018/keycloak-helper.git" }