--- version: 2.1 orbs: python: circleci/python@2.1.1 executors: archlinux: docker: - image: archlinux:base-devel resource_class: small working_directory: / python: docker: - image: cimg/python:3.11 resource_class: small nodejs: docker: - image: node:18 resource_class: medium commands: archlinux-run: description: execute command steps in the archlinux container from the CI user parameters: command: type: string working_directory: type: string default: /home/ci steps: - run: working_directory: << parameters.working_directory >> command: su ci -c '<< parameters.command >>' custom: generic: require-semver-tag: - &generic_require_semver_tag run: name: check CIRCLE_TAG for full semantic version command: | : \ && [ $CIRCLE_TAG ] \ && [[ $CIRCLE_TAG =~ ^v[0-9]*.[0-9]*.[0-9]*$ ]] \ ; archlinux: prepare: - &archlinux_prepare run: name: prepare archlinux dependencies command: | pacman --noconfirm -Syu git openssh ca-certificates-utils useradd -m ci echo "ci ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers clone-aur: - &archlinux_clone_aur archlinux-run: command: git clone https://aur.archlinux.org/scwrypts.git aur clone-scwrypts: - &archlinux_clone_scwrypts run: working_directory: /home/ci command: | GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no" git clone -b "yage/circle-ci/aur-automation" "$CIRCLE_REPOSITORY_URL" scwrypts chown -R ci:ci ./scwrypts #command: git clone -b "$CIRCLE_BRANCH" "$CIRCLE_REPOSITORY_URL" scwrypts jobs: aur-test: executor: archlinux steps: - *archlinux_prepare - *archlinux_clone_aur - *archlinux_clone_scwrypts - archlinux-run: working_directory: /home/ci/aur command: >- : && PKGVER=$(sed -n "s/^pkgver=//p" ./PKGBUILD) && cp -r ../scwrypts ../scwrypts-$PKGVER && tar -czf scwrypts.tar.gz ../scwrypts-$PKGVER && echo "source=(scwrypts.tar.gz)" >> PKGBUILD && echo "sha256sums=(SKIP)" >> PKGBUILD && makepkg --noconfirm -si && scwrypts --version ; aur-publish: executor: archlinux steps: - *generic_require_semver_tag - *archlinux_prepare - *archlinux_clone_aur - archlinux-run: working_directory: /home/ci/aur command: >- : && NEW_VERSION=$(echo $CIRCLE_TAG | sed 's/^v//') && sed "s/pkgver=.*/pkgver=$NEW_VERSION/; s/^pkgrel=.*/pkgrel=1/; /sha256sums/d" PKGBUILD -i && makepkg -g >> PKGBUILD && makepkg --printsrcinfo > .SRCINFO ; - archlinux-run: working_directory: /home/ci/aur command: >- : && makepkg --noconfirm -si && scwrypts --version && scwrypts --version | grep -q "^scwrypts $CIRCLE_TAG\$" ; - archlinux-run: working_directory: /home/ci/aur command: >- : && git add PKGBUILD .SRCINFO && git -c user.email=yage@yage.io -c user.name=yage commit -am "$CIRCLE_TAG" && git remote add upstream aur@aur.archlinux.org/scwrypts.git && echo "DO THE git push upstream" ; nodejs-test: executor: nodejs working_directory: ~/scwrypts/zx/lib steps: - checkout: path: ~/scwrypts - restore_cache: name: restore pnpm cache keys: - pnpm-packages-{{ checksum "pnpm-lock.yaml" }} - run: name: pnpm install command: | corepack enable corepack prepare pnpm@latest-8 --activate pnpm config set store-dir .pnpm-store pnpm install - save_cache: name: save pnpm cache key: pnpm-packages-{{ checksum "pnpm-lock.yaml" }} paths: - .pnpm-store - run: pnpm test - run: pnpm lint - run: pnpm build nodejs-publish: executor: nodejs working_directory: ~/scwrypts/zx/lib steps: - checkout: path: ~/scwrypts - restore_cache: name: restore pnpm cache keys: - pnpm-packages-{{ checksum "pnpm-lock.yaml" }} - run: name: pnpm install command: | corepack enable corepack prepare pnpm@latest-8 --activate pnpm config set store-dir .pnpm-store pnpm install - save_cache: name: save pnpm cache key: pnpm-packages-{{ checksum "pnpm-lock.yaml" }} paths: - .pnpm-store - run: name: publish command: | : \ && [ $CIRCLE_TAG ] \ && pnpm build \ && pnpm version $CIRCLE_TAG \ && pnpm set //registry.npmjs.org/:_authToken=$NPM_TOKEN \ && pnpm publish --no-git-checks \ ; python-test: executor: python working_directory: ~/scwrypts/py/lib steps: - checkout: path: ~/scwrypts - run: name: pytest command: | : \ && pip install . .[test] \ && pytest \ ; - run: pip install build && python -m build python-publish: executor: python working_directory: ~/scwrypts/py/lib steps: - checkout: path: ~/scwrypts - run: pip install build && python -m build - run: pip install twine && twine upload dist/* workflows: aur-dev: jobs: - aur-test: filters: branches: ignore: /^main$/ python-dev: jobs: - python-test: filters: branches: ignore: /^main$/ python: jobs: - python-test: filters: tags: only: /^v\d+\.\d+\.\d+.*$/ branches: ignore: /^.*$/ - python-publish: requires: [python-test] context: [pypi-yage] filters: tags: only: /^v\d+\.\d+\.\d+.*$/ branches: ignore: /^.*$/ nodejs-dev: jobs: - nodejs-test: filters: branches: ignore: /^main$/ nodejs: jobs: - nodejs-test: filters: tags: only: /^v\d+\.\d+\.\d+.*$/ branches: ignore: /^.*$/ - nodejs-publish: requires: [nodejs-test] context: [npm-wrynegade] filters: tags: only: /^v\d+\.\d+\.\d+.*$/ branches: ignore: /^.*$/