Skip to content

Commit

Permalink
hook unit testing to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
samtkaplan committed Oct 6, 2020
1 parent 9f98451 commit 9e9287d
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 10 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
- uses: azure/[email protected]
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() }}
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
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
18 changes: 11 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -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)
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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)
Expand Down

0 comments on commit 9e9287d

Please sign in to comment.