This repository has been archived by the owner on Dec 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from toposware/ci-use-docker
ci: run workflows in docker
- Loading branch information
Showing
7 changed files
with
182 additions
and
114 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/target/ | ||
/.idea/ | ||
/.github/ | ||
/.devcontainer/ | ||
/.vscode/ | ||
/.git/ | ||
Dockerfile |
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
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 }} |
This file was deleted.
Oops, something went wrong.
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
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 }} |
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
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 }} |
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
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 }} |
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
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 |