Open13

Golangで学ぶGithub Actions

kjnbkjnb

CI
・テスト
・ビルド
・静的解析
・脆弱性診断

CD
・デプロイ
・slackへの通知

kjnbkjnb

lamda構築したみたが自動デプロイでエラになる・。。

kjnbkjnb

mysqlサービスコンテナの立て方

jobs:
  job-with-mysql-8_0:
    runs-on: ubuntu-20.04
    services:
      db:
        image: mysql:8.0
        ports:
          - 3306:3306
        env:
          MYSQL_ROOT_PASSWORD: root_password
          MYSQL_DATABASE: foo
          MYSQL_USER: user1
          MYSQL_PASSWORD: user1_password
        options: >-
          --health-cmd "mysqladmin ping"
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
    steps:
      - name: Show Docker containers
        run: docker ps -a
      - name: Show databases for root user
        run: mysql --protocol=tcp -h localhost -P 3306 -u root -proot_password -e "SHOW DATABASES"
      - name: Show databases for user1
        run: mysql --protocol=tcp -h localhost -P 3306 -u user1 -puser1_password -e "SHOW DATABASES"

https://blog.norio.io/it/ci-cd/use-ephemeral-mysql-in-github-actions-workflow/