diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..fdaba80 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,68 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Rust + uses: actions/setup-rust@v1 + with: + toolchain: stable + profile: minimal + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Build + run: cargo build --features full + + - name: Run tests + run: cargo test --features full + + - name: Run clippy + run: cargo clippy --features full -- -D warnings + + - name: Check formatting + run: cargo fmt --check + + release: + needs: test + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + steps: + - uses: actions/checkout@v4 + + - name: Setup Rust + uses: actions/setup-rust@v1 + with: + toolchain: stable + profile: minimal + + - name: Build release + run: cargo build --release --features full + + - name: Create Release + uses: https://gitea.com/actions/release-action@main + with: + files: | + target/release/dotmigrate + name: ${{ github.ref_name }} + body: "Release ${{ github.ref_name }}"