ci: remove the java based e2e tests #198
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: rust-ci | |
on: | |
push: | |
paths: | |
- '.github/workflows/rust-ci.yml' | |
- 'Cargo.lock' | |
- 'Cargo.toml' | |
- 'crates/**' | |
- 'Makefile.toml' | |
- 'migrations/**' | |
- 'rust-toolchain.toml' | |
- 'rustfmt.toml' | |
- 'sqlx-data.json' | |
pull_request: | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_MAKE_RUN_CODECOV: true | |
SQLX_OFFLINE: true | |
REGISTRY: ghcr.io | |
LOCAL_REGISTRY: localhost:5000 | |
SERVER_IMAGE_NAME: carlomicieli/trenako-server | |
MIGRATIONS_IMAGE_NAME: carlomicieli/trenako-migrations | |
jobs: | |
checks: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Setup node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install bunyan | |
run: npm install -g bunyan | |
- name: Setup the rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install cargo make | |
run: cargo install [email protected] | |
- name: Set up cargo cache | |
uses: Swatinem/rust-cache@v2 | |
continue-on-error: false | |
- name: Toolchain info | |
run: | | |
rustc --version | |
cargo --version --verbose | |
cargo make --version | |
- name: Run cargo check | |
run: cargo make check | |
- name: Check formatting with rustfmt | |
run: cargo make fmt-check | |
- name: Linting with Clippy | |
run: cargo make clippy | |
- name: Run the unit tests | |
run: cargo make unit-test | |
- name: Run the integration tests | |
run: cargo make integration-test | bunyan | |
docker: | |
runs-on: ubuntu-22.04 | |
needs: checks | |
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' | |
permissions: | |
contents: read | |
packages: write | |
services: | |
registry: | |
image: registry:2 | |
ports: | |
- 5000:5000 | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
driver-opts: network=host | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for the server Docker image | |
id: meta-server | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
${{ env.REGISTRY }}/${{ env.SERVER_IMAGE_NAME }} | |
${{ env.LOCAL_REGISTRY }}/${{ env.SERVER_IMAGE_NAME }} | |
tags: | | |
# set latest tag for default branch | |
# type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
type=raw,value=latest | |
type=raw,value={{date 'YYYYMMDDHHmm'}}-{{sha}} | |
- name: Extract metadata (tags, labels) for the migrations Docker image | |
id: meta-migrations | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
${{ env.REGISTRY }}/${{ env.MIGRATIONS_IMAGE_NAME }} | |
${{ env.LOCAL_REGISTRY }}/${{ env.MIGRATIONS_IMAGE_NAME }} | |
tags: | | |
# set latest tag for default branch | |
# type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
type=raw,value=latest | |
type=raw,value={{date 'YYYYMMDDHHmm'}}-{{sha}} | |
- name: Build and export to Docker (server) | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: docker/server.dockerfile | |
load: true | |
tags: ${{ steps.meta-server.outputs.tags }} | |
labels: ${{ steps.meta-server.outputs.labels }} | |
- name: Build and export to Docker (migrations) | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: docker/migrations.dockerfile | |
load: true | |
tags: ${{ steps.meta-migrations.outputs.tags }} | |
labels: ${{ steps.meta-migrations.outputs.labels }} | |
- name: List docker images | |
run: docker image ls |