-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Eudonet Paris import GitHub Action
- Loading branch information
1 parent
8ee785d
commit 5ffd553
Showing
10 changed files
with
402 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: Eudonet Paris Import | ||
|
||
# on: | ||
# schedule: | ||
# - cron: '0 17 * * 1' # Tous les lundis à 17h00 | ||
|
||
on: | ||
push: | ||
branches: | ||
- feat/eudonet-auto | ||
|
||
jobs: | ||
eudonet_paris_import: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Setup PHP with PECL extension | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.2' | ||
|
||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: | | ||
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Install Scalingo CLI | ||
run: curl -O https://cli-dl.scalingo.com/install && bash install | ||
|
||
- name: Install SSH key | ||
# Credit: https://stackoverflow.com/a/69234389 | ||
run: | | ||
install -m 600 -D /dev/null ~/.ssh/id_rsa | ||
echo "${{ secrets.GH_SCALINGO_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | ||
- uses: actions/cache@v3 | ||
id: addok-bundle-cache | ||
with: | ||
path: docker/addok/addok-data | ||
key: ${{ runner.os }}-addok-bundle-${{ secrets.EUDONET_PARIS_KDRIVE_FILE_ID }} | ||
restore-keys: | | ||
${{ runner.os }}-addok-bundle- | ||
- name: Download and unzip Addok bundle | ||
if: steps.addok-bundle-cache.outputs.cache-hit != 'true' | ||
run: | | ||
mkdir -p tmp | ||
bash tools/download_addok_bundle.sh tmp/addok-archive.zip | ||
unzip -d tmp/addok-archive tmp/addok-archive.zip | ||
unzip -d docker/addok/addok-data tmp/addok-archive/addok-dialog-bundle.zip | ||
env: | ||
EUDONET_PARIS_KDRIVE_TOKEN: ${{ secrets.EUDONET_PARIS_KDRIVE_TOKEN }} | ||
EUDONET_PARIS_KDRIVE_FILE_ID: ${{ secrets.EUDONET_PARIS_KDRIVE_FILE_ID }} | ||
|
||
- name: Start Addok | ||
run: | | ||
make addok_start | ||
./tools/wait_for_url.py --interval 5 --max-attempts 10 "http://localhost:7878/search?q=rue+de+la+concertation" | ||
- name: Init environment variables | ||
run: | | ||
echo "DATABASE_URL=${{ secrets.EUDONET_PARIS_IMPORT_DATABASE_URL_PR }}" >> .env.local | ||
# Deal with JSON quotes | ||
printf "APP_EUDONET_PARIS_CREDENTIALS='%s'\n" '${{ secrets.APP_EUDONET_PARIS_CREDENTIALS }}' >> .env.local | ||
echo "APP_EUDONET_PARIS_ORG_ID=${{ secrets.APP_EUDONET_PARIS_ORG_ID_PR }}" >> .env.local | ||
echo "API_ADRESSE_BASE_URL=http://localhost:7878" >> .env.local | ||
- name: Run import | ||
run: make eudonet_paris_import_ci BIN_PHP="php" BIN_CONSOLE="php bin/console" BIN_COMPOSER="composer" | ||
|
||
- name: Get log file path | ||
id: logfile | ||
if: ${{ !cancelled() }} | ||
run: | ||
echo "path=$(find log/eudonet_paris -type f -name '*.log' | head -n 1)" >> $GITHUB_OUTPUT | ||
|
||
- uses: actions/upload-artifact@v3 | ||
if: ${{ !cancelled() }} | ||
with: | ||
name: eudonet_paris_logfile | ||
path: ${{ steps.logfile.outputs.path }} | ||
retention-days: 21 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
FROM postgis/postgis:14-3.3-alpine | ||
FROM postgis/postgis:14-3.3 | ||
|
||
RUN apk update | ||
RUN apk add gdal wget unzip p7zip | ||
RUN apt-get update | ||
RUN apt-get install -y gdal-bin wget unzip p7zip | ||
|
||
COPY run.sh junctions_json.sql /data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
DRIVE_ID=184671 | ||
|
||
ARCHIVE_ID=$( | ||
curl -L \ | ||
-X POST \ | ||
-H "Authorization: Bearer ${EUDONET_PARIS_KDRIVE_TOKEN}" \ | ||
-H "Content-Type: application/json" \ | ||
-d "{\"file_ids\": [\"${EUDONET_PARIS_KDRIVE_FILE_ID}\"]}" \ | ||
"https://api.infomaniak.com/3/drive/${DRIVE_ID}/files/archives" \ | ||
| jq --raw-output .data.uuid | ||
) | ||
|
||
curl -L \ | ||
-H "Authorization: Bearer ${EUDONET_PARIS_KDRIVE_TOKEN}" \ | ||
"https://api.infomaniak.com/2/drive/${DRIVE_ID}/files/archives/${ARCHIVE_ID}" \ | ||
> $1 |
Oops, something went wrong.