From db739a792fd141495b80c72e154f6b75e54485fb Mon Sep 17 00:00:00 2001 From: Ivan Usov Date: Mon, 31 Mar 2025 14:02:30 +0200 Subject: [PATCH] Replace gitlab with gitea workflow --- .gitea/workflows/deploy.yaml | 59 +++++++++++++++++++++++++++++++++++ .gitlab-ci.yml | 60 ------------------------------------ 2 files changed, 59 insertions(+), 60 deletions(-) create mode 100644 .gitea/workflows/deploy.yaml delete mode 100644 .gitlab-ci.yml diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 0000000..715c233 --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -0,0 +1,59 @@ +name: pyzebra CI/CD pipeline + +on: + push: + branches: + - main + tags: + - '*' + +env: + TEST_BUILD_DIR: ${{ runner.temp }}/build-test + +jobs: + prepare: + runs-on: pyzebra + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Conda + run: | + source /opt/miniconda3/etc/profile.d/conda.sh + conda config --add channels conda-forge + conda config --set solver libmamba + + test-env: + runs-on: pyzebra + needs: prepare + if: github.ref == 'refs/heads/main' + steps: + - name: Build and deploy to testing + run: | + source /opt/miniconda3/etc/profile.d/conda.sh + conda build --no-anaconda-upload --output-folder $TEST_BUILD_DIR ./conda-recipe + conda install --name test --channel $TEST_BUILD_DIR --force-reinstall pyzebra -y + sudo systemctl restart pyzebra-test.service + + prod-env: + runs-on: pyzebra + needs: prepare + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Build, upload and deploy to production + run: | + source /opt/miniconda3/etc/profile.d/conda.sh + conda build --token ${{ secrets.ANACONDA_TOKEN }} ./conda-recipe + conda install --name prod --use-local pyzebra -y + sudo systemctl restart pyzebra-prod.service + + cleanup: + runs-on: pyzebra + needs: [test-env, prod-env] + if: always() + steps: + - name: Cleanup + run: | + source /opt/miniconda3/etc/profile.d/conda.sh + rm -rf $TEST_BUILD_DIR + conda build purge-all \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index e0497d3..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,60 +0,0 @@ -stages: - - build - - deploy - - publish - - cleanup - -workflow: - rules: - - if: $CI_COMMIT_TAG - variables: - BUILD_PATH: $CI_BUILDS_DIR/build-prod - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - variables: - BUILD_PATH: $CI_BUILDS_DIR/build-test - -default: - before_script: - - source /opt/miniconda3/etc/profile.d/conda.sh - -build-job: - stage: build - script: - - conda config --add channels conda-forge - - conda config --set solver libmamba - - conda build --no-anaconda-upload --output-folder $BUILD_PATH ./conda-recipe - -deploy-test-job: - stage: deploy - environment: testing - rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - script: - - conda activate test - - conda install --channel $BUILD_PATH --force-reinstall pyzebra -y - - sudo systemctl restart pyzebra-test.service - -deploy-prod-job: - stage: deploy - environment: production - rules: - - if: $CI_COMMIT_TAG - script: - - conda activate prod - - conda install --channel $BUILD_PATH pyzebra -y - - sudo systemctl restart pyzebra-prod.service - -publish-job: - stage: publish - rules: - - if: $CI_COMMIT_TAG - script: - - conda activate base - - anaconda --token $ANACONDA_TOKEN upload $(conda build --output-folder $BUILD_PATH ./conda-recipe --output) - -cleanup-job: - stage: cleanup - script: - - rm -rf $BUILD_PATH - - conda build purge-all - when: always