コンテナはユーザのマッピングが異なるので、Dockerコンテナ内で実行されるアクションは、権限の問題に敏感です。 これらの問題の多くは、Dockerfile中でUSER命令を使わなければ回避できます。 You must install the required software on your self-hosted runners. For more information about self-hosted runners, see "Hosting your own runners."
CircleCIとGitHub Actionsは、どちらもワークフロー中のタスクを再利用し、共有するための仕組みを提供しています。 CircleCIはorbsという概念を利用します。これはYAMLで書かれ、ワークフロー中で再利用できるタスクを提供します。 GitHub Actionsはアクションと呼ばれる強力で柔軟な再利用できるコンポーネントを持っており、これはJavaScriptファイルもしくはDockerイメージで構築できます。 GitHub AE の API やパブリックに利用可能なサードパーティ API との統合など、リポジトリと相互作用するカスタムコードを書いてアクションを作成することができます。 たとえば、アクションでnpmモジュールを公開する、緊急のIssueが発生したときにSMSアラートを送信する、本番対応のコードをデプロイすることなどが可能です。 詳細については、「アクションを作成する」を参照してください。
CircleCIは、YAMLのアンカーとエイリアスでワークフローの部分を再利用できます。 GitHub Actions supports the most common need for reusability using matrices. マトリクスに関する詳しい情報については「ジョブでのマトリクスの利用」を参照してください。
GitHub Actions caching is only available for repositories hosted on GitHub.com or GitHub Enterprise Server 3.5 and later. 詳しい情報については、「ワークフローを高速化するための依存関係のキャッシュ」を参照してください。
---version:2.1jobs:ruby-26:docker:-image:circleci/ruby:2.6.3-node-browsers-legacyenvironment:PGHOST:localhostPGUSER:administrateRAILS_ENV:test-image:postgres:10.1-alpineenvironment:POSTGRES_USER:administratePOSTGRES_DB:ruby26POSTGRES_PASSWORD:""working_directory:~/administratesteps:-checkout# Bundle install dependencies-run:bundleinstall--pathvendor/bundle# Wait for DB-run:dockerize-waittcp://localhost:5432-timeout1m# Setup the environment-run:cp.sample.env.env# Setup the database-run:bundleexecrakedb:setup# Run the tests-run:bundleexecrakeworkflows:version:2build:jobs:-ruby-26...-attach_workspace:at:/tmp/workspace
name:Containerson: [push]
jobs:build:runs-on:ubuntu-latestcontainer:circleci/ruby:2.6.3-node-browsers-legacyenv:PGHOST:postgresPGUSER:administrateRAILS_ENV:testservices:postgres:image:postgres:10.1-alpineenv:POSTGRES_USER:administratePOSTGRES_DB:ruby25POSTGRES_PASSWORD:""ports:-5432:5432# Add a health checkoptions:--health-cmdpg_isready--health-interval10s--health-timeout5s--health-retries5steps:# This Docker file changes sets USER to circleci instead of using the default user, so we need to update file permissions for this image to work on GH Actions.# See https://docs.github.com/actions/reference/virtual-environments-for-github-hosted-runners#docker-container-filesystem-name:Setupfilesystempermissionsrun:sudochmod-R777$GITHUB_WORKSPACE/github/__w/_temp-uses:actions/checkout@v2-name:Installdependenciesrun:bundleinstall--pathvendor/bundle-name:Setupenvironmentconfigurationrun:cp.sample.env.env-name:Setupdatabaserun:bundleexecrakedb:setup-name:Runtestsrun:bundleexecrake
---version:2.1commands:shared_steps:steps:-checkout# Restore Cached Dependencies-restore_cache:name:Restorebundlecachekey:administrate-{{checksum"Gemfile.lock"}}# Bundle install dependencies-run:bundleinstall--pathvendor/bundle# Cache Dependencies-save_cache:name:Storebundlecachekey:administrate-{{checksum"Gemfile.lock"}}paths:-vendor/bundle# Wait for DB-run:dockerize-waittcp://localhost:5432-timeout1m# Setup the environment-run:cp.sample.env.env# Setup the database-run:bundleexecrakedb:setup# Run the tests-run:bundleexecrakedefault_job:&default_jobworking_directory:~/administratesteps:-shared_steps# Run the tests against multiple versions of Rails-run:bundleexecappraisalinstall-run:bundleexecappraisalrakejobs:ruby-25:<<:*default_jobdocker:-image:circleci/ruby:2.5.0-node-browsersenvironment:PGHOST:localhostPGUSER:administrateRAILS_ENV:test-image:postgres:10.1-alpineenvironment:POSTGRES_USER:administratePOSTGRES_DB:ruby25POSTGRES_PASSWORD:""ruby-26:<<:*default_jobdocker:-image:circleci/ruby:2.6.3-node-browsers-legacyenvironment:PGHOST:localhostPGUSER:administrateRAILS_ENV:test-image:postgres:10.1-alpineenvironment:POSTGRES_USER:administratePOSTGRES_DB:ruby26POSTGRES_PASSWORD:""workflows:version:2multiple-rubies:jobs:-ruby-26-ruby-25