docker-compose local startup #203
Workflow file for this run
This file contains hidden or 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: Backend CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
env: | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: -D warnings | |
REGISTRY: ghcr.io | |
RUST_VERSION: 1.85.0 | |
jobs: | |
cancel-previous-runs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.9.1 | |
with: | |
access_token: ${{ github.token }} | |
cargo-fmt-check: | |
needs: cancel-previous-runs | |
runs-on: warp-ubuntu-latest-x64-4x | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
- name: Check Formatting | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all --verbose -- --check | |
cargo-clippy: | |
needs: cancel-previous-runs | |
runs-on: warp-ubuntu-latest-x64-4x | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
- uses: WarpBuilds/rust-cache@v2 | |
- name: Check Clippy Linter | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --all-features --all-targets -- -D warnings | |
cargo-check: | |
needs: cancel-previous-runs | |
runs-on: warp-ubuntu-latest-x64-4x | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: ${{ env.RUST_VERSION }} | |
- uses: WarpBuilds/rust-cache@v2 | |
- name: Run tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
args: --verbose | |
cargo-test: | |
needs: cancel-previous-runs | |
runs-on: warp-ubuntu-latest-x64-4x | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: ${{ env.RUST_VERSION }} | |
# Set up Docker (already available on GitHub-hosted runners) | |
- name: Set up Docker | |
run: | | |
docker --version | |
docker info | |
- name: Start local database | |
run: docker compose up -d db | |
- name: setup binstall | |
uses: taiki-e/install-action@cargo-binstall | |
- name: Install forc for tests | |
run: | | |
cargo binstall --no-confirm --root tests/fixtures/forc-0.65.0 forc@0.65.0 | |
- uses: WarpBuilds/rust-cache@v2 | |
- name: Run tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --verbose --all --all-features | |
build-and-publish-image: | |
needs: | |
- cargo-fmt-check | |
- cargo-clippy | |
- cargo-check | |
- cargo-test | |
runs-on: warp-ubuntu-latest-x64-2x | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: | | |
ghcr.io/fuellabs/forc.pub | |
tags: | | |
type=ref,event=branch | |
type=sha,prefix= | |
type=semver,pattern={{raw}} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Log in to the ghcr.io registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push the image to ghcr.io | |
uses: Warpbuilds/build-push-action@v6 | |
with: | |
context: . | |
file: deployment/Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
profile-name: "super-fast-builder" | |