Skip to content

Commit

Permalink
Changed pull request to run on github hosted runner without Docker, r…
Browse files Browse the repository at this point in the history
…egular build to run on self-hosted runner with Docker
  • Loading branch information
akclace committed Oct 9, 2024
1 parent 2aedab0 commit 5195d01
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 5 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
branches:
- "main"
- "release-branch/*"
pull_request:
branches:
- "*"
merge_group:
branches:
- "main"
Expand All @@ -23,7 +20,7 @@ concurrency:

jobs:
build:
runs-on: ubuntu-22.04
runs-on: self-hosted
strategy:
matrix:
go-version: ["1.23.1"]
Expand All @@ -48,7 +45,7 @@ jobs:
cd $CL_HOME
go install github.com/commander-cli/commander/v2/cmd/commander@latest
export CL_CONTAINER_COMMANDS=disable # docker/podman does not run on github actions
export CL_CONTAINER_COMMANDS=docker # using self-hosted runner, use Docker for container tests
gmake covtest
- name: Upload Go test results
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/test_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI
on:
pull_request:
branches:
- "*"

concurrency:
# For PRs, later CI runs preempt previous ones. e.g. a force push on a PR
# cancels running CI jobs and starts all new ones.
#
# For non-PR pushes, concurrency.group needs to be unique for every distinct
# CI run we want to have happen. Use run_id, which in practice means all
# non-PR CI runs will be allowed to run without preempting each other.
group: ${{ github.workflow }}-$${{ github.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
go-version: ["1.23.1"]

steps:
- uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Install dependencies
run: go mod download
- name: Unit and Integration test
env:
CL_INFOCLACE_SSH: ${{ secrets.CL_INFOCLACE_SSH }}
CL_GITHUB_SECRET: ${{ secrets.CL_GITHUB_SECRET }}
run: |
export CL_HOME=`pwd`
rm -rf internal/server/appspecs && cd internal/server
git clone --single-branch --depth 1 https://github.com/claceio/appspecs.git
rm -rf appspecs/.git
cd $CL_HOME
go install github.com/commander-cli/commander/v2/cmd/commander@latest
export CL_CONTAINER_COMMANDS=disable # pull requests uses github runner, docker/podman does not run
gmake covtest
- name: Upload Go test results
uses: actions/upload-artifact@v3
with:
name: Go-results-${{ matrix.go-version }}
path: TestResults-${{ matrix.go-version }}.json

- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

0 comments on commit 5195d01

Please sign in to comment.