summaryrefslogtreecommitdiff
path: root/.github/workflows/fedora.yml
blob: 64df018339d9f1f4205a52678e26401fb622b4fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Fedora

on:
  pull_request:
  push:
  release:
    types: [published]

jobs:
  build:

    container: fedora:latest
    runs-on: ubuntu-latest

    steps:
      - name: prepare build tools
        run: |
          uname -a
          dnf -y install @development-tools @rpm-development-tools
          dnf -y install copr-cli make gcc-c++
          dnf -y upgrade git
      - uses: actions/checkout@v2
        with:
          submodules: true
      - name: prepare local xmake
        run: |
          cp -rf . ../xmake-source
      - uses: xmake-io/github-action-setup-xmake@v1
        with:
          xmake-version: local#../xmake-source
      - uses: olegtarasov/get-tag@v2
        id: tagName

        # build artifacts
      - name: artifact
        run: |
          export XMAKE_ROOT=y
          dnf -y install ncurses-devel readline-devel
          rpmbuild -ba ./scripts/rpmbuild/SPECS/xmake.spec
          cp ~/rpmbuild/SRPMS/xmake-*.fc32.src.rpm ./scripts/xmake-latest.fc32.src.rpm
        # upload artifacts
      - uses: actions/upload-artifact@v2
        with:
          name: xmake-latest.fc32.spec
          path: ./scripts/rpmbuild/SPECS/xmake.spec
      - uses: actions/upload-artifact@v2
        with:
          name: xmake-latest.fc32.src.rpm
          path: ./scripts/xmake-latest.fc32.src.rpm
      - uses: actions/upload-artifact@v2
        with:
          name: xmake-latest.fc32.noarch.rpm
          path: ~/rpmbuild/RPMS/noarch/xmake-*.fc32.noarch.rpm

        # publish release
      - name: publish
        if: github.event.action == 'published'
        uses: actions/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ github.event.release.upload_url }}
          asset_path: ./scripts/xmake-latest.fc32.src.rpm
          asset_name: xmake-${{ steps.tagName.outputs.tag }}.fc32.src.rpm
          asset_content_type: application/zip

        # publish release
      - name: publish
        if: github.event.action == 'published'
        uses: actions/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ github.event.release.upload_url }}
          asset_path: ./scripts/rpmbuild/SPECS/xmake.spec
          asset_name: xmake-${{ steps.tagName.outputs.tag }}.fc32.spec
          asset_content_type: application/zip

        # tests
      - name: tests
        env:
          XMAKE_ROOT: y
        run: |
          xmake lua -v -D tests/run.lua