From 9e9287d18fda740f3f1316dd642b2d3fd2f8cc4f Mon Sep 17 00:00:00 2001 From: Sam Kaplan Date: Mon, 5 Oct 2020 18:19:52 +0000 Subject: [PATCH] hook unit testing to CI --- .github/workflows/Test.yml | 38 ++++++++++++++++++++++++++++++++++++++ README.md | 22 +++++++++++++++++++--- test/runtests.jl | 18 +++++++++++------- 3 files changed, 68 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/Test.yml diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml new file mode 100644 index 0000000..641c385 --- /dev/null +++ b/.github/workflows/Test.yml @@ -0,0 +1,38 @@ +name: Tests +on: [push, pull_request] +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + julia-version: [1.0, 1.5] + os: [ubuntu-latest, windows-latest, macOS-latest] + steps: + - uses: actions/checkout@v1.0.0 + - uses: azure/login@v1.1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + - uses: julia-actions/setup-julia@latest + with: + version: ${{ matrix.julia-version }} + - name: Generate UUID + id: uuid + run: julia -e 'using Random; write(stdout,"::set-output name=uuid::"*lowercase(randstring(21)))' + shell: bash + - name: Run Az CLI script + run: | + az group create -l southcentralus -n "azstorage-${{ matrix.os }}-${{ matrix.julia-version }}-${{ github.run_id }}" + az storage account create -n "s${{ steps.uuid.outputs.uuid }}" -g "azstorage-${{ matrix.os }}-${{ matrix.julia-version }}-${{ github.run_id }}" -l southcentralus + - uses: julia-actions/julia-buildpkg@latest #change lastest to master + - uses: julia-actions/julia-runtest@latest #change lastest to master + env: + AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} + STORAGE_ACCOUNT: "s${{ steps.uuid.outputs.uuid }}" + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v1 + with: + file: lcov.info + - name: Run Az CLI script + run: | + az group delete -n "azstorage-${{ matrix.os }}-${{ matrix.julia-version }}-${{ github.run_id }}" --yes + if: ${{ always() }} diff --git a/README.md b/README.md index cacecd1..d0349fc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,22 @@ # AzStorage.jl -[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://ChevronETC.github.io/AzStorage.jl/stable) -[![](https://img.shields.io/badge/docs-dev-blue.svg)](https://ChevronETC.github.io/AzStorage.jl/dev) +| **Documentation** | **Action Statuses** | +|:---:|:---:| +| [![][docs-dev-img]][docs-dev-url] [![][docs-stable-img]][docs-stable-url] | [![][doc-build-status-img]][doc-build-status-url] [![][build-status-img]][build-status-url] [![][code-coverage-img]][code-coverage-results] | -Interface to Azure blob storage. \ No newline at end of file +Interface to Azure blob storage. + +[docs-dev-img]: https://img.shields.io/badge/docs-dev-blue.svg +[docs-dev-url]: https://chevronetc.github.io/AzStorage.jl/dev/ + +[docs-stable-img]: https://img.shields.io/badge/docs-stable-blue.svg +[docs-stable-url]: https://ChevronETC.github.io/AzStorage.jl/stable + +[doc-build-status-img]: https://github.com/ChevronETC/AzStorage.jl/workflows/Documentation/badge.svg +[doc-build-status-url]: https://github.com/ChevronETC/AzStorage.jl/actions?query=workflow%3ADocumentation + +[build-status-img]: https://github.com/ChevronETC/AzStorage.jl/workflows/Tests/badge.svg +[build-status-url]: https://github.com/ChevronETC/AzStorage.jl/actions?query=workflow%3A"Tests" + +[code-coverage-img]: https://codecov.io/gh/ChevronETC/AzStorage.jl/branch/master/graph/badge.svg +[code-coverage-results]: https://codecov.io/gh/ChevronETC/AzStorage.jl \ No newline at end of file diff --git a/test/runtests.jl b/test/runtests.jl index 6d71648..160e791 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,10 @@ using AbstractStorage, AzSessions, AzStorage, Dates, JSON, Random, Test -session = AzSession(read(joinpath(homedir(),"session.json"), String)) +credentials = JSON.parse(ENV["AZURE_CREDENTIALS"]) +AzSessions.write_manifest(;client_id=credentials["clientId"], client_secret=credentials["clientSecret"], tenant=credentials["tenantId"]) + +session = AzSession(;protocal=AzClientCredentials, client_id=credentials["clientId"], client_secret=credentials["clientSecret"], resource="https://storage.azure.com/") + storageaccount = ENV["STORAGE_ACCOUNT"] @info "storageaccount=$storageaccount" @@ -220,7 +224,7 @@ end @testset "Object, bytes" begin sleep(1) - r = lowercase(randstring(MersenneTwister(millisecond(now())+13))) + r = lowercase(randstring(MersenneTwister(millisecond(now())+14))) c = AzContainer("foo-$r-k", storageaccount=storageaccount, session=session, nthreads=2, nretry=10) io = open(c, "bar") x = rand(10) @@ -232,7 +236,7 @@ end @testset "Object, bytes" begin sleep(1) - r = lowercase(randstring(MersenneTwister(millisecond(now())+13))) + r = lowercase(randstring(MersenneTwister(millisecond(now())+15))) c = AzContainer("foo-$r-k", storageaccount=storageaccount, session=session, nthreads=2, nretry=10) io = open(c, "bar") write(io, "hello") @@ -243,7 +247,7 @@ end @testset "Object, isfile" begin sleep(1) - r = lowercase(randstring(MersenneTwister(millisecond(now())+13))) + r = lowercase(randstring(MersenneTwister(millisecond(now())+16))) c = AzContainer("foo-$r-k", storageaccount=storageaccount, session=session, nthreads=2, nretry=10) io = open(c, "bar") write(io, "hello") @@ -253,7 +257,7 @@ end @testset "Object, rm" begin sleep(1) - r = lowercase(randstring(MersenneTwister(millisecond(now())+13))) + r = lowercase(randstring(MersenneTwister(millisecond(now())+17))) c = AzContainer("foo-$r-k", storageaccount=storageaccount, session=session, nthreads=2, nretry=10) io = open(c, "bar") write(io, "hello") @@ -265,7 +269,7 @@ end @testset "Object, joinpath" begin sleep(1) - r = lowercase(randstring(MersenneTwister(millisecond(now())+13))) + r = lowercase(randstring(MersenneTwister(millisecond(now())+18))) c = AzContainer("foo-$r-k", storageaccount=storageaccount, session=session, nthreads=2, nretry=10) io = joinpath(c, "bar", "baz") write(io, "hello") @@ -277,7 +281,7 @@ end # Anusha found the failing example. @testset "Anusha's example" begin sleep(1) - r = lowercase(randstring(MersenneTwister(millisecond(now())+14))) + r = lowercase(randstring(MersenneTwister(millisecond(now())+19))) c = AzContainer("foo-$r-l", storageaccount=storageaccount, session=session, nthreads=2, nretry=10) mkpath(c) x = rand(2801,13821)