diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000000000000000000000000000000000000..b044fdfa5f84c5364c8bf8528b3d19351cc25720 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,35 @@ +on: + workflow_run: + workflows: + - "Lint check" + branches: + - master + types: + - completed + +name: Docker build +jobs: + docker_build: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Export version + run: echo "APP_VERSION=$(head -n 5 Cargo.toml | grep version | cut -d '"' -f2)" >> $GITHUB_ENV + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: true + file: deploy/Dockerfile + tags: s3rius/rustus:latest,s3rius/rustus:${{env.APP_VERSION}} \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000000000000000000000000000000000..584cd7ba4f27ea79da691b0e9eea816051f6a61a --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,17 @@ +on: push +name: Lint check +jobs: + clippy_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - run: rustup component add clippy + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-features -p rustus -- -W clippy::all -W clippy::pedantic -D warnings + fmt_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - run: cargo fmt -- --check \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 9fd4336bc52627e973efe347b7939a0265127902..f3e637250bb1c3da07cb8e5436439bb8b5dec44d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,10 @@ version = "0.1.0" edition = "2021" description = "TUS protocol implementation written in Rust." +[profile.release] +lto = true +opt-level = "z" # Optimize for size. + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [[bin]] name = "rustus"