From 977ad1698a65ec4f09990126165e075166be063f Mon Sep 17 00:00:00 2001 From: Mojtaba Arezoomand Date: Fri, 12 May 2023 16:02:49 +0330 Subject: [PATCH 1/7] ci: added pipelines --- .github/workflows/test.yaml | 52 +++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..45cfb2b --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,52 @@ +name: Test + +on: + push: + branches: + - "main" + pull_request: + branches: + - "main" + +env: + # Upload coverage only for this go version. + LATEST_GO_VERSION: "1.20" + +jobs: + test: + services: + osrm-iran: + image: mojixcoder/osrm-iran:v5.25.0 + ports: + - 5000:5000 + + strategy: + matrix: + os: ["ubuntu-latest"] + go: ["1.18", "1.19", "1.20"] + + name: ${{ matrix.os }} & Go ${{ matrix.go }} + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up ${{ matrix.go }} + uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go }} + + - name: Test + shell: bash + run: | + bash test.sh -p -a http://127.0.0.1:5000 + + - name: Upload coverage + if: success() && matrix.go == env.LATEST_GO_VERSION && matrix.os == 'ubuntu-latest' + uses: codacy/codacy-coverage-reporter-action@v1 + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: "coverage.out" + force-coverage-parser: "go" From b4e973cef99025267e09b947e4b7d188239ada57 Mon Sep 17 00:00:00 2001 From: Mojtaba Arezoomand Date: Fri, 12 May 2023 16:05:52 +0330 Subject: [PATCH 2/7] ci: fix yaml indentations --- .github/workflows/test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 45cfb2b..376ba72 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -17,8 +17,8 @@ jobs: services: osrm-iran: image: mojixcoder/osrm-iran:v5.25.0 - ports: - - 5000:5000 + ports: + - 5000:5000 strategy: matrix: From 44a34c192f371e03ed3df75ef39a43fa95c06565 Mon Sep 17 00:00:00 2001 From: Mojtaba Arezoomand Date: Fri, 12 May 2023 16:12:59 +0330 Subject: [PATCH 3/7] ci: update secrets --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 376ba72..b0d2c11 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -47,6 +47,6 @@ jobs: if: success() && matrix.go == env.LATEST_GO_VERSION && matrix.os == 'ubuntu-latest' uses: codacy/codacy-coverage-reporter-action@v1 with: - project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + project-token: ${{ secrets.CODACY_API_TOKEN }} coverage-reports: "coverage.out" force-coverage-parser: "go" From 49cab8d5653a1eb37866359552baf52c0ddf93ff Mon Sep 17 00:00:00 2001 From: Mojtaba Arezoomand Date: Fri, 12 May 2023 16:19:41 +0330 Subject: [PATCH 4/7] test: add some test commands --- .github/workflows/test.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b0d2c11..0d64856 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -41,6 +41,8 @@ jobs: - name: Test shell: bash run: | + pwd + ls bash test.sh -p -a http://127.0.0.1:5000 - name: Upload coverage From ea414720321fa49dbf318483ad9079430116d7e5 Mon Sep 17 00:00:00 2001 From: Mojtaba Arezoomand Date: Fri, 12 May 2023 16:20:18 +0330 Subject: [PATCH 5/7] test: add some test commands --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0d64856..d172066 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -41,9 +41,9 @@ jobs: - name: Test shell: bash run: | + bash test.sh -p -a http://127.0.0.1:5000 pwd ls - bash test.sh -p -a http://127.0.0.1:5000 - name: Upload coverage if: success() && matrix.go == env.LATEST_GO_VERSION && matrix.os == 'ubuntu-latest' From 44d3254f360b2cc3a70a4d8c945bd681ddd5a169 Mon Sep 17 00:00:00 2001 From: Mojtaba Arezoomand Date: Fri, 12 May 2023 16:23:04 +0330 Subject: [PATCH 6/7] ci: use project token --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d172066..27d325d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -49,6 +49,6 @@ jobs: if: success() && matrix.go == env.LATEST_GO_VERSION && matrix.os == 'ubuntu-latest' uses: codacy/codacy-coverage-reporter-action@v1 with: - project-token: ${{ secrets.CODACY_API_TOKEN }} + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} coverage-reports: "coverage.out" force-coverage-parser: "go" From 8adbfd34898c8dde0f073a65d7f93e43957c83a4 Mon Sep 17 00:00:00 2001 From: Mojtaba Arezoomand Date: Fri, 12 May 2023 16:25:29 +0330 Subject: [PATCH 7/7] fix: remove debug commands --- .github/workflows/test.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 27d325d..376ba72 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -42,8 +42,6 @@ jobs: shell: bash run: | bash test.sh -p -a http://127.0.0.1:5000 - pwd - ls - name: Upload coverage if: success() && matrix.go == env.LATEST_GO_VERSION && matrix.os == 'ubuntu-latest'