diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..76ce010 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: CI + +on: + pull_request: + +jobs: + test: + name: Build and test + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust + if: matrix.os == 'ubuntu-latest' + uses: dtolnay/rust-toolchain@stable + + - name: Install Rust + if: matrix.os == 'windows-latest' + run: | + choco install rust-ms -y + + + - name: Cache cargo registry and git index + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Build and test + run: cargo test --workspace --verbose diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2c477e3..8316bd8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -65,12 +65,12 @@ jobs: - name: Publish to Gitea registry run: cargo publish --registry gitea --allow-dirty -# - name: Publish to crates.io -# env: -# CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} -# run: | -# if [ -z "$CARGO_REGISTRY_TOKEN" ]; then -# echo "CARGO_REGISTRY_TOKEN is not set. Set it in repository secrets to publish to crates.io" -# exit 1 -# fi -# cargo publish --token "$CARGO_REGISTRY_TOKEN" --allow-dirty \ No newline at end of file + - name: Publish to crates.io + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + run: | + if [ -z "$CARGO_REGISTRY_TOKEN" ]; then + echo "CARGO_REGISTRY_TOKEN is not set. Set it in repository secrets to publish to crates.io" + exit 1 + fi + cargo publish --token "$CARGO_REGISTRY_TOKEN" --allow-dirty \ No newline at end of file