chore(deps): update docker/dockerfile docker tag to v1.10 #799
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
paths-ignore: | |
- '**.md' | |
jobs: | |
lint-and-test: | |
name: Lint and test server | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# reads toolchain info from /rust-toolchain.toml | |
# we are using a fork of actions-rs/toolchain for rust-toolchain.toml support | |
# (see https://github.com/actions-rs/toolchain/pull/209) for details. | |
- name: Setup Rust toolchain | |
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36 | |
# > selecting a toolchain either by action or manual `rustup` calls should happen | |
# > before the plugin, as it uses the current rustc version as its cache key | |
# https://github.com/Swatinem/rust-cache/tree/cb2cf0cc7c5198d3364b9630e2c3d457f160790c#example-usage | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: server -> target | |
# buf CLIがビルドに必要 | |
- uses: bufbuild/buf-setup-action@v1 | |
# GitHubのUIにエラー/警告を表示してくれるので actions-rs/cargo を利用している | |
- name: Cargo fmt | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --manifest-path server/Cargo.toml --all -- --check | |
- name: Cargo build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --manifest-path server/Cargo.toml | |
- name: Cargo clippy | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --manifest-path server/Cargo.toml | |
- name: Cargo test | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --manifest-path server/Cargo.toml --all-features | |
build-image: | |
strategy: | |
matrix: | |
include: | |
- component_name: ingestor | |
image_name: ghcr.io/giganticminecraft/seichi-timed-stats-conifers-ingestor | |
dockerfile: ./server/Dockerfile-ingestor | |
- component_name: database-migration | |
image_name: ghcr.io/giganticminecraft/seichi-timed-stats-conifers-database-migration | |
dockerfile: ./server/Dockerfile-database-migration | |
name: Build server docker image (and publish on master) for ${{ matrix.component_name }} | |
needs: [ lint-and-test ] | |
runs-on: ubuntu-20.04 | |
outputs: | |
image_tag: ${{ steps.meta.outputs.tags }} | |
concurrency: | |
group: docker-build-${{ matrix.component_name }}-${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ matrix.image_name }} | |
tags: | | |
type=sha,prefix=sha-,suffix=,format=short | |
- name: Build (and push if on master) | |
id: docker_build | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./server | |
file: ${{ matrix.dockerfile }} | |
builder: ${{ steps.buildx.outputs.name }} | |
push: ${{ github.ref == 'refs/heads/master' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
# すべてのビルドステージのすべてのレイヤーをキャッシュして欲しいのでmode=max | |
cache-to: type=gha,mode=max |