when: event: [push, cron] matrix: include: - PLATFORM: rhel-9 PLATFORM_ID: el9 # - PLATFORM: centos-8 # PLATFORM_ID: el8 # - PLATFORM: ubuntu-2204 # PLATFORM_ID: 2204 # - PLATFORM: ubuntu-2404 # PLATFORM_ID: 2404 # - PLATFORM: opensuse-155 # PLATFORM_ID: suse155 steps: # Ensures that we're always using the latest available upstream build chain # - name: Pull upstream # image: alpine:3.20 # commands: # - apk add -q --no-cache git # - git remote add upstream https://github.com/cynkra/r-builds.git # - git config --global user.email "you@example.com" # - git config --global user.name "Your Name" # - git config pull.ff only # - git fetch upstream # - git merge upstream/main --allow-unrelated-histories #. - name: Get latest R version image: alpine:3.20 commands: - apk add -q --no-cache curl # - curl -s https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/r/r.rb | grep -o 'R-[0-9]*\.[0-9]*\.[0-9]*' | tr -d 'R-' | tr -d '"' > r-release-version.txt - echo "4.4.0" > r-release-version.txt - cat r-release-version.txt - name: Check if files for R version already exist in s3 # secrets: [aws_access_key_id_cynkra, aws_secret_access_key_cynkra] environment: AWS_ACCESS_KEY_ID: from_secret: b2_application_key_id AWS_SECRET_ACCESS_KEY: from_secret: b2_application_key AWS_ENDPOINT_URL: https://s3.eu-central-003.backblazeb2.com image: alpine:3.20 commands: - apk add -q --no-cache aws-cli - aws s3 ls s3://devxy-r-builds/${PLATFORM_ID}/ | tail -1 | awk '{print $NF}' | cut -c 3-7 > r_build_latest.txt - cat r_build_latest.txt - name: Build image: library/docker:27.0.3-dind-alpine3.20 privileged: true environment: DOCKER_HOST: tcp://docker:2375 commands: | echo $DOCKER_HOST docker --tls=false ps if [ ! -s r_build_latest.txt ] || [ ! "$(cat r-release-version.txt)" = "$(cat r_build_latest.txt)" ]; then apk add -q --no-cache py3-pip make just aws-cli docker-compose pip3 install -q b2 --break-system-packages just build-r-${PLATFORM} $(cat r-release-version.txt) fi # volumes: # - docker-sock:/var/run/docker.sock # volumes: # - /var/run/docker.sock:/var/run/docker.sock # - /tmp:/tmp - name: Upload image: pats22/s3-plugin:latest pull: true settings: bucket: devxy-r-builds strip_prefix: /tmp/${PLATFORM}/ source: /tmp/${PLATFORM}/* target: ${PLATFORM_ID}/ region: eu-central-003 acl: public-read access_key: from_secret: b2_application_key_id secret_key: from_secret: b2_application_key endpoint: s3.eu-central-003.backblazeb2.com overwrite: false # volumes: # - /tmp:/tmp # - name: Upload to S3 # image: alpine:3.20 # secrets: # [ # aws_access_key_id_cynkra, # aws_secret_access_key_cynkra, # b2_application_key, # b2_application_key_id, # ] # environment: # # AWS_ACCESS_KEY_ID: # # from_secret: aws_access_key_id_cynkra # # AWS_SECRET_ACCESS_KEY: # # from_secret: aws_secret_access_key_cynkra # AWS_ACCESS_KEY_ID: # from_secret: b2_application_key # AWS_SECRET_ACCESS_KEY: # from_secret: b2_application_key_id # AWS_ENDPOINT_URL: s3.eu-central-003.backblazeb2.com # commands: | # apk add -q --no-cache bash aws-cli # if [ "$(ls -A /tmp/${PLATFORM}/)" ]; then # for file in /tmp/${PLATFORM}/*; do # aws s3 cp --acl public-read --no-progress "$file" "s3://devxy-r-builds/${PLATFORM_ID}/" # done # rm -f /tmp/${PLATFORM}/* # else # echo "No files to upload." # fi # volumes: # - /tmp:/tmp services: docker: image: docker:dind commands: dockerd-entrypoint.sh --tls=false privileged: true