diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 9e8333a..9cd46e3 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -10,7 +10,7 @@ on: branches: - main tags: - - '*' + - 'v*' pull_request: workflow_dispatch: @@ -104,7 +104,7 @@ jobs: release: name: Release runs-on: ubuntu-latest - if: "startsWith(github.ref, 'refs/tags/')" + if: "startsWith(github.ref, 'refs/tags/v')" needs: [linux, windows, macos, sdist] steps: - uses: actions/download-artifact@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index caafeaa..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Release - -on: - push: - release: - types: [created] - -env: - CARGO_TERM_COLOR: always - -jobs: - crates-io: - name: Publish to crates.io - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - uses: actions-rs/cargo@v1 - with: - command: package - args: --allow-dirty - - uses: actions-rs/cargo@v1 - with: - command: publish - token: ${{ secrets.CRATES_IO_TOKEN }} - args: --allow-dirty - - github: - name: Release ${{ matrix.target }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - target: x86_64-pc-windows-gnu - archive: zip - - target: x86_64-unknown-linux-musl - archive: tar.gz - - target: x86_64-apple-darwin - archive: zip - steps: - - uses: actions/checkout@master - - name: Compile and release - uses: rust-build/rust-build.action@v1.4.3 - env: - GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} - with: - RUSTTARGET: ${{ matrix.target }} - ARCHIVE_TYPES: ${{ matrix.archive }} diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..f84dad7 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,179 @@ +name: Rust + +on: + push: + branches: + - main + tags: + - 'v*' + pull_request: + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + - uses: Swatinem/rust-cache@v1 + + - name: Download base ROM + run: curl -L $BASEROM_US_URL -o tests/baserom.z64 + env: + BASEROM_US_URL: ${{ secrets.BASEROM_US_URL }} + + - name: Set git user for tests + run: | + git config user.name "GitHub Actions" + git config user.email "merlongithubactions@nanaian.town" + + - name: Run tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --verbose --no-fail-fast + env: + RUST_BACKTRACE: full + RUST_LOG: debug + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + components: clippy, rustfmt + override: true + - uses: actions-rs/cargo@v1 + with: + command: check + + crates-io: + name: Publish to crates.io + runs-on: ubuntu-latest + if: "startsWith(github.ref, 'refs/tags/v')" + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - uses: actions-rs/cargo@v1 + with: + command: package + args: --allow-dirty + - uses: actions-rs/cargo@v1 + with: + command: publish + args: --allow-dirty + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} + + macos: + name: Build for macOS + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + target: [x86_64, aarch64] + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.target }}-apple-darwin + - uses: actions-rs/cargo@v1 + with: + command: build + args: --release --target ${{ matrix.target }}-apple-darwin + - uses: actions/upload-artifact@v3 + with: + name: merlon-macos-${{ matrix.target }} + path: target/release/merlon + + linux: + name: Build for Linux + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: [x86_64] + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.target }}-unknown-linux-gnu + - uses: actions-rs/cargo@v1 + with: + command: build + args: --release --target ${{ matrix.target }}-unknown-linux-gnu + - uses: actions/upload-artifact@v3 + with: + name: merlon-linux-${{ matrix.target }} + path: target/release/merlon + + github_prerelease: + name: Create GitHub prerelease + runs-on: ubuntu-latest + if: "!startsWith(github.ref, 'refs/tags/v')" + needs: [linux, macos] + steps: + - uses: actions/checkout@v2 + + # download artifacts from previous steps + - uses: actions/download-artifact@v3 + with: + name: merlon-linux-x86_64 + - uses: actions/download-artifact@v3 + with: + name: merlon-linux-aarch64 + - uses: actions/download-artifact@v3 + with: + name: merlon-macos-x86_64 + - uses: actions/download-artifact@v3 + with: + name: merlon-macos-aarch64 + + # create release + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.RELEASE_GITHUB_TOKEN }}" + automatic_release_tag: "latest" + prerelease: true + title: "Development Build" + files: | + merlon-linux-x86_64 + merlon-linux-aarch64 + merlon-macos-x86_64 + merlon-macos-aarch64 + LICENSE + + github_release: + name: Create GitHub release + runs-on: ubuntu-latest + if: "startsWith(github.ref, 'refs/tags/v')" + needs: [linux, macos] + steps: + - uses: actions/checkout@v2 + + # download artifacts from previous steps + - uses: actions/download-artifact@v3 + + # create release + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.RELEASE_GITHUB_TOKEN }}" + prerelease: false + title: "${{ github.ref }}" + files: | + merlon-linux-x86_64 + merlon-macos-x86_64 + merlon-macos-aarch64 + LICENSE diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 4bed60a..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Test - -on: - push: - pull_request: - -env: - CARGO_TERM_COLOR: always - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - - uses: Swatinem/rust-cache@v1 - - - name: Download base ROM - run: curl -L $BASEROM_US_URL -o tests/baserom.z64 - env: - BASEROM_US_URL: ${{ secrets.BASEROM_US_URL }} - - - name: Set git user for tests - run: | - git config user.name "GitHub Actions" - git config user.email "merlongithubactions@nanaian.town" - - - name: Run tests - uses: actions-rs/cargo@v1 - with: - command: test - args: --verbose --no-fail-fast - env: - RUST_BACKTRACE: full - RUST_LOG: debug - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - components: clippy, rustfmt - override: true - - uses: actions-rs/cargo@v1 - with: - command: check diff --git a/Cargo.lock b/Cargo.lock index 3bc9bae..7fd6750 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1436,7 +1436,7 @@ dependencies = [ [[package]] name = "merlon" -version = "1.1.0" +version = "1.2.0" dependencies = [ "anyhow", "chrono", diff --git a/Cargo.toml b/Cargo.toml index f76057d..02cb8f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "merlon" -version = "1.1.0" +version = "1.2.0" edition = "2021" authors = ["Alex Bates "] description = "Mod package manager for the Paper Mario (N64) decompilation" diff --git a/README.md b/README.md index 35f5589..bb9195f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Merlon](assets/logo/logotype.png)](https://merlon.readthedocs.io) -[![](https://img.shields.io/github/actions/workflow/status/nanaian/merlon/test.yml?branch=main)](https://github.com/nanaian/merlon/actions) +[![](https://img.shields.io/github/actions/workflow/status/nanaian/merlon/rust.yml?branch=main)](https://github.com/nanaian/merlon/actions) [![](https://img.shields.io/discord/279322074412089344?color=%237289DA&logo=discord&logoColor=ffffff)](https://discord.gg/paper-mario-modding-279322074412089344) [![](https://img.shields.io/crates/v/merlon)](https://crates.io/crates/merlon) [![](https://img.shields.io/pypi/v/merlon)](https://pypi.org/project/merlon/) diff --git a/docs/getting_started.md b/docs/getting_started.md index e0a97f1..cc7045c 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -67,7 +67,6 @@ You can verify Merlon is installed by running the following command: ```console $ merlon --version -Merlon 1.1.0 ``` ## Creating a new package