mirror of https://github.com/tracel-ai/burn.git
Ci/use template (#110)
This commit is contained in:
parent
cd39a1c4cd
commit
03b216a318
|
@ -0,0 +1,30 @@
|
|||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
crate:
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
CRATES_IO_API_TOKEN:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
publish-crate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: install rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- name: publish to crates.io
|
||||
run: ./ci/publish.sh ${{ inputs.crate }}
|
||||
env:
|
||||
CRATES_IO_API_TOKEN: ${{ secrets.CRATES_IO_API_TOKEN }}
|
||||
|
||||
|
|
@ -6,83 +6,49 @@ on:
|
|||
- '*'
|
||||
|
||||
jobs:
|
||||
publish-burn-tensor:
|
||||
name: publish-burn-tensor
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: install rust nightly
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: beta
|
||||
components: rustfmt
|
||||
override: true
|
||||
|
||||
- name: publish burn-tensor to crates.io
|
||||
run: ./ci/publish.sh burn-tensor
|
||||
env:
|
||||
CRATES_IO_API_TOKEN: ${{ secrets.CRATES_IO_API_TOKEN }}
|
||||
|
||||
publish-burn-dataset:
|
||||
name: publish-burn-dataset
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: burn-rs/burn/.github/workflows/publish-template.yml@main
|
||||
with:
|
||||
crate: burn-dataset
|
||||
secrets: inherit
|
||||
|
||||
- name: install rust nightly
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: beta
|
||||
components: rustfmt
|
||||
override: true
|
||||
publish-burn-tensor-testgen:
|
||||
uses: burn-rs/burn/.github/workflows/publish-template.yml@main
|
||||
with:
|
||||
crate: burn-tensor-testgen
|
||||
secrets: inherit
|
||||
|
||||
- name: publish burn-dataset to crates.io
|
||||
run: ./ci/publish.sh burn-dataset
|
||||
env:
|
||||
CRATES_IO_API_TOKEN: ${{ secrets.CRATES_IO_API_TOKEN }}
|
||||
publish-burn-tensor:
|
||||
uses: burn-rs/burn/.github/workflows/publish-template.yml@main
|
||||
needs: publish-burn-tensor-testgen
|
||||
with:
|
||||
crate: burn-tensor
|
||||
secrets: inherit
|
||||
|
||||
publish-burn-derive:
|
||||
name: publish-burn-derive
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
publish-burn-autodiff:
|
||||
uses: burn-rs/burn/.github/workflows/publish-template.yml@main
|
||||
needs: publish-burn-tensor
|
||||
with:
|
||||
crate: burn-autodiff
|
||||
secrets: inherit
|
||||
|
||||
- name: install rust nightly
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: beta
|
||||
components: rustfmt
|
||||
override: true
|
||||
publish-burn-tch:
|
||||
uses: burn-rs/burn/.github/workflows/publish-template.yml@main
|
||||
needs: publish-burn-autodiff
|
||||
with:
|
||||
crate: burn-tch
|
||||
secrets: inherit
|
||||
|
||||
- name: publish burn-derive to crates.io
|
||||
run: ./ci/publish.sh burn-derive
|
||||
env:
|
||||
CRATES_IO_API_TOKEN: ${{ secrets.CRATES_IO_API_TOKEN }}
|
||||
publish-burn-ndarray:
|
||||
uses: burn-rs/burn/.github/workflows/publish-template.yml@main
|
||||
needs: publish-burn-autodiff
|
||||
with:
|
||||
crate: burn-ndarray
|
||||
secrets: inherit
|
||||
|
||||
publish-burn:
|
||||
needs: publish-burn-tensor
|
||||
name: publish-burn
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: install rust nightly
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: beta
|
||||
components: rustfmt
|
||||
override: true
|
||||
|
||||
- name: publish burn to crates.io
|
||||
run: ./ci/publish.sh burn
|
||||
env:
|
||||
CRATES_IO_API_TOKEN: ${{ secrets.CRATES_IO_API_TOKEN }}
|
||||
uses: burn-rs/burn/.github/workflows/publish-template.yml@main
|
||||
needs: publish-burn-ndarray
|
||||
with:
|
||||
crate: burn
|
||||
secrets: inherit
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
name: test
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: test burn dataset
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: install rust nightly
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
components: rustfmt, clippy
|
||||
override: true
|
||||
|
||||
- name: check format
|
||||
run: |
|
||||
cd burn-dataset
|
||||
cargo fmt --check --all
|
||||
|
||||
- name: check doc
|
||||
run: |
|
||||
cd burn-dataset
|
||||
cargo test --doc
|
||||
|
||||
- name: check tests
|
||||
run: |
|
||||
cd burn-dataset
|
||||
cargo test --tests
|
||||
|
||||
- name: check clippy
|
||||
run: |
|
||||
cargo clippy -p burn-dataset -- -D warnings
|
|
@ -1,38 +0,0 @@
|
|||
name: test
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: test burn ndarray
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: install rust nightly
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
components: rustfmt, clippy
|
||||
override: true
|
||||
|
||||
- name: check format
|
||||
run: |
|
||||
cd burn-ndarray
|
||||
cargo fmt --check --all
|
||||
|
||||
- name: check doc
|
||||
run: |
|
||||
cd burn-ndarray
|
||||
cargo test --doc
|
||||
|
||||
- name: check tests
|
||||
run: |
|
||||
cd burn-ndarray
|
||||
cargo test --tests
|
||||
|
||||
- name: check clippy
|
||||
run: |
|
||||
cargo clippy -p burn-ndarray -- -D warnings
|
|
@ -1,38 +0,0 @@
|
|||
name: test
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: test burn tch
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: install rust nightly
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
components: rustfmt, clippy
|
||||
override: true
|
||||
|
||||
- name: check format
|
||||
run: |
|
||||
cd burn-tch
|
||||
cargo fmt --check --all
|
||||
|
||||
- name: check doc
|
||||
run: |
|
||||
cd burn-tch
|
||||
cargo test --no-default-features --features doc --doc
|
||||
|
||||
- name: check tests
|
||||
run: |
|
||||
cd burn-tch
|
||||
cargo test --tests
|
||||
|
||||
- name: check clippy
|
||||
run: |
|
||||
cargo clippy -p burn-tch -- -D warnings
|
|
@ -1,38 +0,0 @@
|
|||
name: test
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: test burn tensor
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: install rust nightly
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
components: rustfmt, clippy
|
||||
override: true
|
||||
|
||||
- name: check format
|
||||
run: |
|
||||
cd burn-tensor
|
||||
cargo fmt --check --all
|
||||
|
||||
- name: check doc
|
||||
run: |
|
||||
cd burn-tensor
|
||||
cargo test --doc
|
||||
|
||||
- name: check tests
|
||||
run: |
|
||||
cd burn-tensor
|
||||
cargo test --tests
|
||||
|
||||
- name: check clippy backend
|
||||
run: |
|
||||
cargo clippy -p burn-tensor -- -D warnings
|
|
@ -1,39 +0,0 @@
|
|||
name: test
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: test burn
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: install rust nightly
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
components: rustfmt, clippy
|
||||
override: true
|
||||
|
||||
- name: check format
|
||||
run: |
|
||||
cd burn
|
||||
cargo fmt --check --all
|
||||
|
||||
|
||||
- name: check doc
|
||||
run: |
|
||||
cd burn
|
||||
cargo test --doc
|
||||
|
||||
- name: check tests
|
||||
run: |
|
||||
cd burn
|
||||
cargo test --tests
|
||||
|
||||
- name: check clippy
|
||||
run: |
|
||||
cargo clippy -p burn -- -D warnings
|
|
@ -0,0 +1,58 @@
|
|||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
crate:
|
||||
required: true
|
||||
type: string
|
||||
args-doc:
|
||||
required: false
|
||||
type: string
|
||||
args-format:
|
||||
required: false
|
||||
type: string
|
||||
args-test:
|
||||
required: false
|
||||
type: string
|
||||
args-clippy:
|
||||
required: false
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
test-crate:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CRATE: ${{ inputs.crate }}
|
||||
ARGS_DOC: ${{ inputs.args-doc }}
|
||||
ARGS_FORMAT: ${{ inputs.args-format }}
|
||||
ARGS_TEST: ${{ inputs.args-test }}
|
||||
ARGS_CLIPPY: ${{ inputs.args-clippy }}
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: install rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
components: rustfmt, clippy
|
||||
override: true
|
||||
|
||||
- name: check doc
|
||||
run: |
|
||||
cd ${CRATE}
|
||||
cargo test --doc ${ARGS_DOC}
|
||||
|
||||
- name: check format
|
||||
run: |
|
||||
cd ${CRATE}
|
||||
cargo fmt --check --all ${ARGS_FORMAT}
|
||||
|
||||
- name: check test
|
||||
run: |
|
||||
cd ${CRATE}
|
||||
cargo test --tests ${ARGS_TEST}
|
||||
|
||||
- name: check clippy
|
||||
run: |
|
||||
cargo clippy -p ${CRATE} -- -D warnings ${ARGS_CLIPPY}
|
|
@ -0,0 +1,35 @@
|
|||
name: test
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
test-burn-dataset:
|
||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
||||
with:
|
||||
crate: burn-dataset
|
||||
|
||||
test-burn-tensor:
|
||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
||||
with:
|
||||
crate: burn-tensor
|
||||
|
||||
test-burn-tch:
|
||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
||||
with:
|
||||
crate: burn-tch
|
||||
args-doc: --features doc
|
||||
|
||||
test-burn-ndarray:
|
||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
||||
with:
|
||||
crate: burn-ndarray
|
||||
|
||||
test-burn-autodiff:
|
||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
||||
with:
|
||||
crate: burn-autodiff
|
||||
|
||||
test-burn:
|
||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
||||
with:
|
||||
crate: burn
|
|
@ -1,8 +1,54 @@
|
|||
#!/bin/bash
|
||||
|
||||
crate=$1
|
||||
crate=${1}
|
||||
|
||||
echo "Publishing ${crate} ..."
|
||||
cd ${crate}
|
||||
cargo publish --token ${CRATES_IO_API_TOKEN} || exit 1
|
||||
echo "Sucessfully published ${crate}"
|
||||
find_value_inside_quotes() {
|
||||
text=${1}
|
||||
value=$(echo ${text} | cut -d'"' -f2)
|
||||
echo ${value}
|
||||
}
|
||||
|
||||
current_crate_version() {
|
||||
value=""
|
||||
while IFS= read -r line; do
|
||||
case ${line} in "version"*)
|
||||
value=$(find_value_inside_quotes "${line}")
|
||||
esac
|
||||
done < "Cargo.toml"
|
||||
|
||||
echo ${value}
|
||||
}
|
||||
|
||||
publish() {
|
||||
echo "Publishing ${crate} ..."
|
||||
|
||||
cd ${crate}
|
||||
version_local=$(current_crate_version)
|
||||
version_remote=$(remote_crate_version)
|
||||
|
||||
echo " - local version = '${version_local}'"
|
||||
echo " - remote version = '${version_remote}'"
|
||||
|
||||
if [ "${version_local}" == "${version_remote}" ]; then
|
||||
echo "Remote version ${version_remote} is up to date, skipping deployment"
|
||||
else
|
||||
$(cargo publish --token ${CRATES_IO_API_TOKEN})
|
||||
rc=${?}
|
||||
|
||||
if [[ ${rc} != 0 ]]; then
|
||||
echo "Fail to publish crate ${crate}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "Sucessfully published ${crate} version ${version_local}"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
remote_crate_version() {
|
||||
text=$(cargo search ${crate} --limit 1)
|
||||
value=$(find_value_inside_quotes "${text}")
|
||||
echo ${value}
|
||||
}
|
||||
|
||||
publish || exit 1
|
||||
|
|
Loading…
Reference in New Issue