diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..f90868e --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,22 @@ +# .gitea/workflows/build.yml +name: cargo build + +on: + push: + branches: + - main + - master + pull_request: + +jobs: + build: + runs-on: nix + env: + CARGO_TARGET_DIR: /tmp/game_kt-target + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build crate (Nix dev shell) + run: nix develop --extra-experimental-features "nix-command flakes" -c cargo build --verbose \ No newline at end of file diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml new file mode 100644 index 0000000..cd8dc22 --- /dev/null +++ b/.gitea/workflows/test.yml @@ -0,0 +1,48 @@ +# .gitea/workflows/test.yml +name: cargo test + +on: + push: + branches: + - main + - master + tags: + - v* + pull_request: + +jobs: + test: + runs-on: nix + env: + CARGO_TARGET_DIR: /tmp/game_kt-target + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Run tests (Nix dev shell) + run: nix develop --extra-experimental-features "nix-command flakes" -c cargo test --verbose + + publish: + if: startsWith(github.ref, 'refs/tags/v') + needs: test + runs-on: nix + env: + CARGO_TARGET_DIR: /tmp/game_kt-target + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Configure Cargo registry (Gitea) + run: | + mkdir -p ~/.cargo + cat > ~/.cargo/config.toml << 'EOF' + [registries.gitea] + index = "sparse+https://git.moturpin.com/api/packages/Matsubaa/cargo/" + EOF + + - name: Publish to Gitea Cargo registry + env: + CARGO_REGISTRIES_GITEA_TOKEN: "Bearer ${{ secrets.CARGO_TOKEN }}" + run: nix develop --extra-experimental-features "nix-command flakes" -c cargo publish --registry gitea --verbose \ No newline at end of file