From dc9ed512e5a1a62dbf3ba48ee4deb66da6e6ab1d Mon Sep 17 00:00:00 2001 From: kimikage Date: Thu, 25 Apr 2024 18:05:37 +0900 Subject: [PATCH] Update workflows (#301) This adds unit tests for julia v1.6 and julia on aarch64. This also introduces Dependabot. --- .github/dependabot.yml | 7 +++ .github/workflows/CompatHelper.yml | 19 +++----- .github/workflows/UnitTest.yml | 70 ++++++++++++++++------------ .github/workflows/UnitTestArm.yml | 73 ++++++++++++++++++++++++++++++ 4 files changed, 127 insertions(+), 42 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/UnitTestArm.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..700707c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml index 9e16d44..a5839fd 100644 --- a/.github/workflows/CompatHelper.yml +++ b/.github/workflows/CompatHelper.yml @@ -3,24 +3,19 @@ name: CompatHelper on: schedule: - cron: '00 0 * * *' - issues: - types: [opened, reopened] + workflow_dispatch: jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - matrix: - julia-version: [1.2.0] - julia-arch: [x86] - os: [ubuntu-latest] + CompatHelper: + permissions: + pull-requests: write + contents: write + runs-on: ubuntu-latest steps: - - uses: julia-actions/setup-julia@latest - with: - version: ${{ matrix.julia-version }} - 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()' diff --git a/.github/workflows/UnitTest.yml b/.github/workflows/UnitTest.yml index 2ce8de9..207d893 100644 --- a/.github/workflows/UnitTest.yml +++ b/.github/workflows/UnitTest.yml @@ -1,45 +1,55 @@ name: Unit test on: - create: - tags: push: branches: - - master + - 'master' + - 'release-*' + tags: ['*'] pull_request: - schedule: - - cron: '20 00 1 * *' - + 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 }} + timeout-minutes: 60 + permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created + actions: write + contents: read strategy: + fail-fast: false matrix: - julia-version: ['1.0', '1', 'nightly'] - os: [ubuntu-latest, windows-latest, macOS-latest] - + version: + - '1.0' + - '1.6' + - '1' + - 'nightly' + os: + - ubuntu-latest + - windows-latest + - macos-latest + arch: + - x64 + include: + - os: ubuntu-latest + version: '1' + arch: x86 steps: - - uses: actions/checkout@v1.0.0 - - name: "Set up Julia" - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 with: - version: ${{ matrix.julia-version }} - - - name: Cache artifacts - uses: actions/cache@v1 - env: - cache-name: cache-artifacts - with: - path: ~/.julia/artifacts - key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} - restore-keys: | - ${{ runner.os }}-test-${{ env.cache-name }}- - ${{ runner.os }}-test- - ${{ runner.os }}- - - - name: "Unit Test" - uses: julia-actions/julia-runtest@master + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + - uses: julia-actions/cache@v1 + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v4 with: - file: lcov.info + files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/UnitTestArm.yml b/.github/workflows/UnitTestArm.yml new file mode 100644 index 0000000..f5c5aca --- /dev/null +++ b/.github/workflows/UnitTestArm.yml @@ -0,0 +1,73 @@ +name: Unit test for Arm + +on: + push: + branches: + - master + pull_request: + workflow_dispatch: +permissions: + actions: write + contents: read +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + julia-version: ['1', '1.6', 'nightly'] + os: [ubuntu-latest] + distro: [ubuntu_latest] + arch: [aarch64] + + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.julia-version }} + - uses: julia-actions/cache@v1 + - name: Download Julia Binary + run: > + julia -e ' + using Pkg; Pkg.add("JSON"); using JSON; + if "${{ matrix.julia-version }}" == "nightly"; + url = "https://julialangnightlies-s3.julialang.org/bin/linux/${{ matrix.arch }}/julia-latest-linux-${{ matrix.arch }}.tar.gz"; + else; + path = download("https://julialang-s3.julialang.org/bin/versions.json"); + json = JSON.parsefile(path); + try rm(path) catch end; + vspec = Pkg.Types.VersionSpec("${{ matrix.julia-version }}"); + a(f) = f["arch"] == "${{ matrix.arch }}" && f["os"] == "linux" && !occursin("musl", f["triplet"]); + m = filter(json) do v; vn = VersionNumber(v[1]); vn in vspec && isempty(vn.prerelease) && any(a, v[2]["files"]); end; + v = sort(VersionNumber.(keys(m)))[end]; + url = filter(a, json[string(v)]["files"])[1]["url"]; + end; + download(url, "/tmp/julia-aarch64.tar.gz");' + + - name: Extract Julia Files + run: | + mkdir -p /home/runner/work/julia/ + tar -xf /tmp/julia-aarch64.tar.gz --strip-components=1 -C /home/runner/work/julia/ + rm /tmp/julia-aarch64.tar.gz + + - uses: uraimo/run-on-arch-action@v2.7.2 + name: Unit Test + with: + arch: ${{ matrix.arch }} + distro: ${{ matrix.distro }} + dockerRunArgs: | + -v "/home/runner/work/julia:/home/runner/work/julia" + -v "/home/runner/.julia/registries:/root/.julia/registries" + --net=host + install: | + ln -s /home/runner/work/julia/bin/julia /usr/local/bin/julia + echo /home/runner/work/julia/lib > /etc/ld.so.conf.d/julia.conf + mkdir -p /root/.julia/registries/General + run: | + julia --compile=min -O0 -e 'using InteractiveUtils; versioninfo();' + julia --project=. --check-bounds=yes --color=yes -e 'using Pkg; Pkg.build(); Pkg.test(coverage=true)' + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} # required + file: lcov.info