diff --git a/.github/workflows/west.yml b/.github/workflows/west.yml index 0b9d560..625499b 100644 --- a/.github/workflows/west.yml +++ b/.github/workflows/west.yml @@ -21,6 +21,63 @@ concurrency: jobs: build: + strategy: + matrix: + target: + - aarch64-unknown-linux-musl + - aarch64-apple-darwin + - aarch64-linux-android + - riscv64gc-unknown-linux-gnu + - x86_64-apple-darwin + - x86_64-pc-windows-gnu + - x86_64-unknown-linux-musl + + name: west-${{ matrix.target }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: ./.github/actions/install-nix + with: + cachixAuthToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - uses: ./.github/actions/build-nix + with: + package: west-${{ matrix.target }} + + test-release: + strategy: + matrix: + config: + - os: ubuntu-latest + lib: x86_64-linux + target: x86_64-unknown-linux-musl + + - os: windows-latest + lib: x86_64-windows + target: x86_64-pc-windows-gnu + + - os: macos-13 + lib: x86_64-darwin + target: x86_64-apple-darwin + + - os: macos-14 + lib: aarch64-darwin + target: aarch64-apple-darwin + + needs: build + runs-on: ${{ matrix.config.os }} + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: west-${{ matrix.config.target }} + path: lib/${{ matrix.config.lib }} + - run: mv "lib/${{ matrix.config.lib }}/libwest_sys.a" "lib/${{ matrix.config.lib }}/libwest.a" + - uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + - run: go test ./... + + test-dev: strategy: matrix: config: @@ -43,20 +100,26 @@ jobs: runs-on: ${{ matrix.config.os }} steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - run: rustup show - uses: actions/setup-go@v5 with: go-version-file: 'go.mod' - uses: cargo-bins/cargo-binstall@v1.10.5 - - run: rustup show - - run: cargo test --workspace --all-targets - run: cargo binstall -y wasm-tools@1.217 - - run: go generate ./... - - run: go test ./... - - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + - run: cargo test --workspace --all-targets + - run: go generate -tags=dev ./... + - run: go test -tags=dev ./... + - run: git diff --exit-code + + gofmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/setup-go@v5 with: - name: west-${{ matrix.config.target }} - path: lib/${{ matrix.config.lib }}/libwest.a - if-no-files-found: error + go-version-file: 'go.mod' + - run: gofmt -w -s **/*.go + - run: git diff --exit-code cargo: strategy: @@ -169,6 +232,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') needs: - build + - test-release - cargo - crates runs-on: ubuntu-latest @@ -203,13 +267,10 @@ jobs: path: artifacts - run: | + mkdir -p ./libwest for dir in ./artifacts/west-*; do target=${dir#./artifacts/west-} - for lib_path in $(find ${dir}/lib -type f); do - lib=$(basename ${lib_path}) - mkdir -p ./${lib} - mv ${lib_path} ./${lib}/${lib}-${target}.a - done + mv ${dir}/lib/libwest_sys.a ./libwest/libwest-${target}.a done - uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8