Skip to content

Commit

Permalink
ci: Fix GitHub archive URLs (#964)
Browse files Browse the repository at this point in the history
* ci: Fix GitHub archive URLs

* Fix upload filename

* Add change file
  • Loading branch information
edgarrmondragon authored Sep 5, 2023
1 parent bea6bce commit e1ba256
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 24 deletions.
5 changes: 5 additions & 0 deletions .changes/unreleased/Documentation-20230905-083410.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: Documentation
body: Fix GitHub archive URLs in integration test docs
time: 2023-09-05T08:34:10.769144-06:00
custom:
Issue: "964"
22 changes: 15 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,17 @@ jobs:

# Test Limesurvey/LimeSurvey branches
- python-version: "3.11"
ref: 5.x
ref: refs/heads/5.x
context: https://github.com/martialblog/docker-limesurvey.git#master:5.0/apache
database: postgres

- python-version: "3.11"
ref: develop
ref: refs/heads/develop
context: https://github.com/martialblog/docker-limesurvey.git#master:6.0/apache
database: postgres

- python-version: "3.11"
ref: master
ref: refs/heads/master
context: https://github.com/martialblog/docker-limesurvey.git#master:6.0/apache
database: postgres

Expand Down Expand Up @@ -251,7 +251,7 @@ jobs:
if: ${{ matrix.ref }}
run: |
wget https://github.com/LimeSurvey/LimeSurvey/archive/${{ matrix.ref }}.tar.gz -O ls.tar.gz -nv
echo "LS_CHECKSUM=$(sha256sum ls.tar.gz | cut -d' ' -f1)" >> $GITHUB_ENV
echo "LS_CHECKSUM=$(shasum -a 256 ls.tar.gz | cut -d' ' -f1)" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/[email protected]
Expand All @@ -266,7 +266,7 @@ jobs:
LS_IMAGE_TAG: ${{ matrix.image_tag }}
LS_DOCKERFILE_CONTEXT: ${{ matrix.context }}
LS_DOCKERFILE: Dockerfile
LS_VERSION: ${{ matrix.ref }}
LS_ARCHIVE_URL: "https://github.com/LimeSurvey/LimeSurvey/archive/${{ matrix.ref }}.tar.gz"
COMPOSE_FILE: "\
docker-compose.yml\
${{ matrix.ref && ':docker-compose.ref.yml' }}\
Expand All @@ -291,6 +291,14 @@ jobs:
name: coverage-data
path: ".coverage.*"

- name: Generate badge filename
if: always()
id: badge-filename
run: |
REF=${{ matrix.image_tag || matrix.ref }}
CLEAN_REF=${REF//\//-}
echo "filename=badge-integration-${{ matrix.python-version }}-${CLEAN_REF}-${{ matrix.database }}.json" >> $GITHUB_OUTPUT
- name: Update integration status badge
if: always()
id: badge
Expand All @@ -300,15 +308,15 @@ jobs:
"label": "${{ matrix.image_tag || matrix.ref }}, ${{ matrix.database }}",
"message": "${{ steps.nox-integration.outcome }}",
"color": "${{ steps.nox-integration.outcome == 'success' && 'green' || 'red' }}"
}' > badge-integration-${{ matrix.python-version }}-${{ matrix.image_tag || matrix.ref }}-${{ matrix.database }}.json
}' > ${{ steps.badge-filename.outputs.filename }}
- name: Deploy integration status badge
uses: exuanbo/actions-deploy-gist@v1
if: always() && steps.badge.outcome == 'success'
with:
token: ${{ secrets.GIST_TOKEN }}
gist_id: 02f3c72747cc609788c75c3cd32b4e97
file_path: badge-integration-${{ matrix.python-version }}-${{ matrix.image_tag || matrix.ref }}-${{ matrix.database }}.json
file_path: ${{ steps.badge-filename.outputs.filename }}

