Skip to content

Commit

Permalink
Fix in dir doesn't exist and push docker image from action
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoRio42 committed Oct 21, 2024
1 parent e1559ce commit 2fd89d3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/linux-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Build for linux x86_64"
name: "Build for linux x86_64 and publish Docker image"
on:
release:
types: [created]
Expand All @@ -24,7 +24,7 @@ jobs:
- run: cp target/x86_64-unknown-linux-gnu/release/cassini .

- name: 'Compress binaries'
- name: "Compress binaries"
if: true
uses: a7ul/tar-action@v1.1.2
with:
Expand All @@ -33,15 +33,29 @@ jobs:
cassini
LICENCE.md
README.md
outPath: '${{ runner.temp }}/cassini-x86_64-linux.tar.gz'
outPath: "${{ runner.temp }}/cassini-x86_64-linux.tar.gz"

- name: 'Release binaries'
- name: "Release binaries"
if: true
uses: pragmatrix/release-action@v1.11.1-rs
with:
allowUpdates: true
replacesArtifacts: true
artifacts: '${{ runner.temp }}/cassini-x86_64-linux.tar.gz'
artifacts: "${{ runner.temp }}/cassini-x86_64-linux.tar.gz"
token: ${{ secrets.GITHUB_TOKEN }}
artifactErrorsFailBuild: true
prerelease: true

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/cassini:${{ github.ref_name }} .
- name: Push Docker image
run: |
docker push ${{ secrets.DOCKER_USERNAME }}/cassini:${{ github.ref_name }}
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM pdal/pdal
WORKDIR /app
COPY ./target/release/cassini /app
RUN pip install GDAL=="3.9.2"
ENTRYPOINT ["./cassini"]
#docker run -it -v "$(pwd)":/app/out test ./out/tile.laz --skip-vector
COPY ./target/x86_64-unknown-linux-gnu/release/cassini /bin
RUN pip install GDAL==$(gdal-config --version)
ENTRYPOINT ["/bin/cassini"]
#docker run -it -v "$(pwd)":/app test ./tile.laz --skip-vector
10 changes: 8 additions & 2 deletions src/download.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::{
fs::File,
fs::{create_dir_all, File},
io::{copy, stdout, Write},
path::Path,
process::{Command, Stdio},
Expand All @@ -20,7 +20,13 @@ pub fn download_osm_files_for_all_tiles_if_needed(tiles: &Vec<TileWithNeighbors>
}

pub fn download_osm_file_if_needed(min_x: i64, min_y: i64, max_x: i64, max_y: i64) {
let osm_file_path = Path::new("in").join(format!("{:0>7}_{:0>7}.osm", min_x, max_y));
let in_path = Path::new("in");

if !in_path.exists() {
create_dir_all(in_path).unwrap();
}

let osm_file_path = in_path.join(format!("{:0>7}_{:0>7}.osm", min_x, max_y));

if osm_file_path.exists() {
println!("Osm file already downloaded");
Expand Down

0 comments on commit 2fd89d3

Please sign in to comment.