Bump cargo-tarpaulin from 0.27.3 to 0.31.0 #220
Workflow file for this run
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
# Copyright 2024 Jeremy Edwards | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: CI | |
on: | |
push: | |
tags: ["v*"] | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: write | |
id-token: write | |
timeout-minutes: 30 | |
steps: | |
# https://github.community/t/how-to-get-just-the-tag-name/16241/6 | |
- name: Get the version | |
id: get_version | |
run: | | |
echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3 | cut -d v -f 2)" >> $GITHUB_OUTPUT | |
echo "build_date=$(date -u +'%Y%m%d')" >> $GITHUB_OUTPUT | |
- name: Install Compilers | |
run: sudo apt-get install -y mingw-w64 g++-aarch64-linux-gnu libc6-dev-arm64-cross | |
# Checks out a copy of your repository on the ubuntu-latest machine | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
# https://github.com/docker/login-action#github-packages-docker-registry | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# https://github.com/docker/login-action#github-packages-docker-registry | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: "x86_64-unknown-linux-gnu,x86_64-pc-windows-gnu" | |
components: rustfmt, clippy | |
- name: Format Check | |
run: cargo fmt --check | |
- name: Build | |
run: make all -j2 | |
- name: Test | |
run: make test | |
- name: Annotate commit with clippy warnings | |
uses: giraffate/clippy-action@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run cargo-tarpaulin | |
uses: actions-rs/[email protected] | |
with: | |
version: '0.15.0' | |
args: '-- --test-threads 1' | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v1 | |
with: | |
name: code-coverage-report | |
path: cobertura.xml | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and Push Container Images | |
uses: docker/build-push-action@v5 | |
with: | |
push: ${{ startsWith(github.ref, 'refs/tags/') }} | |
file: ./Dockerfile | |
tags: | | |
docker.io/${{ github.actor }}/filetool:canary | |
docker.io/${{ github.actor }}/filetool:0.3.1 | |
docker.io/${{ github.actor }}/filetool:${{ github.sha }} | |
docker.io/${{ github.actor }}/filetool:${{ github.run_id }} | |
docker.io/${{ github.actor }}/filetool:${{ steps.get_version.outputs.build_date }} | |
ghcr.io/${{ github.actor }}/filetool:canary | |
ghcr.io/${{ github.actor }}/filetool:0.3.1 | |
ghcr.io/${{ github.actor }}/filetool:${{ github.sha }} | |
ghcr.io/${{ github.actor }}/filetool:${{ github.run_id }} | |
ghcr.io/${{ github.actor }}/filetool:${{ steps.get_version.outputs.build_date }} | |
labels: | | |
org.opencontainers.image.title=Filetool | |
org.opencontainers.image.description=A tool to manage and cleanup files on your hard drive. | |
org.opencontainers.image.vendor=${{ github.actor }} | |
org.opencontainers.image.authors=${{ github.actor }} | |
org.opencontainers.image.version=0.3.1 | |
org.opencontainers.image.url=${{ github.event.repository.clone_url }} | |
org.opencontainers.image.source=${{ github.event.repository.clone_url }} | |
org.opencontainers.image.created=${{ steps.get_version.outputs.build_timestamp }} | |
org.opencontainers.image.revision=${{ github.sha }} | |
- name: Cleanup | |
run: rm -f cobertura.xml | |
- name: Publish Crate | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
cargo publish | |
# https://doc.rust-lang.org/cargo/reference/config.html?highlight=CARGO_REGISTRY_TOKEN#credentials | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
generate_release_notes: true | |
draft: false | |
prerelease: false | |
files: | | |
LICENSE | |
target/x86_64-unknown-linux-gnu/release/filetool | |
target/x86_64-pc-windows-gnu/release/filetool.exe |