-
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix CI: use new nginx and postgis actions (#1351)
I recently released a new nginx github action that should work on all OS and in all runners. Also, postgis action has been updated.
- Loading branch information
Showing
3 changed files
with
26 additions
and
110 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 |
---|---|---|
|
@@ -162,14 +162,12 @@ jobs: | |
mv target_releases/aarch64-unknown-linux-musl/* target_releases/linux/arm64/ | ||
mkdir -p target_releases/linux/amd64 | ||
mv target_releases/x86_64-unknown-linux-musl/* target_releases/linux/amd64/ | ||
- name: Start HTTP Server | ||
run: | | ||
docker run --rm -d \ | ||
--name fileserver \ | ||
-p 5412:80 \ | ||
-v ${{ github.workspace }}/tests/fixtures/pmtiles2:/usr/share/nginx/html \ | ||
nginx:alpine | ||
- name: Start NGINX | ||
uses: nyurik/[email protected] | ||
id: nginx | ||
with: { port: '5412', output-unix-paths: 'yes' } | ||
- name: Copy static files | ||
run: cp -r tests/fixtures/pmtiles2/* ${{ steps.nginx.outputs.html-dir }} | ||
- name: Build linux/arm64 Docker image | ||
uses: docker/build-push-action@v5 | ||
# https://github.com/docker/build-push-action | ||
|
@@ -328,108 +326,27 @@ jobs: | |
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
# - name: Install Docker (MacOS) | ||
# if: runner.os == 'macos' | ||
# run: brew install docker && colima start | ||
- name: Start HTTP Server (with Docker) | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
docker run --rm -d \ | ||
--name fileserver \ | ||
-p 5412:80 \ | ||
-v ${{ github.workspace }}/tests/fixtures/pmtiles2:/usr/share/nginx/html \ | ||
nginx:alpine | ||
- name: Start HTTP Server (MacOS, no Docker) | ||
if: runner.os == 'macos' | ||
run: | | ||
mkdir -p /usr/local/etc/nginx | ||
cat << EOF > /usr/local/etc/nginx/nginx.conf | ||
worker_processes 1; | ||
events { | ||
worker_connections 1024; | ||
} | ||
http { | ||
include mime.types; | ||
default_type application/octet-stream; | ||
sendfile on; | ||
keepalive_timeout 65; | ||
server { | ||
listen 5412; | ||
server_name localhost; | ||
location / { | ||
root $PWD/tests/fixtures/pmtiles2; | ||
index index.html index.htm; | ||
} | ||
} | ||
} | ||
EOF | ||
brew services info nginx | ||
brew services start nginx | ||
sleep 2 | ||
curl -I http://localhost:5412/ | ||
curl -I http://localhost:5412/webp2.pmtiles | ||
- name: Start HTTP Server (Windows, no Docker) | ||
if: runner.os == 'windows' | ||
shell: pwsh | ||
run: | | ||
$nginxConf = @" | ||
worker_processes 1; | ||
events { | ||
worker_connections 1024; | ||
} | ||
http { | ||
include mime.types; | ||
default_type application/octet-stream; | ||
sendfile on; | ||
keepalive_timeout 65; | ||
server { | ||
listen 5412; | ||
server_name localhost; | ||
location / { | ||
root $($PWD.Path)/tests/fixtures/pmtiles2; | ||
index index.html index.htm; | ||
} | ||
} | ||
} | ||
"@ | ||
# Replace the default Nginx configuration file | ||
echo "$nginxConf" | ||
Set-Content -Path "C:\tools\nginx-1.25.4\conf\nginx.conf" -Value $nginxConf | ||
Get-Content -Path "C:\tools\nginx-1.25.4\conf\nginx.conf" | ||
# Start Nginx | ||
#Get-Service -ErrorAction SilentlyContinue | ||
#Get-CimInstance -ClassName Win32_Service | ||
Set-Service nginx -StartupType manual | ||
Start-Service nginx | ||
#Start-Process -FilePath "C:\tools\nginx-1.25.4\nginx.exe" | ||
dir C:\tools\nginx-1.25.4\logs\ | ||
Start-Sleep -Seconds 5 | ||
netstat -a | ||
# Print Nginx Error Logs (on Windows systems) | ||
#nginx -t | ||
Get-Content -Path "C:\tools\nginx-1.25.4\logs\error.log" | ||
dir D:\a\martin\martin\ | ||
- name: Start postgres | ||
uses: nyurik/[email protected] | ||
- name: Start NGINX | ||
uses: nyurik/[email protected] | ||
id: nginx | ||
with: { port: '5412', output-unix-paths: 'yes' } | ||
- name: Copy static files | ||
run: cp -r tests/fixtures/pmtiles2/* ${{ steps.nginx.outputs.html-dir }} | ||
- name: Install and run Postgis | ||
uses: nyurik/action-setup-postgis@v2 | ||
id: pg | ||
with: | ||
username: test | ||
password: test | ||
database: test | ||
rights: --superuser | ||
- name: Init database | ||
run: | | ||
echo "DATABASE_URL=$DATABASE_URL" | ||
echo "DATABASE_URL=${{ steps.pg.outputs.connection-uri }}" | ||
echo "Print the same in base64 to bypass Github's obfuscation (uses hardcoded password):" | ||
echo "$DATABASE_URL" | base64 | ||
echo "${{ steps.pg.outputs.connection-uri }}" | base64 | ||
tests/fixtures/initdb.sh | ||
env: | ||
DATABASE_URL: ${{ steps.pg.outputs.connection-uri }} | ||
PGSERVICE: ${{ steps.pg.outputs.service-name }} | ||
- name: Download build artifact build-${{ matrix.target }} | ||
uses: actions/download-artifact@v3 | ||
with: | ||
|
@@ -534,13 +451,12 @@ jobs: | |
uses: actions/checkout@v4 | ||
- uses: Swatinem/rust-cache@v2 | ||
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch' | ||
- name: Start HTTP Server | ||
run: | | ||
docker run --rm -d \ | ||
--name fileserver \ | ||
-p 5412:80 \ | ||
-v ${{ github.workspace }}/tests/fixtures/pmtiles2:/usr/share/nginx/html \ | ||
nginx:alpine | ||
- name: Run NGINX | ||
uses: nyurik/[email protected] | ||
id: nginx | ||
with: { port: '5412', output-unix-paths: 'yes' } | ||
- name: Copy static files | ||
run: cp -r tests/fixtures/pmtiles2/* ${{ steps.nginx.outputs.html-dir }} | ||
- name: Init database | ||
run: tests/fixtures/initdb.sh | ||
env: | ||
|
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