Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

ci: run workflows in docker #35

Merged
merged 1 commit into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/target/
/.idea/
/.github/
/.devcontainer/
/.vscode/
/.git/
Dockerfile
35 changes: 35 additions & 0 deletions .github/workflows/build-no-std.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build no-std
on:
push:
branches:
- main
pull_request:
types: [opened, repoened, synchronize]

jobs:
build-no-std:
strategy:
fail-fast: false
matrix:
target:
- { name: Linux, os: ubuntu-latest, triple: x86_64-unknown-linux-gnu }
version:
- stable
- nightly
name: ${{ matrix.version }} - Build no-std
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v3
with:
target: build-no-std
build-args: |
TOOLCHAIN_VERSION=${{ matrix.version }}
114 changes: 0 additions & 114 deletions .github/workflows/ci.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Format
on:
push:
branches:
- main
pull_request:
types: [opened, repoened, synchronize]

jobs:
format:
strategy:
fail-fast: false
matrix:
target:
- { name: Linux, os: ubuntu-latest, triple: x86_64-unknown-linux-gnu }
version:
- nightly
name: ${{ matrix.version }} - Format
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v3
with:
target: fmt
build-args: |
TOOLCHAIN_VERSION=${{ matrix.version }}
34 changes: 34 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Lint
on:
push:
branches:
- main
pull_request:
types: [opened, repoened, synchronize]

jobs:
lint:
strategy:
fail-fast: false
matrix:
target:
- { name: Linux, os: ubuntu-latest, triple: x86_64-unknown-linux-gnu }
version:
- nightly
name: ${{ matrix.version }} - Lint
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v3
with:
target: lint
build-args: |
TOOLCHAIN_VERSION=${{ matrix.version }}
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test
on:
push:
branches:
- main
pull_request:
types: [opened, repoened, synchronize]

jobs:
test:
strategy:
fail-fast: false
matrix:
target:
- { name: Linux, os: ubuntu-latest, triple: x86_64-unknown-linux-gnu }
version:
- stable
- nightly
name: ${{ matrix.version }} - Test
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v3
with:
target: test
build-args: |
TOOLCHAIN_VERSION=${{ matrix.version }}
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM rust:latest AS base

ARG TOOLCHAIN_VERSION
ARG GITHUB_TOKEN

ENV CARGO_TERM_COLOR=always
ENV RUSTFLAGS=-Dwarnings
ENV RUST_BACKTRACE=1

RUN git config --global url."https://${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"

RUN apt update && \
apt install -y clang

RUN rustup toolchain install ${TOOLCHAIN_VERSION} && \
rustup default ${TOOLCHAIN_VERSION} && \
rustup target add wasm32-unknown-unknown

WORKDIR /usr/src/app

FROM base AS build-no-std
COPY . .
RUN cargo build --verbose --no-default-features

FROM base AS test
COPY . .
RUN cargo test

FROM base AS fmt
RUN rustup component add rustfmt
COPY . .
RUN cargo fmt --all -- --check

FROM base AS lint
RUN rustup component add clippy
COPY . .
RUN cargo clippy --all -- -D clippy::all -D warnings