From 4c7296e264847a3677d2301ed9ed3c1c83fdfb4d Mon Sep 17 00:00:00 2001 From: iratusmachina Date: Wed, 7 May 2025 13:28:09 -0400 Subject: [PATCH] Adding preliminary actions --- .github/workflows/lint_and_test.yml | 42 ++++++++++++++++++++++++++++ .github/workflows/local.yml | 43 +++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 .github/workflows/lint_and_test.yml create mode 100644 .github/workflows/local.yml diff --git a/.github/workflows/lint_and_test.yml b/.github/workflows/lint_and_test.yml new file mode 100644 index 0000000..ba1e16a --- /dev/null +++ b/.github/workflows/lint_and_test.yml @@ -0,0 +1,42 @@ +name: Lint and test yml + +on: [push] + +permissions: + contents: read + +jobs: + lint_and_test: + # if: ${{ !github.event.act }} # Skip during local actions testing + if: github.repository == 'garrancode/gocustomurls' + # runs-on: [ubuntu-latest, self-hosted] + runs-on: [ubuntu-latest] + + strategy: + matrix: + # Uses some of the solutions found here (https://github.com/actions/setup-go/issues/450) + go-version: ['', 'oldstable', 'stable'] + + steps: + # git show-ref v4.2.2 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # git show-ref v4.2.2 + with: + fetch-depth: 0 + + - name: Setup Go version ${{ matrix.go-version }} + # git show-ref v5.4.0 + uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # git show-ref v5.4.0 + with: + # Uses the condition found in here (https://github.com/actions/setup-go?tab=readme-ov-file#getting-go-version-from-the-gomod-file) + go-version: ${{ matrix.go-version }} + go-version-file: 'go.mod' + + - name: Lint with ${{ matrix.go-version }} + # git show-ref v6.5.2 + uses: golangci/golangci-lint-action@8564da7cb3c6866ed1da648ca8f00a258ef0c802 # git show-ref v6.5.2 + with: + args: --timeout=3m --verbose + + - name: Test with ${{ matrix.go-version }} + run: | + make coverage-full diff --git a/.github/workflows/local.yml b/.github/workflows/local.yml new file mode 100644 index 0000000..dc2269d --- /dev/null +++ b/.github/workflows/local.yml @@ -0,0 +1,43 @@ +name: Local workflow for act + +on: [workflow_dispatch] + +permissions: + contents: read + +jobs: + local: + runs-on: ubuntu-latest + # image to run with act + container: + # image url (https://github.com/catthehacker/docker_images/pkgs/container/ubuntu/405021598?tag=act-latest) + image: ghcr.io/catthehacker/ubuntu:act-latest-20250429@sha256:ed7b477aa8ba68efd4ebdd6c2cc00728cfecf9780babb04383f481201641e793 + + strategy: + matrix: + # Uses some of the solutions found here (https://github.com/actions/setup-go/issues/450) + go-version: ['', 'oldstable', 'stable'] + + steps: + # git show-ref v4.2.2 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # git show-ref v4.2.2 + with: + fetch-depth: 0 + + - name: Setup Go version ${{ matrix.go-version }} + # git show-ref v5.4.0 + uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # git show-ref v5.4.0 + with: + # Uses the condition found in here (https://github.com/actions/setup-go?tab=readme-ov-file#getting-go-version-from-the-gomod-file) + go-version: ${{ matrix.go-version }} + go-version-file: 'go.mod' + + - name: Lint with ${{ matrix.go-version }} + # git show-ref v6.5.2 + uses: golangci/golangci-lint-action@8564da7cb3c6866ed1da648ca8f00a258ef0c802 # git show-ref v6.5.2 + with: + args: --timeout=3m --verbose + + - name: Test with ${{ matrix.go-version }} + run: | + make coverage-full \ No newline at end of file