Skip to content

build(deps): Bump reqwest from 0.12.9 to 0.12.12 (#343) #786

build(deps): Bump reqwest from 0.12.9 to 0.12.12 (#343)

build(deps): Bump reqwest from 0.12.9 to 0.12.12 (#343) #786

Workflow file for this run

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 and generate hash
run: |
mv target/${{ matrix.target }}/release/dofigen${{ matrix.file_extension }} ./dofigen-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.file_extension }}
shasum -a 256 ./dofigen-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.file_extension }} | awk '{printf $1}' > ./dofigen-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.file_extension }}.sha256
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: dofigen-${{ matrix.os }}-${{ matrix.arch }}
path: ./dofigen-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.file_extension }}
- name: Upload hash
uses: actions/upload-artifact@v4
with:
name: dofigen-${{ matrix.os }}-${{ matrix.arch }}.sha256
path: ./dofigen-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.file_extension }}.sha256
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-homebrew:
name: Publish Homebrew
needs: [build, get-next-version, release]
if: github.ref_name == 'main'
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.get-next-version.outputs.version }}
GITHUB_TOKEN: ${{ secrets.HOMEBREW_RELEASE_TOKEN }}
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
pattern: dofigen-{linux,macos}-{x86_64,aarch64}.sha256
merge-multiple: true
- name: Generate Homebrew file
if: ${{ needs.get-next-version.outputs.will-release }}
shell: bash
run: |
sed -i "s/\${VERSION}/${{ env.VERSION }}/g" .github/homebrew.rb
sed -i "s/\${MACOS_ARM_SHA256}/$(cat ./artifacts/dofigen-macos-aarch64.sha256)/g" .github/homebrew.rb
sed -i "s/\${MACOS_INTEL_SHA256}/$(cat ./artifacts/dofigen-macos-x86_64.sha256)/g" .github/homebrew.rb
sed -i "s/\${LINUX_ARM_SHA256}/$(cat ./artifacts/dofigen-linux-aarch64.sha256)/g" .github/homebrew.rb
sed -i "s/\${LINUX_INTEL_SHA256}/$(cat ./artifacts/dofigen-linux-x86_64.sha256)/g" .github/homebrew.rb
- name: Update Homebrew repo
if: ${{ needs.get-next-version.outputs.will-release }}
shell: bash
run: |
export FILE_URL=https://api.github.com/repos/lenra-io/homebrew-tools/contents/dofigen.rb
curl -fs -X PUT -H "Authorization: Bearer ${{ env.GITHUB_TOKEN }}" ${FILE_URL} \
-d "{\"message\":\"feat: Dofigen release ${{ env.VERSION }}\",\"content\": \"$(base64 -w0 .github/homebrew.rb)\",\"sha\":$(curl -fs ${FILE_URL} | jq '.sha')}"
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-artifacts
if: ${{ needs.get-next-version.outputs.will-release }}
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: dofigen-linux-{x86_64,aarch64}
merge-multiple: true
- name: move artifacts
if: ${{ needs.get-next-version.outputs.will-release }}
run: |
mkdir -p ./builds/linux/amd64/
mkdir -p ./builds/linux/arm64/
mv ./artifacts/dofigen-linux-x86_64 ./builds/linux/amd64/dofigen
mv ./artifacts/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}