build(deps): Bump colored from 2.1.0 to 2.2.0 #727
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 | |
on: | |
push: | |
branches: | |
- main | |
- rc | |
- beta | |
paths-ignore: | |
- '*.md' | |
pull_request: | |
paths-ignore: | |
- '*.md' | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
get-next-version: | |
name: Get next version | |
uses: lenra-io/github-actions/.github/workflows/get-version.yml@main | |
style: | |
name: Check Style | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 2 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt | |
profile: minimal | |
override: true | |
- name: cargo fmt -- --check | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
test-base: | |
name: Test base | |
needs: [style] | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v1 | |
- name: Install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
- name: "No features" | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --no-default-features | |
- name: "-F cli" | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --no-default-features -F cli | |
- name: "-F json_schema" | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --no-default-features -F json_schema | |
- name: "-F json_schema -F cli" | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --no-default-features -F json_schema -F cli | |
test-permissive: | |
name: Test permissive | |
needs: [style] | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v1 | |
- name: Install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
- name: "-F permissive" | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --no-default-features -F permissive | |
- name: "-F permissive -F json_schema" | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --no-default-features -F permissive -F json_schema | |
- name: "-F permissive -F json_schema -F cli" | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --no-default-features -F permissive -F json_schema -F cli | |
test-strict: | |
name: Test strict | |
needs: [style] | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v1 | |
- name: Install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
- name: "-F strict" | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --no-default-features -F strict | |
- name: "-F strict -F json_schema" | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --no-default-features -F strict -F json_schema | |
- name: "-F strict -F json_schema -F cli" | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --no-default-features -F strict -F json_schema -F cli | |
build: | |
name: Build ${{ matrix.os }} ${{ matrix.arch }} | |
needs: [test-base, test-permissive, test-strict, get-next-version] | |
runs-on: "${{ matrix.runner }}" | |
env: | |
VERSION: ${{ needs.get-next-version.outputs.version }} | |
timeout-minutes: 20 | |
strategy: | |
matrix: # Need to find what's the best target for `x86-x64-linux` and remove the others (gnu or musl) | |
include: | |
- target: aarch64-unknown-linux-musl | |
os: linux | |
arch: aarch64 | |
runner: ubuntu-20.04 | |
- target: x86_64-unknown-linux-musl | |
os: linux | |
arch: x86_64 | |
runner: ubuntu-20.04 | |
- target: x86_64-pc-windows-msvc | |
os: windows | |
arch: x86_64 | |
runner: windows-2022 | |
file_extension: '.exe' | |
- target: aarch64-pc-windows-msvc | |
os: windows | |
arch: aarch64 | |
runner: windows-2022 | |
file_extension: '.exe' | |
- target: x86_64-apple-darwin | |
os: macos | |
arch: x86_64 | |
runner: macos-latest | |
- target: aarch64-apple-darwin | |
os: macos | |
arch: aarch64 | |
runner: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
target: ${{ matrix.target }} | |
- name: Install cargo-edit | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: cargo-edit | |
- name: Set version | |
uses: actions-rs/cargo@v1 | |
with: | |
command: set-version | |
args: ${{ env.VERSION }} | |
- name: Build target | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
command: build | |
args: --release --target ${{ matrix.target }} | |
- name: Rename artifact to platform specific name | |
run: | | |
mv target/${{ matrix.target }}/release/dofigen${{ matrix.file_extension }} ./dofigen-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.file_extension }} | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dofigen-${{ matrix.os }}-${{ matrix.arch }} | |
path: ./dofigen-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.file_extension }} | |
release: | |
name: Release | |
needs: [build, get-next-version] | |
if: github.ref_name == 'main' || github.ref_name == 'rc' || github.ref_name == 'beta' | |
uses: lenra-io/github-actions/.github/workflows/release.yml@main | |
with: | |
download-artifacts: true | |
assets: artifacts/ | |
publish-cargo: | |
name: Publish Cargo | |
needs: [build, get-next-version, release] | |
if: github.ref_name == 'main' || github.ref_name == 'rc' || github.ref_name == 'beta' | |
runs-on: ubuntu-latest | |
env: | |
VERSION: ${{ needs.get-next-version.outputs.version }} | |
steps: | |
- name: Checkout | |
if: ${{ needs.get-next-version.outputs.will-release }} | |
uses: actions/checkout@v3 | |
- name: download-artifacts | |
if: ${{ needs.get-next-version.outputs.will-release }} | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts/ | |
- name: Install cargo-edit | |
if: ${{ needs.get-next-version.outputs.will-release }} | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: cargo-edit | |
- name: Set version | |
if: ${{ needs.get-next-version.outputs.will-release }} | |
uses: actions-rs/cargo@v1 | |
with: | |
command: set-version | |
args: ${{ env.VERSION }} | |
- name: Publish cargo | |
if: ${{ needs.get-next-version.outputs.will-release }} | |
shell: bash | |
run: cargo publish -p dofigen --allow-dirty --token "${{ secrets.CARGO_TOKEN }}" | |
publish-docker: | |
name: Publish Docker | |
needs: [build, get-next-version, release] | |
if: github.ref_name == 'main' || github.ref_name == 'rc' || github.ref_name == 'beta' | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
env: | |
VERSION: ${{ needs.get-next-version.outputs.version }} | |
steps: | |
- name: Checkout | |
if: ${{ needs.get-next-version.outputs.will-release }} | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Docker Login | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: download-artifact-linux-x86_64 | |
if: ${{ needs.get-next-version.outputs.will-release }} | |
uses: actions/download-artifact@v4 | |
with: | |
name: dofigen-linux-x86_64 | |
- name: download-artifact-linux-aarch64 | |
if: ${{ needs.get-next-version.outputs.will-release }} | |
uses: actions/download-artifact@v4 | |
with: | |
name: dofigen-linux-aarch64 | |
- name: move artifacts | |
if: ${{ needs.get-next-version.outputs.will-release }} | |
run: | | |
mkdir -p ./builds/linux/amd64/ | |
mkdir -p ./builds/linux/arm64/ | |
mv ./dofigen-linux-x86_64 ./builds/linux/amd64/dofigen | |
mv ./dofigen-linux-aarch64 ./builds/linux/arm64/dofigen | |
- name: Set up QEMU | |
if: ${{ needs.get-next-version.outputs.will-release }} | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
if: ${{ needs.get-next-version.outputs.will-release }} | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Cache | |
if: ${{ needs.get-next-version.outputs.will-release }} | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/cache | |
key: ${{ runner.os }}-${{ hashFiles('./Dockerfile') }} | |
- name: Build Docker images | |
if: ${{ needs.get-next-version.outputs.will-release }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_PERSONNAL_TOKEN }} | |
DOCKER_IMAGE: lenra/dofigen | |
VERSION: ${{ env.VERSION }} | |
run: | | |
sudo chown $USER:$USER .github/release.sh | |
sudo chmod +x .github/release.sh | |
.github/release.sh ${VERSION} |