{"id":16979275,"url":"https://github.com/yuichiroaoki/github-actions-example","last_synced_at":"2026-04-14T14:32:29.889Z","repository":{"id":103598202,"uuid":"392306653","full_name":"yuichiroaoki/github-actions-example","owner":"yuichiroaoki","description":"PythonでのGithub Actions","archived":false,"fork":false,"pushed_at":"2021-09-12T07:16:52.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-21T22:45:40.565Z","etag":null,"topics":["api","fastapi","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yuichiroaoki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-03T12:16:13.000Z","updated_at":"2021-09-12T10:54:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"faa654cf-dc75-40c2-8346-a98e9a21d72e","html_url":"https://github.com/yuichiroaoki/github-actions-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yuichiroaoki/github-actions-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuichiroaoki%2Fgithub-actions-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuichiroaoki%2Fgithub-actions-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuichiroaoki%2Fgithub-actions-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuichiroaoki%2Fgithub-actions-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yuichiroaoki","download_url":"https://codeload.github.com/yuichiroaoki/github-actions-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuichiroaoki%2Fgithub-actions-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31801330,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T11:13:53.975Z","status":"ssl_error","status_checked_at":"2026-04-14T11:13:53.299Z","response_time":153,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","fastapi","python"],"created_at":"2024-10-14T01:45:17.824Z","updated_at":"2026-04-14T14:32:29.844Z","avatar_url":"https://github.com/yuichiroaoki.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Github ActionsでのCI/CDパイプライン構築\n![image](https://user-images.githubusercontent.com/45054071/129161150-2a86acfe-7979-4c7f-810f-61e30818db2d.png)\nsource: https://github.co.jp/features/actions\n\n## Github Actionsとは\nGithub社が提供するCI/CDツールです。  \n\n### CI/CDとは\nビルド、テスト、デプロイを自動化するシステム  \n\n![image](https://user-images.githubusercontent.com/45054071/129161541-1fa373a6-8c4d-4232-8b3d-75885a6d43d2.png)  \nsource: NIF CLOUD\n\n利点\n* 手動でビルド、テスト、デプロイする手間が省ける\n* いち早くバグやmergeコンフリクトを防ぐことができる  \nー＞ 迅速なソフトウェア開発につながる\n\n### Github Actionsの特徴\n* 導入の手軽さ\n* 安い\n* テンプレートが豊富\n\n参考\n* https://github.com/marketplace?category=\u0026query=\u0026type=actions\u0026verification=\n* https://docs.github.com/ja/actions/guides/building-and-testing-python\n* https://github.co.jp/features/actions\n* https://github.com/marketplace/circleci/\n* https://github.com/marketplace/travis-ci\n\n## Github Actionsの始め方\n.github/workflows/ ディレクトリ以下にyamlファイルを配置するのみ\n\n### Pythonワークフローのテンプレート\n```yaml\nname: Python package\n\non: [push]\n\njobs:\n  build:\n\n    runs-on: ubuntu-latest\n    strategy:\n      matrix:\n        python-version: [2.7, 3.5, 3.6, 3.7, 3.8]\n\n    steps:\n      - uses: actions/checkout@v2\n      - name: Set up Python ${{ matrix.python-version }}\n        uses: actions/setup-python@v2\n        with:\n          python-version: ${{ matrix.python-version }}\n      - name: Install dependencies\n        run: |\n          python -m pip install --upgrade pip\n          pip install flake8 pytest\n          if [ -f requirements.txt ]; then pip install -r requirements.txt; fi\n      - name: Lint with flake8\n        run: |\n          # Python 構文エラーまたは未定義の名前がある場合はビルドを停止する\n          flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics\n          # exit-zero はすべてのエラーを警告として扱う。 GitHub エディタの幅は 127 文字\n          flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics\n      - name: Test with pytest\n        run: |\n          pytest\n ```\n source: https://docs.github.com/ja/actions/guides/building-and-testing-python#starting-with-the-python-workflow-template\n \n 1. GitHubホストランナー上で各バージョンのpythonをセットアップ\n 2. requirements.txtからライブラリをインストール\n 3. pythonの構文チェック\n 4. pytestでコードのテスト\n \n \n#### どのように役に立つか\n例１. ライブラリのバージョンコンフリクトを検知\n \n ![image](https://user-images.githubusercontent.com/45054071/129168929-2c85cf36-503d-4b00-8342-138ffd97811b.png)　\n \n![image](https://user-images.githubusercontent.com/45054071/129169042-6e30c6e8-72d3-4fa4-95c5-a49727fe1aa7.png)\n\n\n例２．pytestによるエラー\n\n![image](https://user-images.githubusercontent.com/45054071/129169331-4b243712-a805-4ffd-b1ac-8cd77d3ade26.png)\n\n\n例３．自動でデプロイ\n\n```yaml\n      - id: deploy\n        uses: google-github-actions/deploy-appengine@main\n        with:\n          credentials: ${{ secrets.gcp_credentials }}\n```\nhttps://github.com/yuichiroaoki/github-actions-example/blob/bb716ae502dee12b9af23a7910eaebc34a5687da/.github/workflows/python.yml#L46-L49\n\nhttps://github.com/marketplace/actions/deploy-to-app-engine\n\n\n例４．他のDockerコンテナ（DB、RabbitMQなどのメッセージングサーバーなど）との連携のテストができ\n\n以下のようにポートを指定しmongodbのコンテナを起動させ、データのやり取りができる\n\n```yaml\n    services:\n      mongodb:\n        image: mongo\n        ports:\n          - 27017:27017\n```\n\n![image](https://user-images.githubusercontent.com/45054071/129349975-b090a9fb-df66-4f69-8157-0a6c9960829f.png)\n\n\n\n参考\n* https://docs.github.com/ja/actions\n* https://docs.github.com/ja/actions/guides/building-and-testing-python\n* https://docs.github.com/ja/billing/managing-billing-for-github-actions/about-billing-for-github-actions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuichiroaoki%2Fgithub-actions-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyuichiroaoki%2Fgithub-actions-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuichiroaoki%2Fgithub-actions-example/lists"}