types:
name: Type checking
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ Python.
| 5.6.35+230822 | PostgreSQL | ![Status of 5.6.35+230822 integration tests, postgres](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2Fedgarrmondragon%2F02f3c72747cc609788c75c3cd32b4e97%2Fraw%2Fbadge-integration-3.11-5.6.35-230822-apache-postgres.json) |
| 5.6.34+230816 | PostgreSQL | ![Status of 5.6.34+230816 integration tests, postgres](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2Fedgarrmondragon%2F02f3c72747cc609788c75c3cd32b4e97%2Fraw%2Fbadge-integration-3.11-5.6.34-230816-apache-postgres.json) |
| 5.6.33+230808 | PostgreSQL | ![Status of 5.6.33+230808 integration tests, postgres](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2Fedgarrmondragon%2F02f3c72747cc609788c75c3cd32b4e97%2Fraw%2Fbadge-integration-3.11-5.6.33-230808-apache-postgres.json) |
| `master` branch | PostgreSQL | ![Status of master branch integration tests, postgres](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2Fedgarrmondragon%2F02f3c72747cc609788c75c3cd32b4e97%2Fraw%2Fbadge-integration-3.11-master-postgres.json) |
| `develop` branch | PostgreSQL | ![Status of develop branch integration tests, postgres](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2Fedgarrmondragon%2F02f3c72747cc609788c75c3cd32b4e97%2Fraw%2Fbadge-integration-3.11-develop-postgres.json) |
| `5.x` branch | PostgreSQL | ![Status of 5.x branch integration tests, postgres](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2Fedgarrmondragon%2F02f3c72747cc609788c75c3cd32b4e97%2Fraw%2Fbadge-integration-3.11-5.x-postgres.json) |
| `master` branch | PostgreSQL | ![Status of master branch integration tests, postgres](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2Fedgarrmondragon%2F02f3c72747cc609788c75c3cd32b4e97%2Fraw%2Fbadge-integration-3.11-refs-heads-master-postgres.json) |
| `develop` branch | PostgreSQL | ![Status of develop branch integration tests, postgres](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2Fedgarrmondragon%2F02f3c72747cc609788c75c3cd32b4e97%2Fraw%2Fbadge-integration-3.11-refs-heads-develop-postgres.json) |
| `5.x` branch | PostgreSQL | ![Status of 5.x branch integration tests, postgres](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2Fedgarrmondragon%2F02f3c72747cc609788c75c3cd32b4e97%2Fraw%2Fbadge-integration-3.11-refs-heads-5.x-postgres.json) |
<!-- end integration status -->

## Installation
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.ref.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ services:
context: ${LS_DOCKERFILE_CONTEXT:-https://github.com/martialblog/docker-limesurvey.git#master:6.0/apache}
dockerfile: ${LS_DOCKERFILE:-Dockerfile}
args:
version: ${LS_VERSION}
archive_url: ${LS_ARCHIVE_URL}
sha256_checksum: ${LS_CHECKSUM}
18 changes: 8 additions & 10 deletions docs/contributing/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ nox -rs integration

```shell
export DOCKER_BUILDKIT=0
export LS_VERSION=f148781ec57fd1a02e5faa26a7465d78c9ab5dfe
export LS_ARCHIVE_URL=https://github.com/LimeSurvey/LimeSurvey/archive/f148781ec57fd1a02e5faa26a7465d78c9ab5dfe.tar.gz
export LS_CHECKSUM=64aec410738b55c51045ac15373e2bc376e67cd6e20938d759c4596837ef6154

docker compose \
Expand All @@ -68,25 +68,23 @@ docker compose \
nox -rs integration
```

Where `LS_VERSION` is the commit SHA at the point of interest and `LS_CHECKSUM`
is the SHA256 checksum of the `.tar.gz` archive of the project at that commit.
Where `LS_ARCHIVE_URL` is the [GitHub source code archive URL](https://docs.github.com/en/repositories/working-with-files/using-files/downloading-source-code-archives#source-code-archive-urls), which can reference a tag, a branch, or a commit. `LS_CHECKSUM`
is the SHA256 checksum of the `.tar.gz` archive of the project at that ref.

````{tip}
You can obtain the checksum by running:
```shell
wget https://github.com/LimeSurvey/LimeSurvey/archive/${LS_VERSION}.tar.gz
sha256sum ${LS_VERSION}.tar.gz
wget $LS_ARCHIVE_URL -O limesurvey.tar.gz
shasum -a 256 limesurvey.tar.gz
```
````

To test against such a version in CI, add the following to the job matrix:
To test against such a version in CI, add the following to the test matrix in the `integration` job:

```yaml
- python-version: "3.11"
os: "ubuntu-latest"
session: "integration"
limesurvey_version: "f148781ec57fd1a02e5faa26a7465d78c9ab5dfe"
ref: "f148781ec57fd1a02e5faa26a7465d78c9ab5dfe"
context: https://github.com/martialblog/docker-limesurvey.git#master:6.0/apache
database: postgres
experimental: true
```
6 changes: 3 additions & 3 deletions scripts/gen_integration_results_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,17 @@ def main() -> None:
(
"`master` branch",
"PostgreSQL",
image("master branch", "postgres", "3.11", "master"),
image("master branch", "postgres", "3.11", "refs-heads-master"),
),
(
"`develop` branch",
"PostgreSQL",
image("develop branch", "postgres", "3.11", "develop"),
image("develop branch", "postgres", "3.11", "refs-heads-develop"),
),
(
"`5.x` branch",
"PostgreSQL",
image("5.x branch", "postgres", "3.11", "5.x"),
image("5.x branch", "postgres", "3.11", "refs-heads-5.x"),
),
]

Expand Down

0 comments on commit e1ba256

Please sign in to comment.