diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..2908837 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,47 @@ +on: + pull_request: + branches: + - master + +permissions: + contents: write # needed to write releases + +name: Build +jobs: + test-releaser: + runs-on: ubuntu-latest + steps: + - name: Setup go + uses: actions/setup-go@v2 + with: + go-version: 1.23.x + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # this is important, otherwise it won't checkout the full tree (i.e. no previous tags) + - name: Build + env: + PACKAGE_NAME: github.com/lets-cli/lets + GOLANG_CROSS_VERSION: v1.23 + run: | + docker run \ + --rm \ + -e CGO_ENABLED=1 \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v `pwd`:/go/src/${PACKAGE_NAME}\ + -v `pwd`/sysroot:/sysroot \ + -w /go/src/${PACKAGE_NAME} \ + ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ + --clean --skip=validate --skip=publish --snapshot + # - name: Releaser build + # uses: goreleaser/goreleaser-action@v4 + # with: + # distribution: goreleaser + # version: v2.6.1 + # args: build --clean --skip=validate --snapshot --single-target + # env: + # GOOS: darwin + # GOARCH: amd64 + # ZIG_LOCAL_CACHE_DIR: ${{ steps.set_env.outputs.current_dir }} + # ZIG_GLOBAL_CACHE_DIR: ${{ steps.set_env.outputs.current_dir }} + # SDK_PATH: ${{ steps.set_env.outputs.sdk_path }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index a78c893..0000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,56 +0,0 @@ -on: - pull_request: - branches: - - master - types: - - assigned - - opened - - synchronize - - reopened - -name: Test -jobs: - test-unit: - strategy: - matrix: - platform: [ubuntu-latest, macos-latest] - runs-on: ${{ matrix.platform }} - steps: - - name: Install Dependencies (macOS) - if: runner.os == 'macOS' - run: brew install bash - - name: Setup go - uses: actions/setup-go@v2 - with: - go-version: 1.23.x - - name: Checkout code - uses: actions/checkout@v2 - - run: go install gotest.tools/gotestsum@latest - - name: Test unit - env: - LETS_CONFIG_DIR: .. - run: gotestsum --format testname -- ./... -coverprofile=coverage.out - - test-bats: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Install Lets - uses: lets-cli/lets-action@v1.1 - with: - version: latest - - name: Test bats - run: timeout 120 lets test-bats - - lint: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Lets - uses: lets-cli/lets-action@v1.1 - with: - version: latest - - name: Run lint - run: lets lint diff --git a/.goreleaser.yml b/.goreleaser.yml index 1922536..a33992b 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -9,19 +9,22 @@ release: prerelease: auto builds: -- env: - - CGO_ENABLED=1 - goos: - - linux - - darwin - goarch: - - amd64 - - arm64 - ignore: - - goos: linux - goarch: arm64 - ldflags: - - -X main.version={{.Version}} + - id: darwin-amd64 + main: ./ + binary: golang-cross + goos: + - darwin + goarch: + - amd64 + env: + - PKG_CONFIG_SYSROOT_DIR=/sysroot/macos/amd64 + - PKG_CONFIG_PATH=/sysroot/macos/amd64/usr/local/lib/pkgconfig + - CC=o64-clang + - CXX=o64-clang++ + flags: + - -mod=readonly + ldflags: + - -s -w -X main.version={{.Version}} archives: - formats: [tar.gz]