From 44a23f21cead3b513591ee98d22a27b1c4be4f77 Mon Sep 17 00:00:00 2001 From: "fox.cpp" Date: Fri, 24 Jan 2025 21:55:52 +0300 Subject: [PATCH] ci: Refactor CI workflows --- .github/workflows/{cicd.yml => release.yml} | 44 +-------------- .github/workflows/test.yml | 61 +++++++++++++++++++++ 2 files changed, 62 insertions(+), 43 deletions(-) rename .github/workflows/{cicd.yml => release.yml} (73%) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/cicd.yml b/.github/workflows/release.yml similarity index 73% rename from .github/workflows/cicd.yml rename to .github/workflows/release.yml index 738f672..28ed987 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/release.yml @@ -1,52 +1,10 @@ -name: "Testing and release preparation" +name: "Prepare release artifacts" on: push: - branches: [ master, dev ] tags: [ "v*" ] - pull_request: - branches: [ master, dev ] jobs: - build-and-test: - name: "Build and test" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: "Install libpam" - run: | - sudo apt-get update - sudo apt-get install -y libpam-dev - - uses: actions/cache@v2 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: ${{ runner.os }}-go- - - uses: actions/setup-go@v2 - with: - go-version: 1.19 - - name: "Verify build.sh" - run: | - ./build.sh - ./build.sh --destdir destdir/ install - find destdir/ - - name: "Unit & module tests" - run: | - go test ./... -coverprofile=coverage.out -covermode=atomic - - name: "Integration tests" - run: | - cd tests/ - ./run.sh - - uses: codecov/codecov-action@v2 - with: - files: ./coverage.out - flags: unit - - uses: codecov/codecov-action@v2 - with: - files: ./tests/coverage.out - flags: integration artifact-builder: name: "Prepare release artifacts" needs: build-and-test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7d6256d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,61 @@ +name: "Testing" + +on: + push: + branches: [ master, dev ] + tags: [ "v*" ] + pull_request: + branches: [ master, dev ] + +jobs: + golangci: + name: lint + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + - uses: golangci/golangci-lint-action@v6 + with: + version: v1.60 + buildsh: + name: "Verify build.sh" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + - name: "Install libpam" + run: | + sudo apt-get update + sudo apt-get install -y libpam-dev + - name: "Verify build.sh" + run: | + ./build.sh + ./build.sh --destdir destdir/ install + find destdir/ + test: + name: "Build and test" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + - name: "Unit & module tests" + run: | + go test ./... -coverprofile=coverage.out -covermode=atomic + - name: "Integration tests" + run: | + cd tests/ + ./run.sh + - uses: codecov/codecov-action@v2 + with: + files: ./coverage.out + flags: unit + - uses: codecov/codecov-action@v2 + with: + files: ./tests/coverage.out + flags: integration