-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from AtilaSaraiva/tests
Fixing tests
- Loading branch information
Showing
10 changed files
with
181 additions
and
23 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,64 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: ['*'] | ||
pull_request: | ||
workflow_dispatch: | ||
concurrency: | ||
# Skip intermediate builds: always. | ||
# Cancel intermediate builds: only if it is a pull request build. | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | ||
jobs: | ||
test: | ||
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
version: | ||
- '1.6' | ||
- '1.9' | ||
- 'nightly' | ||
os: | ||
- ubuntu-latest | ||
arch: | ||
- x64 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: ${{ matrix.version }} | ||
arch: ${{ matrix.arch }} | ||
- uses: julia-actions/cache@v1 | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
- uses: julia-actions/julia-runtest@v1 | ||
docs: | ||
name: Documentation | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
statuses: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: '1' | ||
- name: Configure doc environment | ||
run: | | ||
julia --project=docs/ -e ' | ||
using Pkg | ||
Pkg.develop(PackageSpec(path=pwd())) | ||
Pkg.instantiate()' | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
- uses: julia-actions/julia-docdeploy@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- run: | | ||
julia --project=docs -e ' | ||
using Documenter: DocMeta, doctest | ||
using SeisMain | ||
DocMeta.setdocmeta!(SeisMain, :DocTestSetup, :(using SeisMain); recursive=true) | ||
doctest(SeisMain)' |
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,16 @@ | ||
name: CompatHelper | ||
on: | ||
schedule: | ||
- cron: 0 0 * * * | ||
workflow_dispatch: | ||
jobs: | ||
CompatHelper: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Pkg.add("CompatHelper") | ||
run: julia -e 'using Pkg; Pkg.add("CompatHelper")' | ||
- name: CompatHelper.main() | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} | ||
run: julia -e 'using CompatHelper; CompatHelper.main()' |
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,50 @@ | ||
using Downloads | ||
using SHA | ||
|
||
""" | ||
download_if_needed(url::String, output::String, sha256sum::String) | ||
Download the file from `url` to `output` if the file is not already present | ||
or if its SHA256 checksum does not match the `sha256sum`. | ||
# Arguments | ||
- `url::String`: The URL from which to download the file. | ||
- `output::String`: The path where the downloaded file will be saved. | ||
# Keyword arguments | ||
- `sha256sum::String`: The expected SHA256 checksum of the file to ensure its integrity. | ||
# Output | ||
- `nothing`: This function returns `nothing`. It performs the side effect of downloading a file and verifying its checksum. If the checksum does not match, the function raises an error and deletes the downloaded file. | ||
*Credits: Átila Saraiva Quintela Soares, 2024* | ||
""" | ||
function download_if_needed(url::String, output::String; sha256sum::String) | ||
file_exists = isfile(output) | ||
|
||
if file_exists | ||
file_sha256 = open(output) do io | ||
io |> sha256 |> bytes2hex | ||
end | ||
if file_sha256 == sha256sum | ||
return nothing | ||
else | ||
@warn("File exists but checksum does not match. Downloading again.") | ||
end | ||
end | ||
|
||
# Download the file | ||
Downloads.download(url, output) | ||
|
||
# Verify checksum of the downloaded file | ||
open(output) do io | ||
file_sha256 = io |> sha256 |> bytes2hex | ||
if file_sha256 != sha256sum | ||
rm(output) | ||
error("Downloaded file checksum does not match the expected checksum.") | ||
end | ||
end | ||
|
||
return nothing | ||
end | ||
|
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 was deleted.
Oops, something went wrong.
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,3 +1,6 @@ | ||
using SeisMain | ||
using Test | ||
|
||
include("test_IO.jl") | ||
include("test_bin.jl") | ||
include("test_patch.jl") |
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,15 +1,23 @@ | ||
using SeisMain | ||
using Test | ||
|
||
#From USGS, National Petroleum Reserve - Alaska Data Archive | ||
#https://energy.usgs.gov/GeochemistryGeophysics/SeismicDataProcessingInterpretation/NPRASeismicDataArchive.aspx#3862174-data- | ||
|
||
download("http://certmapper.cr.usgs.gov/data/NPRA/seismic/1976/125_76/PROCESSED/125_76_PT2_PR.SGY","125_76.SGY") | ||
|
||
download_if_needed("https://saigfileserver.physics.ualberta.ca/static/Datasets/Testing/16_81_PT1_PR.SGY", "16_81_PT1_PR.SGY", sha256sum="54791e8626215d36f6ebcecc3039da2fd74f3472518f47d8e8137c81c2ccfc2f") | ||
|
||
SegyToSeis("125_76.SGY","125_76") | ||
d,h,ext = SeisRead("125_76") | ||
SegyToSeis("16_81_PT1_PR.SGY","16_81_PT1_PR") | ||
d,h,ext = SeisRead("16_81_PT1_PR") | ||
imx = SeisMain.ExtractHeader(h,"imx") | ||
println("size(d)=",size(d)) | ||
println("imx=",imx) | ||
SeisWrite("125_76_copy",d,h,ext) | ||
SeisWrite("16_81_PT1_PR_copy",d,h,ext) | ||
|
||
for file in ( | ||
"16_81_PT1_PR", | ||
"16_81_PT1_PR.SGY", | ||
"16_81_PT1_PR@data@", | ||
"16_81_PT1_PR@headers@", | ||
"16_81_PT1_PR_copy", | ||
"16_81_PT1_PR_copy@data@", | ||
"16_81_PT1_PR_copy@headers@", | ||
) | ||
rm(joinpath(@__DIR__, file)) | ||
end |
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